0% found this document useful (0 votes)
20 views2 pages

Source Code

The document outlines an ABAP report that converts data from an Excel file into SAP format. It defines data structures and utilizes a function to read and map fields from the Excel file to SAP's KNA1 table. The report also includes transaction calls to process the mapped data.

Uploaded by

greeshmakuderu2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

Source Code

The document outlines an ABAP report that converts data from an Excel file into SAP format. It defines data structures and utilizes a function to read and map fields from the Excel file to SAP's KNA1 table. The report also includes transaction calls to process the mapped data.

Uploaded by

greeshmakuderu2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

REPORT ZDBDC5.

DATA : IT_TRUX TYPE TRUXS_T_TEXT_DATA,


LV_PATH TYPE RLGRAP-FILENAME VALUE 'C:\Users\s20abap24\Desktop\
KNA1.XLSX'.

TYPES : BEGIN OF TY_SEMI,


KUNNR TYPE KNA1-KUNNR,
LAND1 TYPE KNA1-LAND1,
NAME1 TYPE KNA1-NAME1,
NAME2 TYPE KNA1-NAME2,
ORT01 TYPE KNA1-ORT01,
END OF TY_SEMI.

DATA : IT_SEMI TYPE TABLE OF TY_SEMI,


WA_SEMI TYPE TY_SEMI.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'


EXPORTING
i_tab_raw_data = IT_TRUX
i_filename = LV_PATH
TABLES
i_tab_converted_data = IT_SEMI.
IF IT_SEMI IS NOT INITIAL.

DATA : IT_BDATA TYPE TABLE OF BDCDATA,


WA_BDATA TYPE BDCDATA.

LOOP AT IT_SEMI INTO WA_SEMI.


PERFORM MAPPGM USING 'ZBDCMPP' '100'.
PERFORM MAPFLD USING 'KNA1-KUNNR' WA_SEMI-KUNNR.
PERFORM MAPFLD USING 'KNA1-LAND1' WA_SEMI-LAND1.
PERFORM MAPFLD USING 'KNA1-NAME1' WA_SEMI-NAME1.
PERFORM MAPFLD USING 'KNA1-NAME2' WA_SEMI-NAME2.
PERFORM MAPFLD USING 'KNA1-ORT01' WA_SEMI-ORT01.
CALL TRANSACTION 'ZBDC1' USING IT_BDATA.
ENDLOOP.
ENDIF.

WRITE :/ 'HELLO'.

FORM mappgm USING PNAME SCRNO.


REFRESH IT_BDATA.
CLEAR WA_BDATA.
WA_BDATA-PROGRAM = PNAME.
WA_BDATA-DYNPRO = SCRNO.
WA_BDATA-DYNBEGIN = 'X'.
APPEND WA_BDATA TO IT_BDATA.

ENDFORM.
FORM mapfld USING FNAME FVALUE.
CLEAR WA_BDATA.
WA_BDATA-FNAM = FNAME.
WA_BDATA-FVAL = FVALUE.
APPEND WA_BDATA TO IT_BDATA.
ENDFORM.

You might also like