*&---------------------------------------------------------------------* *& Report ZBDC_CALLTRANSACTION * *& * *&---------------------------------------------------------------------* *& * *& * *&

---------------------------------------------------------------------* REPORT zbdc_calltransaction TYPES: BEGIN lifnr bukrs ekorg ktokk OF ty_kna1, TYPE lif16, TYPE bukrs, TYPE ekorg, TYPE ktokk, .

name1 TYPE ad_name1, sort1 TYPE ad_sort1, land1 TYPE land1, akont TYPE akont, fdgrv TYPE fdgrv, waers TYPE bstwa, END OF ty_kna1. DATA: itab TYPE STANDARD TABLE OF ty_kna1, wa TYPE ty_kna1, lv_file TYPE string. * DATA: * DATA: Batchinputdata of single transaction bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE. messages of call transaction messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE, li_message TYPE STANDARD TABLE OF bdcmsgcoll, wa_message TYPE bdcmsgcoll, lv_text TYPE string.

PARAMETERS: p_file TYPE localfile. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file. CALL FUNCTION 'F4_FILENAME' EXPORTING program_name = syst-cprog dynpro_number = syst-dynnr * FIELD_NAME = ' ' IMPORTING file_name = p_file . START-OF-SELECTION. lv_file = p_file. CALL FUNCTION 'GUI_UPLOAD' EXPORTING

* * * * * * filename = lv_file filetype = 'ASC' has_field_separator = 'X' HEADER_LENGTH = 0 READ_BY_LINE = 'X' DAT_MODE = ' ' IMPORTING FILELENGTH = HEADER = TABLES data_tab = itab EXCEPTIONS file_open_error = 1 file_read_error = 2 no_batch = 3 gui_refuse_filetransfer = 4 invalid_type = 5 no_authority = 6 unknown_error = 7 bad_data_format = 8 header_not_allowed = 9 separator_not_allowed = 10 header_too_long = 11 unknown_dp_error = 12 access_denied = 13 dp_out_of_memory = 14 disk_full = 15 dp_timeout = 16 OTHERS = 17 . IF sy-subrc <> 0. ENDIF. . MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. * ============================================================= CALL FUNCTION 'BDC_OPEN_GROUP' EXPORTING client = sy-mandt group = 'TEST' holddate = sy-datum keep = 'X' user = sy-uname prog = sy-cprog EXCEPTIONS client_invalid = 1 destination_invalid = 2 group_invalid = 3 group_is_locked = 4 holddate_invalid = 5 internal_error = 6 queue_error = 7 running = 8 system_lock_error = 9 user_invalid = 10 OTHERS = 11. IF sy-subrc <> 0. END-OF-SELECTION. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

"'IN'. "'Demo'. USING 'RF02K-LIFNR' wa-lifnr. PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field USING 'SAPMF02K' '0120'. USING 'BDC_CURSOR' 'LFA1-LAND1'. messtab[]. USING 'BDC_OKCODE' . CLEAR: bdcdata. USING 'LFA1-NAME1' wa-name1. USING 'SAPMF02K' '0130'. USING 'BDC_OKCODE' '=VW'. PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field USING 'SAPMF02K' '0110'. USING 'BDC_OKCODE' '=VW'. "'TEST'. "'1000'. USING 'LFA1-LAND1' wa-land1. "'6'. USING 'RF02K-KTOKK' wa-ktokk. "'1000'. LOOP AT itab INTO wa. REFRESH: bdcdata[]. USING 'RF02K-BUKRS' wa-bukrs. USING 'BDC_CURSOR' 'LFBK-BANKS(01)'. USING 'BDC_OKCODE' '/00'. USING 'BDC_CURSOR' 'RF02K-KTOKK'.ENDIF. PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field USING 'SAPMF02K' '0100'. USING 'RF02K-EKORG' wa-ekorg. USING 'BDC_CURSOR' 'LFB1-AKONT'. PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field USING 'SAPMF02K' '0210'. "'0001'. USING 'BDC_OKCODE' '=VW'. USING 'BDC_CURSOR' 'LFA1-KUNNR'. USING 'LFA1-SORTL' wa-sort1.

"'160000'. USING 'SAPMF02K' '0310'. USING 'BDC_CURSOR' 'LFB5-MAHNA'. PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field USING 'SAPMF02K' '0215'. USING 'LFM1-WAERS' 'INR'. USING 'BDC_OKCODE' '=VW'. USING 'SAPLSPO1' '0300'. IF sy-subrc <> 0. USING 'LFB1-AKONT' wa-akont. PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field USING 'SAPMF02K' '0220'. USING 'LFB1-FDGRV' wa-fdgrv. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.PERFORM bdc_field PERFORM bdc_field '=VW'. USING 'BDC_OKCODE' '=YES'. PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field PERFORM bdc_field PERFORM bdc_dynpro PERFORM bdc_field PERFORM bdc_field PERFORM bdc_dynpro PERFORM bdc_field CALL FUNCTION 'BDC_INSERT' EXPORTING tcode = 'XK01' TABLES dynprotab = bdcdata EXCEPTIONS internal_error = 1 not_open = 2 queue_error = 3 tcode_invalid = 4 printing_invalid = 5 posting_invalid = 6 OTHERS = 7. "'A1'. USING 'SAPMF02K' '0320'. USING 'BDC_OKCODE' '=VW'. USING 'BDC_OKCODE' '=VW'. USING 'BDC_CURSOR' 'LFB1-ZTERM'. USING 'BDC_CURSOR' 'RF02K-LIFNR'. USING 'BDC_CURSOR' 'LFM1-WAERS'. USING 'BDC_OKCODE' '=VW'. .

ENDLOOP. ENDFORM. ENDIF. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. APPEND bdcdata. CLEAR bdcdata. ENDFORM. CLEAR wa. bdcdata-dynbegin = 'X'. bdcdata-program = program. CLEAR bdcdata. bdcdata-dynpro = dynpro. IF sy-subrc <> 0.ENDIF. bdcdata-fval = fval. "BDC_DYNPRO *----------------------------------------------------------------------* * Insert field * *----------------------------------------------------------------------* FORM bdc_field USING fnam fval. APPEND bdcdata. CALL FUNCTION 'BDC_CLOSE_GROUP' EXCEPTIONS not_open = 1 queue_error = 2 OTHERS = 3. * ======================================================================== *----------------------------------------------------------------------* * Start new screen * *----------------------------------------------------------------------* FORM bdc_dynpro USING program dynpro. bdcdata-fnam = fnam. "BDC_FIELD .

Sign up to vote on this title
UsefulNot useful