Sie sind auf Seite 1von 4

*&---------------------------------------------------------------------*

*& Report ZPINKUBDC27


*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
*REPORT ZPINKUBDC27.
report zbdc_1
no standard page heading line-size 255.
data:begin of itab occurs 0,
name1 type lfa1-name1,
land1 type lfa1-land1,
waers type lfm1-waers,
end of itab.
data:bdcdata type bdcdata occurs 0 with header line,
msg type bdcmsgcoll occurs 0 with header line.
parameters:s_file type rlgrap-filename.
at selection-screen on value-request for s_file.
call function 'F4_FILENAME'
* EXPORTING
* PROGRAM_NAME = SYST-CPROG
* DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
importing
file_name = s_file
.

start-of-selection.
data:s_file1 type string.
s_file1 = s_file.
call function 'GUI_UPLOAD'
exporting
filename = s_file1
* FILETYPE = 'ASC'
has_field_separator = '|'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* 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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*include bdcrecx1.
start-of-selection.
loop at itab.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-BUKRS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-BUKRS'
'1000'.
perform bdc_field using 'RF02K-EKORG'
'1000'.
perform bdc_field using 'RF02K-KTOKK'
'0001'.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-LAND1'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
itab-name1.
perform bdc_field using 'LFA1-LAND1'
itab-land1.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-FDGRV'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-AKONT'
'62220'.
perform bdc_field using 'LFB1-FDGRV'
'A1'.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_field using 'LFM1-WAERS'
itab-waers.
call transaction 'XK01' using bdcdata mode 'A' update 'A' messages into msg.
clear bdcdata.
refresh bdcdata.
endloop.

loop at msg.
call function 'FORMAT_MESSAGE'
exporting
id = msg-msgid
lang = 'E'
no = msg-msgnr
v1 = msg-msgv1
* V2 = SY-MSGV2
* V3 = SY-MSGV3
* V4 = SY-MSGV4
* IMPORTING
* MSG =
* EXCEPTIONS
* NOT_FOUND = 1
* OTHERS = 2

.
write:/ msg.
endloop.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
form bdc_dynpro using program dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata.
endform.
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
form bdc_field using fnam fval.
* if fval <> nodata.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata.
* endif.
endform.

Das könnte Ihnen auch gefallen