report ZBDC_XK01
no standard page heading line-size 255.
*include bdcrecx1.
*parameters: dataset(132) lower case.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ****
- If it is nessesary to change the data section use the rules:
- 1.) Each definition of a field exists of two lines
- 2.) The first line shows exactly the comment
- '* data element: ' followed with the data element
- which describes the field.
- If you don't have a data element use the
- comment without a data element name
- 3.) The second line shows the fieldname of the
- structure, the fieldname must consist of
- a fieldname and optional the character '_' and
- three numbers and the field length in brackets
- 4.) Each field must be type C.
- Generated data section with specific formatting - DO NOT CHANGE ***
DATA: file_path TYPE string.
DATA:
l_log_handle TYPE balloghndl,
l_s_log TYPE bal_s_log,
l_s_msg TYPE bal_s_msg,
l_msgno TYPE symsgno.
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
- messages of call transaction
- error session opened (' ' or 'X')
- message texts
data: begin of record occurs 0,
- data element: BUKRS
- data element: EKORG
- data element: KTOKK
- data element: ANRED
- data element: NAME1_GP
- data element: NAME2_GP
- data element: NAME3_GP
- data element: NAME4_GP
- data element: STRAS_GP
- data element: STRAS_GP
- data element: ORT01_GP
- data element: PSTLZ
- data element: LAND1_GP
- data element: LAND1_GP
- data element: SPRAS
- data element: TELF1
- data element: TELFX
- data element: URL
- data element: STCEG
- data element: BRSCH
- data element: AKONT
- data element: FDGRV
- data element: ALTKN
- data element: DZTERM
- data element: REPRF
- data element: DZWELS
J_1IEXCD(040),
J_1IEXRN(040),
J_1IEXRG(060),
J_1IEXDI(060),
J_1IEXCO(060),
J_1IVTYP(002),
J_1ICSTNO(040),
J_1ILSTNO(040),
J_1ISERN(040),
J_1IPANNO(040),
- data element: QLAND
- data element: WITHT
- data element: WITHT
- data element: WITHT
- data element: WITHT
- data element: WITHT
- data element: WITHT
- data element: WT_WITHCD
- data element: WT_WITHCD
- data element: WT_WITHCD
- data element: WT_SUBJCT
- data element: WT_SUBJCT
- data element: WT_SUBJCT
- data element: WT_SUBJCT
- data element: WT_SUBJCT
- data element: WT_SUBJCT
- data element: WT_QSREC
- data element: WT_QSREC
- data element: WT_QSREC
- data element: WT_QSREC
- data element: WT_QSREC
- data element: WT_QSREC
- data element: QLAND
- data element: BSTWA
- data element: DZTERM
- data element: KALSK
- data element: WEBRE
- data element: XNBWY
- data element: LEBRE
end of record.
End generated data section ***
start-of-selection.
SELECTION-SCREEN BEGIN OF BLOCK mode WITH FRAME TITLE text-003 .
*PARAMETERS ctumode LIKE ctu_params-dismode DEFAULT 'N'.
PARAMETERS: file_url TYPE rlgrap-filename MODIF ID xyz .
SELECTION-SCREEN END OF BLOCK mode .
INITIALIZATION.
PERFORM log_create.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_url.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'FILE_URL'
IMPORTING
file_name = file_url.
start-of-selection.
IF NOT file_url IS INITIAL.
MOVE file_url TO file_path.
PERFORM read_file.
ENDIF.
loop at record.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-BUKRS'
record-BUKRS_001.
perform bdc_field using 'RF02K-EKORG'
record-EKORG_002.
perform bdc_field using 'RF02K-KTOKK'
record-KTOKK_003.
perform bdc_field using 'USE_ZAV'
'X'.
perform bdc_dynpro using 'SAPMF02K' '0111'.
- perform bdc_field using 'BDC_CURSOR'
- 'LFA1-LFURL'.
'/00'.
perform bdc_field using 'SZA1_D0100-TITLE_MEDI'
record-ANRED_004.
perform bdc_field using 'ADDR1_DATA-NAME1'
record-NAME1_005.
perform bdc_field using 'ADDR1_DATA-NAME2'
record-NAME2_006.
perform bdc_field using 'ADDR1_DATA-NAME3'
record-NAME3_007.
perform bdc_field using 'ADDR1_DATA-NAME4'
record-NAME4_008.
perform bdc_field using 'ADDR1_DATA-SORT1'
record-sort1.
perform bdc_field using 'ADDR1_DATA-STREET'
record-STRAS_009.
perform bdc_field using 'ADDR1_DATA-CITY1'
record-ORT01_010.
perform bdc_field using 'ADDR1_DATA-POST_CODE1'
record-PSTLZ_011.
perform bdc_field using 'ADDR1_DATA-COUNTRY'
record-LAND1_012.
perform bdc_field using 'ADDR1_DATA-REGION'
record-region.
perform bdc_field using 'ADDR1_DATA-LANGU'
record-SPRAS_013.
perform bdc_field using 'SZA1_D0100-TEL_NUMBER'
record-TELF1_014.
perform bdc_field using 'SZA1_D0100-FAX_NUMBER'
record-TELFX_015.
perform bdc_field using 'SZA1_D0100-SMTP_ADDR'
record-EMAIL.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-STCEG'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-STCEG'
record-STCEG_017.
perform bdc_field using 'LFA1-BRSCH'
record-BRSCH_018.
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' '0380'.
perform bdc_field using 'BDC_CURSOR'
'KNVK-NAMEV(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ALTKN'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-AKONT'
record-AKONT_019.
perform bdc_field using 'LFB1-FDGRV'
record-FDGRV_020.
perform bdc_field using 'LFB1-ALTKN'
record-ALTKN_021.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZWELS'.
perform bdc_field using 'BDC_OKCODE'
'=OPFI'.
perform bdc_field using 'LFB1-ZTERM'
record-ZTERM_022.
perform bdc_field using 'LFB1-REPRF'
record-REPRF_023.
perform bdc_field using 'LFB1-ZWELS'
record-ZWELS_024.
perform bdc_dynpro using 'SAPLJ1I_MASTER' '0100'.
- perform bdc_field using 'BDC_CURSOR'
- 'LFB1-ZWELS'.
'=CIN_VENDOR_FC2'.
perform bdc_field using 'J_1IMOVEND-J_1IEXCD'
record-J_1IEXCD.
perform bdc_field using 'J_1IMOVEND-J_1IEXRN'
record-J_1IEXRN.
perform bdc_field using 'J_1IMOVEND-J_1IEXRG'
record-J_1IEXRG.
perform bdc_field using 'J_1IMOVEND-J_1IEXDI'
record-J_1IEXDI.
perform bdc_field using 'J_1IMOVEND-J_1IEXCO'
record-J_1IEXCO.
perform bdc_field using 'J_1IMOVEND-J_1IVTYP'
record-J_1IVTYP.
perform bdc_dynpro using 'SAPLJ1I_MASTER' '0100'.
- perform bdc_field using 'BDC_CURSOR'
- 'LFB1-ZWELS'.
'=CIN_VENDOR_FC3'.
perform bdc_field using 'J_1IMOVEND-J_1ICSTNO'
record-J_1ICSTNO.
perform bdc_field using 'J_1IMOVEND-J_1ILSTNO'
record-J_1ILSTNO.
perform bdc_field using 'J_1IMOVEND-J_1ISERN'
record-J_1ISERN.
perform bdc_dynpro using 'SAPLJ1I_MASTER' '0100'.
- perform bdc_field using 'BDC_CURSOR'
- 'LFB1-ZWELS'.
'/00'.
perform bdc_field using 'J_1IMOVEND-J_1IPANNO'
record-J_1IPANNO.
perform bdc_dynpro using 'SAPLJ1I_MASTER' '0100'.
- perform bdc_field using 'BDC_CURSOR'
- 'LFB1-ZWELS'.
'=BACK'.
perform bdc_field using 'J_1IMOVEND-J_1IPANNO'
record-J_1IPANNO.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZWELS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-ZTERM'
record-ZTERM_022.
perform bdc_field using 'LFB1-REPRF'
record-REPRF_023.
perform bdc_field using 'LFB1-ZWELS'
record-ZWELS_024.
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' '0610'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'LFBW-QSREC(06)'.
perform bdc_field using 'LFB1-QLAND'
record-QLAND_025.
perform bdc_field using 'LFBW-WITHT(01)'
record-WITHT_01_026.
perform bdc_field using 'LFBW-WITHT(02)'
record-WITHT_02_027.
perform bdc_field using 'LFBW-WITHT(03)'
record-WITHT_03_028.
perform bdc_field using 'LFBW-WITHT(04)'
record-WITHT_04_029.
perform bdc_field using 'LFBW-WITHT(05)'
record-WITHT_05_030.
perform bdc_field using 'LFBW-WITHT(06)'
record-WITHT_06_031.
perform bdc_field using 'LFBW-WT_WITHCD(01)'
record-WT_WITHCD_01_032.
perform bdc_field using 'LFBW-WT_WITHCD(02)'
record-WT_WITHCD_02_033.
perform bdc_field using 'LFBW-WT_WITHCD(03)'
record-WT_WITHCD_03_034.
perform bdc_field using 'LFBW-WT_SUBJCT(01)'
record-WT_SUBJCT_01_035.
perform bdc_field using 'LFBW-WT_SUBJCT(02)'
record-WT_SUBJCT_02_036.
perform bdc_field using 'LFBW-WT_SUBJCT(03)'
record-WT_SUBJCT_03_037.
perform bdc_field using 'LFBW-WT_SUBJCT(04)'
record-WT_SUBJCT_04_038.
perform bdc_field using 'LFBW-WT_SUBJCT(05)'
record-WT_SUBJCT_05_039.
perform bdc_field using 'LFBW-WT_SUBJCT(06)'
record-WT_SUBJCT_06_040.
perform bdc_field using 'LFBW-QSREC(01)'
record-QSREC_01_041.
perform bdc_field using 'LFBW-QSREC(02)'
record-QSREC_02_042.
perform bdc_field using 'LFBW-QSREC(03)'
record-QSREC_03_043.
perform bdc_field using 'LFBW-QSREC(04)'
record-QSREC_04_044.
perform bdc_field using 'LFBW-QSREC(05)'
record-QSREC_05_045.
perform bdc_field using 'LFBW-QSREC(06)'
record-QSREC_06_046.
perform bdc_dynpro using 'SAPMF02K' '0610'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-QLAND'.
perform bdc_field using 'LFB1-QLAND'
record-QLAND_047.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-XNBWY'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS'
record-WAERS_048.
perform bdc_field using 'LFM1-ZTERM'
record-ZTERM_049.
perform bdc_field using 'LFM1-KALSK'
record-KALSK_050.
perform bdc_field using 'LFM1-WEBRE'
record-WEBRE_051.
perform bdc_field using 'LFM1-XNBWY'
record-XNBWY_052.
perform bdc_field using 'LFM1-LEBRE'
record-LEBRE_053.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_transaction." using 'XK01'.
clear bdcdata[].
clear record.
endloop.
PERFORM log_show.
----------------------------------------------------------------------
- Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. "BDC_DYNPRO
----------------------------------------------------------------------
- Insert field *
FORM BDC_FIELD USING FNAM FVAL.
- IF FVAL NODATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
- ENDIF.
&---------------------------------------------------------------------
*& Form bdc_transaction
&---------------------------------------------------------------------
- text
FORM bdc_transaction .
DATA tcode LIKE tstc-tcode.
tcode = 'XK01'.
CALL TRANSACTION tcode USING bdcdata
MODE 'A'
MESSAGES INTO messtab.
PERFORM msg_generation.
ENDFORM. "bdc_transaction
&---------------------------------------------------------------------
*& Form read_file
&---------------------------------------------------------------------
- text
FORM read_file .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_path
filetype = 'ASC'
has_field_separator = 'X'
- HEADER_LENGTH = 0
- DAT_MODE = ' '
- CODEPAGE = ' '
- IGNORE_CERR = ABAP_TRUE
- REPLACEMENT = '#'
- CHECK_BOM = ' '
- IMPORTING
- FILELENGTH =
- HEADER =
data_tab = record
- 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.
ENDFORM. " read_file
&---------------------------------------------------------------------
*& Form msg_generation
&---------------------------------------------------------------------
- text
- --> p1 text
- <-- p2 text
FORM msg_generation .
DATA: l_mstring(480).
DATA: l_subrc LIKE sy-subrc.
DATA: l_error TYPE c.
LOOP AT messtab.
- add message to log file
l_s_msg-msgty = messtab-msgtyp.
l_s_msg-msgid = messtab-msgid.
l_s_msg-msgno = messtab-msgnr.
l_s_msg-msgv1 = messtab-msgv1.
l_s_msg-msgv2 = messtab-msgv2.
l_s_msg-msgv3 = messtab-msgv3.
l_s_msg-msgv4 = messtab-msgv4.
CALL FUNCTION 'BAL_LOG_MSG_ADD'
EXPORTING
i_log_handle = l_log_handle
i_s_msg = l_s_msg
EXCEPTIONS
OTHERS = 1.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF messtab-msgtyp EQ 'E' OR l_subrc NE 0.
l_error = 'X'.
ENDIF.
ENDLOOP.
CLEAR messtab[].
ENDFORM. " msg_generation
&---------------------------------------------------------------------
*& Form log_create
&---------------------------------------------------------------------
- text
- --> p1 text
- <-- p2 text
FORM log_create .
CALL FUNCTION 'BAL_LOG_CREATE'
EXPORTING
i_s_log = l_s_log
IMPORTING
e_log_handle = l_log_handle
EXCEPTIONS
OTHERS = 1.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " log_create
&---------------------------------------------------------------------
*& Form log_show
&---------------------------------------------------------------------
- text
- --> p1 text
- <-- p2 text
FORM log_show .
DATA:
l_s_display_profile TYPE bal_s_prof.
- get a prepared profile
IMPORTING
e_s_display_profile = l_s_display_profile
EXCEPTIONS
OTHERS = 1.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
- use grid for display if wanted
- set report to allow saving of variants
- when you use also other ALV lists in your report,
- please specify a handle to distinguish between the display
- variants of these different lists, e.g:
- call display function module
- We do not specify any filter (like I_S_LOG_FILTER, ...,
- I_T_MSG_HANDLE) since we want to display all logs available
EXPORTING
i_s_display_profile = l_s_display_profile
EXCEPTIONS
OTHERS = 1.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " log_show
DEPENDENCIES OF DICTIONARY OBJECTS
PERFORMANCE DURING TABLE ACCESS
ENHANCEMENTS TO DICTIONARY ELEMENTS
If you are interested in SAP ABAP syntax for format check here.
No comments:
Post a Comment