Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

File data is not replicated in Call Tranaction method of BDC

0 Kudos
282

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.

5 REPLIES 5

Abinathsiva
Active Contributor
218

Hi

Check the SHDB recording and compare with program

former_member1716
Active Contributor
218

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!

venkateswaran_k
Active Contributor
218

Dear Abdul

  • Please make sure your data txt file - the fields are separated by Tab.
  • Also in BDC call use the mode as 'A' and see how it goes. (as per recording).

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

Sandra_Rossi
Active Contributor
218

Can't you debug your program yourself?

Or ask a developer please.

Sandra_Rossi
Active Contributor
218

Function module FORMAT_MESSAGE was superseded with the ABAP statement MESSAGE for a long time...