2020 Jun 01 11:16 PM
Good Morning,
when I am working Call transaction method in BDC. it is unable to load the file as in below program. attached file and error also, Thanks.bdc.txt (File|)
REPORT ZBDC1 NO STANDARD PAGE HEADING.
DATA V_TEXT TYPE STRING.
TYPES: BEGIN OF STR,
BANKS TYPE BNKA-BANKS,
BANKL TYPE BNKA-BANKL,
BANKA TYPE BNKA-BANKA,
END OF STR.
DATA: WA TYPE STR,
IT TYPE TABLE OF STR.
DATA: WA1 TYPE BDCDATA,
IT1 TYPE TABLE OF BDCDATA.
****UPLOAD THE DATA FROM FILE TO IT****
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'D:\BDC.TXT'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = IT
*
.
IF SY-SUBRC EQ 0.
WRITE 'FILE UPLOADED SUCCESSFULLY'.
ENDIF.
LOOP AT IT INTO WA.
* ****FIRST SCREEN DETAILS******
WA1-PROGRAM = 'SAPMF02B'.
WA1-DYNPRO = '0100'.
WA1-DYNBEGIN = 'X'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BDC_CURSOR'.
WA1-FVAL = 'BNKA-BANKL'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BDC_OKCODE'.
WA1-FVAL = '/00'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BNKA-BANKS'.
WA1-FVAL = WA-BANKS.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BNKA-BANKL'.
WA1-FVAL = WA-BANKL.
APPEND WA1 TO IT1.
CLEAR WA1.
* ****** SECOND SCREEN DETAILS******
WA1-PROGRAM = 'SAPMF02B'.
WA1-DYNPRO = '0110'.
WA1-DYNBEGIN = 'X'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BDC_CURSOR'.
WA1-FVAL = 'BNKA-BANKA'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BDC_OKCODE'.
WA1-FVAL = '=UPDA'.
APPEND WA1 TO IT1.
CLEAR WA1.
WA1-FNAM = 'BNKA-BANKA'.
WA1-FVAL = WA-BANKA.
APPEND WA1 TO IT1.
CLEAR WA1.
* ********* BDC METHODS = CALL TX METHOD*****
CALL TRANSACTION 'FI01' USING IT1 MODE 'N'.
IF SY-SUBRC NE 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = SY-LANGU
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = V_TEXT
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC EQ 0.
WRITE: / V_TEXT COLOR 6 INVERSE.
ENDIF.
ULINE.
ENDIF.
REFRESH IT1.
ENDLOOP.
2020 Jun 02 3:06 AM
2020 Jun 02 4:21 AM
khadeer.sapabap,
The issue is with your Data load part using GUI_UPLOAD where the field separator is not defined properly, the data is not properly fetched into the internal table IT. Only the first column is fetched, you can check that yourself.
Recommend you to provide tab space in between each data in the file and then follow the below coding while calling the FM.
****UPLOAD THE DATA FROM FILE TO IT****
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = ''D:\BDC.TXT'
has_field_separator = '#'
TABLES
data_tab = it
This resolves your problem, Also ensure your recording is fine.
Note: When you paste the Code use CODE option for better readability and formatting.
Regards!
2020 Jun 02 6:14 AM
Dear Abdul
Also, Please provide us the Debug image of IT table - once you upload the data.
This will help us to identify the issue.
Regards,
Venkat
2020 Jun 02 6:55 AM
Can't you debug your program yourself?
Or ask a developer please.
2020 Jun 02 6:55 AM
Function module FORMAT_MESSAGE was superseded with the ABAP statement MESSAGE for a long time...