Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- UTF-8
- 이명박
- ALV
- EUC-kr
- List box
- alv 정형화
- FI 용어정리
- ABAP
- Java
- 방화벽
- 가계부
- 엑소버드
- Smart Forms
- Enhancement
- ole
- Standard Function
- SAP
- selection screen
- 오라클 함수
- gimp
- 머니플랜
- function
- fi
- 유닉스
- EXIT
- KOSA
- 동적 쿼리
- sapa
- 스마트폼
- badi
Archives
- Today
- Total
Drunken Lion
BDC & ALV sample program 본문
*&---------------------------------------------------------------------*
*& Report ZPIM4002 *
*& 건가자산 대량 생성을 위한 임시 프로그램 *
*& *
*& *
*& 박준상. *
*&---------------------------------------------------------------------*
*& Report ZPIM4002 *
*& 건가자산 대량 생성을 위한 임시 프로그램 *
*& *
*& *
*& 박준상. *
*&---------------------------------------------------------------------*
REPORT ZPIM4002.
* Data 선언
TYPE-POOLS: SLIS.
DATA: L_POS TYPE I VALUE 0.
DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF FIELDCAT .
DATA: GS_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA : BEGIN OF PF_EXTAB OCCURS 0,
FCODE LIKE RSMPE-FUNC,
END OF PF_EXTAB.
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA: BDCMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
TABLES: ANLA.
DATA: BEGIN OF UPLOAD OCCURS 0,
ANLKL LIKE ANLA-ANLKL,
ANLN1 LIKE ANLA-ANLN1,
TXT50 LIKE ANLA-TXT50,
TXA50 LIKE ANLA-TXA50,
GSBER LIKE ANLZ-GSBER,
KOSTL LIKE ANLZ-KOSTL,
MEINS LIKE ANLA-MEINS,
LIFNR LIKE ANLA-LIFNR.
DATA: END OF UPLOAD.
DATA: RESULT LIKE UPLOAD OCCURS 0 WITH HEADER LINE.
DATA NAME1 LIKE LFA1-NAME1.
DATA: BDCMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
TABLES: ANLA.
DATA: BEGIN OF UPLOAD OCCURS 0,
ANLKL LIKE ANLA-ANLKL,
ANLN1 LIKE ANLA-ANLN1,
TXT50 LIKE ANLA-TXT50,
TXA50 LIKE ANLA-TXA50,
GSBER LIKE ANLZ-GSBER,
KOSTL LIKE ANLZ-KOSTL,
MEINS LIKE ANLA-MEINS,
LIFNR LIKE ANLA-LIFNR.
DATA: END OF UPLOAD.
DATA: RESULT LIKE UPLOAD OCCURS 0 WITH HEADER LINE.
DATA NAME1 LIKE LFA1-NAME1.
*selection screen.
SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-001.
PARAMETER : P_BNAME LIKE USR02-BNAME OBLIGATORY
DEFAULT SY-UNAME .
PARAMETER : P_FILE LIKE RLGRAP-FILENAME
DEFAULT 'C:\TEMP\ASSET.TXT' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK BL1 .
SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-001.
PARAMETER : P_BNAME LIKE USR02-BNAME OBLIGATORY
DEFAULT SY-UNAME .
PARAMETER : P_FILE LIKE RLGRAP-FILENAME
DEFAULT 'C:\TEMP\ASSET.TXT' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK BL1 .
SELECTION-SCREEN BEGIN OF BLOCK BL2 WITH FRAME TITLE TEXT-002.
SELECTION-SCREEN COMMENT:/1+(79) TEXT-003.
SELECTION-SCREEN END OF BLOCK BL2 .
SELECTION-SCREEN COMMENT:/1+(79) TEXT-003.
SELECTION-SCREEN END OF BLOCK BL2 .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
PERFORM GET_FILE_NAME USING P_FILE.
* Initialization.
INITIALIZATION.
PERFORM INIT.
PERFORM GET_FILE_NAME USING P_FILE.
* Initialization.
INITIALIZATION.
PERFORM INIT.
*START-OF-SELECTION.
START-OF-SELECTION.
START-OF-SELECTION.
PERFORM UPLOAD.
PERFORM MAKE_ASSET.
PERFORM SELECT_RESULT.
PERFORM LIST_WRITE.
PERFORM MAKE_ASSET.
PERFORM SELECT_RESULT.
PERFORM LIST_WRITE.
*&---------------------------------------------------------------------*
*& Form MAKE_BDCTAB
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM MAKE_BDCTAB.
REFRESH BDCDATA.
CLEAR BDCDATA.
CLEAR BDCDATA.
PERFORM BDCPROG USING 'SAPLAIST' '0105'.
PERFORM BDCDATEN USING 'ANLA-ANLKL' UPLOAD-ANLKL.
PERFORM BDCDATEN USING 'BDC_OKCODE' '/00 ' .
PERFORM BDCPROG USING 'SAPLAIST' '0140'.
PERFORM BDCDATEN USING 'ANLA-TXT50' UPLOAD-TXT50.
PERFORM BDCDATEN USING 'ANLA-TXA50' UPLOAD-TXA50.
PERFORM BDCDATEN USING 'ANLH-ANLHTXT' ''.
PERFORM BDCDATEN USING 'ANLA-MEINS' UPLOAD-MEINS.
PERFORM BDCDATEN USING 'ANLA-ANLN1' UPLOAD-ANLN1.
PERFORM BDCDATEN USING 'BDC_OKCODE' '/00 ' .
PERFORM BDCPROG USING 'SAPLAIST' '0145'.
PERFORM BDCDATEN USING 'ANLZ-GSBER' UPLOAD-GSBER.
PERFORM BDCDATEN USING 'ANLZ-KOSTL' UPLOAD-KOSTL.
PERFORM BDCDATEN USING 'BDC_OKCODE' '/00 ' .
PERFORM BDCPROG USING 'SAPLAIST' '0160'.
PERFORM BDCDATEN USING 'BDC_OKCODE' '/00 ' .
PERFORM BDCPROG USING 'SAPLAIST' '0181'.
PERFORM BDCDATEN USING 'ANLA-LIFNR' UPLOAD-LIFNR.
SELECT SINGLE NAME1 FROM LFA1 INTO NAME1
WHERE LIFNR = UPLOAD-LIFNR.
PERFORM BDCDATEN USING 'ANLA-HERST' NAME1.
PERFORM BDCDATEN USING 'BDC_OKCODE' '=BUCH' .
PERFORM BDCDATEN USING 'ANLA-ANLKL' UPLOAD-ANLKL.
PERFORM BDCDATEN USING 'BDC_OKCODE' '/00 ' .
PERFORM BDCPROG USING 'SAPLAIST' '0140'.
PERFORM BDCDATEN USING 'ANLA-TXT50' UPLOAD-TXT50.
PERFORM BDCDATEN USING 'ANLA-TXA50' UPLOAD-TXA50.
PERFORM BDCDATEN USING 'ANLH-ANLHTXT' ''.
PERFORM BDCDATEN USING 'ANLA-MEINS' UPLOAD-MEINS.
PERFORM BDCDATEN USING 'ANLA-ANLN1' UPLOAD-ANLN1.
PERFORM BDCDATEN USING 'BDC_OKCODE' '/00 ' .
PERFORM BDCPROG USING 'SAPLAIST' '0145'.
PERFORM BDCDATEN USING 'ANLZ-GSBER' UPLOAD-GSBER.
PERFORM BDCDATEN USING 'ANLZ-KOSTL' UPLOAD-KOSTL.
PERFORM BDCDATEN USING 'BDC_OKCODE' '/00 ' .
PERFORM BDCPROG USING 'SAPLAIST' '0160'.
PERFORM BDCDATEN USING 'BDC_OKCODE' '/00 ' .
PERFORM BDCPROG USING 'SAPLAIST' '0181'.
PERFORM BDCDATEN USING 'ANLA-LIFNR' UPLOAD-LIFNR.
SELECT SINGLE NAME1 FROM LFA1 INTO NAME1
WHERE LIFNR = UPLOAD-LIFNR.
PERFORM BDCDATEN USING 'ANLA-HERST' NAME1.
PERFORM BDCDATEN USING 'BDC_OKCODE' '=BUCH' .
ENDFORM. " MAKE_BDCTAB
*&---------------------------------------------------------------------*
*& Form BDCPROG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0143 text *
* -->P_0144 text *
*----------------------------------------------------------------------*
FORM BDCPROG USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
*& Form BDCPROG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0143 text *
* -->P_0144 text *
*----------------------------------------------------------------------*
FORM BDCPROG USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. " BDCPROG
*&---------------------------------------------------------------------*
*& Form BDCDATEN
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0148 text *
* -->P_P_GJAHR text *
*----------------------------------------------------------------------*
FORM BDCDATEN USING B_FNAM B_FVAL.
CLEAR BDCDATA.
BDCDATA-FNAM = B_FNAM.
BDCDATA-FVAL = B_FVAL.
APPEND BDCDATA.
*& Form BDCDATEN
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0148 text *
* -->P_P_GJAHR text *
*----------------------------------------------------------------------*
FORM BDCDATEN USING B_FNAM B_FVAL.
CLEAR BDCDATA.
BDCDATA-FNAM = B_FNAM.
BDCDATA-FVAL = B_FVAL.
APPEND BDCDATA.
ENDFORM. " BDCDATEN
*&---------------------------------------------------------------------*
*& Form UPLOAD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM UPLOAD.
*&---------------------------------------------------------------------*
*& Form UPLOAD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM UPLOAD.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = P_FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = UPLOAD
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
EXPORTING
CODEPAGE = ' '
FILENAME = P_FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = UPLOAD
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
ENDFORM. " UPLOAD
*&---------------------------------------------------------------------*
*& Form MAKE_ASSET
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM MAKE_ASSET.
*& Form MAKE_ASSET
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM MAKE_ASSET.
LOOP AT UPLOAD.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = UPLOAD-ANLKL
IMPORTING
OUTPUT = UPLOAD-ANLKL
EXCEPTIONS
OTHERS = 1.
EXPORTING
INPUT = UPLOAD-ANLKL
IMPORTING
OUTPUT = UPLOAD-ANLKL
EXCEPTIONS
OTHERS = 1.
PERFORM MAKE_BDCTAB.
CALL TRANSACTION 'AS01' USING BDCDATA
MODE 'E'
UPDATE 'S'
MESSAGES INTO BDCMSG.
CALL TRANSACTION 'AS01' USING BDCDATA
MODE 'E'
UPDATE 'S'
MESSAGES INTO BDCMSG.
IF SY-SUBRC = 0.
UPDATE ANLA SET ERNAM = P_BNAME
WHERE BUKRS = 'C100'
AND ANLN1 = UPLOAD-ANLN1.
ENDIF.
UPDATE ANLA SET ERNAM = P_BNAME
WHERE BUKRS = 'C100'
AND ANLN1 = UPLOAD-ANLN1.
ENDIF.
ENDLOOP.
ENDFORM. " MAKE_ASSET
*&---------------------------------------------------------------------*
*& Form LIST_WRITE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM LIST_WRITE.
*& Form LIST_WRITE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM LIST_WRITE.
PERFORM FIELDCAT.
PERFORM EVENTCAT.
PERFORM ALV_WRITE.
PERFORM EVENTCAT.
PERFORM ALV_WRITE.
ENDFORM. " LIST_WRITE
*&---------------------------------------------------------------------*
*& Form GET_FILE_NAME
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P_FILE text *
*----------------------------------------------------------------------*
FORM GET_FILE_NAME USING P_FILENAME.
*& Form GET_FILE_NAME
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P_FILE text *
*----------------------------------------------------------------------*
FORM GET_FILE_NAME USING P_FILENAME.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = 'c:\'
mask = ',*.*,*.*.'
mode = '0'
IMPORTING
filename = p_filename
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
EXPORTING
def_path = 'c:\'
mask = ',*.*,*.*.'
mode = '0'
IMPORTING
filename = p_filename
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
ENDFORM. " GET_FILE_NAME
*&---------------------------------------------------------------------*
*& Form FIELDCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FIELDCAT.
*&---------------------------------------------------------------------*
*& Form FIELDCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FIELDCAT.
PERFORM BUILD_FIELDCAT USING 'ANLKL' '자산계정'.
PERFORM BUILD_FIELDCAT USING 'ANLN1' '자산번호'.
PERFORM BUILD_FIELDCAT USING 'TXT50' '설명 1'.
PERFORM BUILD_FIELDCAT USING 'TXA50' '설명 2'.
PERFORM BUILD_FIELDCAT USING 'GSBER' '사업부'.
PERFORM BUILD_FIELDCAT USING 'KOSTL' '부서코드'.
PERFORM BUILD_FIELDCAT USING 'MEINS' '수량단위'.
PERFORM BUILD_FIELDCAT USING 'LIFNR' 'VENDOR'.
PERFORM BUILD_FIELDCAT USING 'ANLN1' '자산번호'.
PERFORM BUILD_FIELDCAT USING 'TXT50' '설명 1'.
PERFORM BUILD_FIELDCAT USING 'TXA50' '설명 2'.
PERFORM BUILD_FIELDCAT USING 'GSBER' '사업부'.
PERFORM BUILD_FIELDCAT USING 'KOSTL' '부서코드'.
PERFORM BUILD_FIELDCAT USING 'MEINS' '수량단위'.
PERFORM BUILD_FIELDCAT USING 'LIFNR' 'VENDOR'.
ENDFORM. " FIELDCAT
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0475 text *
* -->P_0476 text *
*----------------------------------------------------------------------*
FORM BUILD_FIELDCAT USING FIELDNAME FIELDTXT.
*& Form BUILD_FIELDCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0475 text *
* -->P_0476 text *
*----------------------------------------------------------------------*
FORM BUILD_FIELDCAT USING FIELDNAME FIELDTXT.
L_POS = L_POS + 1.
CLEAR FIELDCAT_LN.
FIELDCAT_LN-COL_POS = L_POS.
FIELDCAT_LN-FIELDNAME = FIELDNAME.
FIELDCAT_LN-REPTEXT_DDIC = FIELDTXT.
APPEND FIELDCAT_LN TO FIELDCAT.
CLEAR FIELDCAT_LN.
FIELDCAT_LN-COL_POS = L_POS.
FIELDCAT_LN-FIELDNAME = FIELDNAME.
FIELDCAT_LN-REPTEXT_DDIC = FIELDTXT.
APPEND FIELDCAT_LN TO FIELDCAT.
ENDFORM. " BUILD_FIELDCAT
*&---------------------------------------------------------------------*
*& Form EVENTCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM EVENTCAT.
*& Form EVENTCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM EVENTCAT.
ENDFORM. " EVENTCAT
*&---------------------------------------------------------------------*
*& Form ALV_WRITE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM ALV_WRITE.
*& Form ALV_WRITE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM ALV_WRITE.
DATA: PGM LIKE SY-REPID.
DATA G_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS' .
PGM = SY-REPID.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = PGM
I_CALLBACK_PF_STATUS_SET = G_STATUS
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
* I_STRUCTURE_NAME =
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = FIELDCAT
* it_excluding = pf_extab
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT = ' '
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = RESULT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
DATA G_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS' .
PGM = SY-REPID.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = PGM
I_CALLBACK_PF_STATUS_SET = G_STATUS
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
* I_STRUCTURE_NAME =
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = FIELDCAT
* it_excluding = pf_extab
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT = ' '
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = RESULT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. " ALV_WRITE
*&---------------------------------------------------------------------*
*& Form SELECT_RESULT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM SELECT_RESULT.
*&---------------------------------------------------------------------*
*& Form SELECT_RESULT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM SELECT_RESULT.
SELECT * INTO CORRESPONDING FIELDS OF TABLE RESULT
FROM ANLA FOR ALL ENTRIES IN UPLOAD
WHERE ANLN1 = UPLOAD-ANLN1
AND BUKRS = 'C100'.
LOOP AT RESULT.
SELECT SINGLE GSBER INTO RESULT-GSBER
FROM ANLZ
WHERE ANLN1 = RESULT-ANLN1
AND BUKRS = 'C100'.
MODIFY RESULT INDEX SY-TABIX.
ENDLOOP.
FROM ANLA FOR ALL ENTRIES IN UPLOAD
WHERE ANLN1 = UPLOAD-ANLN1
AND BUKRS = 'C100'.
LOOP AT RESULT.
SELECT SINGLE GSBER INTO RESULT-GSBER
FROM ANLZ
WHERE ANLN1 = RESULT-ANLN1
AND BUKRS = 'C100'.
MODIFY RESULT INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " SELECT_RESULT
*&---------------------------------------------------------------------*
*& Form INIT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM INIT.
*& Form INIT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM INIT.
GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GS_LAYOUT-F2CODE = '&ETA'.
GS_LAYOUT-ZEBRA = 'X'.
GS_LAYOUT-DETAIL_POPUP = 'X'.
GS_LAYOUT-F2CODE = '&ETA'.
GS_LAYOUT-ZEBRA = 'X'.
GS_LAYOUT-DETAIL_POPUP = 'X'.
ENDFORM. " INIT
*&---------------------------------------------------------------------*
*& Form SET_PF_STATUS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM set_pf_status USING lt_extab LIKE pf_extab[].
SET PF-STATUS 'ZALV_STANDARD' EXCLUDING lt_extab.
ENDFORM.
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form SET_PF_STATUS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM set_pf_status USING lt_extab LIKE pf_extab[].
SET PF-STATUS 'ZALV_STANDARD' EXCLUDING lt_extab.
ENDFORM.
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN 'BACK' OR 'RW' OR '%EX'.
* LEAVE TO SCREEN 0.
WHEN 'DOWN'.
PERFORM data_download.
ENDCASE.
ENDFORM. " EVENTCAT
WHEN 'BACK' OR 'RW' OR '%EX'.
* LEAVE TO SCREEN 0.
WHEN 'DOWN'.
PERFORM data_download.
ENDCASE.
ENDFORM. " EVENTCAT
*&---------------------------------------------------------------------*
*& Form DATA_DOWNLOAD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DATA_DOWNLOAD.
*& Form DATA_DOWNLOAD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DATA_DOWNLOAD.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
* BIN_FILESIZE = ' '
* CODEPAGE = ' '
* FILENAME =
FILETYPE = 'DAT'
* ITEM = ' '
* MODE = ' '
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* FILEMASK_MASK = ' '
* FILEMASK_TEXT = ' '
* FILETYPE_NO_CHANGE = ' '
* FILEMASK_ALL = ' '
* FILETYPE_NO_SHOW = ' '
* SILENT = 'S'
* COL_SELECT = ' '
* COL_SELECTMASK = ' '
* NO_AUTH_CHECK = ' '
* IMPORTING
* ACT_FILENAME =
* ACT_FILETYPE =
* FILESIZE =
* CANCEL =
TABLES
DATA_TAB = RESULT
* FIELDNAMES =
EXCEPTIONS
INVALID_FILESIZE = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
EXPORTING
* BIN_FILESIZE = ' '
* CODEPAGE = ' '
* FILENAME =
FILETYPE = 'DAT'
* ITEM = ' '
* MODE = ' '
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* FILEMASK_MASK = ' '
* FILEMASK_TEXT = ' '
* FILETYPE_NO_CHANGE = ' '
* FILEMASK_ALL = ' '
* FILETYPE_NO_SHOW = ' '
* SILENT = 'S'
* COL_SELECT = ' '
* COL_SELECTMASK = ' '
* NO_AUTH_CHECK = ' '
* IMPORTING
* ACT_FILENAME =
* ACT_FILETYPE =
* FILESIZE =
* CANCEL =
TABLES
DATA_TAB = RESULT
* FIELDNAMES =
EXCEPTIONS
INVALID_FILESIZE = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
ENDFORM. " DATA_DOWNLOAD
두번째 짠 ALV 프로그램..
BDC 도 있어서 활용가치가 있지 않을까 싶다 ^^
갑자기 봉봉이 화내서 깜짝 놀란날 @.@
'SAP > ABAP' 카테고리의 다른 글
Check 구문 (0) | 2007.11.02 |
---|---|
테이블컨트롤의 스크롤이 아무 반응 없을 때... (0) | 2007.10.09 |
유용한 SAP Standard Function (0) | 2007.10.01 |
Selection Screen 만들기. (0) | 2007.09.13 |
유닉스 관련 명령어 (0) | 2007.09.13 |