Application Development and Automation 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: 
Read only

Error in Bdc programming

Former Member
0 Likes
847

Hi All,

I was trying to do Bdc recording with the call transaction method through tcode:SHDB and my programming is syntactilly corret but after executing ,in my first screen itself coming the zunk values.

Here is my code and please let me know what was the wrong and I am uploading the file in the sequence of my Internal table and my tcode is FK01.

report ZAN_VENDORDATA

no standard page heading line-size 255.

include bdcrecx1.

DATA: BEGIN OF ITAB OCCURS 0,

lifnr(10),

bukrs(4),

ktokk(4),

name1(35),

sortl(10),

stras(35),

pfach(10),

ort01(35),

PSTLZ(6),

land1(3),

spras(1),

telf1(16),

End of ITAB.

start-of-selection.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'C:\BDC\VENDE.TXT'

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 =

  • NO_AUTH_CHECK = ' '

  • 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 = #

  • 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.

perform open_group.

LOOP AT ITAB.

perform bdc_dynpro using 'SAPMF02K' '0105'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-KTOKK'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-LIFNR'

ITAB-LIFNR. "'33'.

perform bdc_field using 'RF02K-BUKRS'

ITAB-BUKRS. "'1000'.

perform bdc_field using 'RF02K-KTOKK'

ITAB-KTOKK. "'0001'.

perform bdc_dynpro using 'SAPMF02K' '0110'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-PSTLZ'.

perform bdc_field using 'BDC_OKCODE'

'UPDA'.

perform bdc_field using 'LFA1-NAME1'

ITAB-NAME1. "'Kidambi1'.

perform bdc_field using 'LFA1-SORTL'

ITAB-SORTL. "'KD'.

perform bdc_field using 'LFA1-STRAS'

ITAB-STRAS. "'VIVEKANADA STREET'.

perform bdc_field using 'LFA1-PFACH'

ITAB-PFACH. "'641024'.

perform bdc_field using 'LFA1-ORT01'

ITAB-ORT01. "'COIMBATORE'.

perform bdc_field using 'LFA1-PSTLZ'

ITAB-PSTLZ. "'008536'.

perform bdc_field using 'LFA1-LAND1'

ITAB-LAND1. "'IN'.

perform bdc_field using 'LFA1-SPRAS'

ITAB-SPRAS. "'EN'.

perform bdc_field using 'LFA1-TELF1'

ITAB-TELF1. "'4089216020'.

perform bdc_dynpro using 'SAPMF02K' '0210'.

perform bdc_field using 'BDC_CURSOR'

'LFB1-FDGRV'.

perform bdc_field using 'BDC_OKCODE'

'=UPDA'.

perform bdc_field using 'LFB1-AKONT'

'31000'.

perform bdc_field using 'LFB1-FDGRV'

'A1'.

perform bdc_transaction using 'FK01'.

ENDLOOP.

perform close_group.

Thanks

ANGKS.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
811

hi,

Check for the data in the file. In your program there's no field separator but if your file is TAB Delimited, it will create a problem while using the data in the internal table.

Regards

Sharath

6 REPLIES 6
Read only

Former Member
0 Likes
812

hi,

Check for the data in the file. In your program there's no field separator but if your file is TAB Delimited, it will create a problem while using the data in the internal table.

Regards

Sharath

Read only

0 Likes
811

Hi,

Thanks

could you please give me the detailed soultion.

Thanks

Angks

Read only

0 Likes
811

hi,

I meant to say, in your flat file, in a row are you giving any delimiters.? such as tab

e.g. mandt carrid

or mandtcarrid

If any tab spaces being provided in a row, in the gui_upload module set the field separator parameter (import) to 'X'.

Regards

Sharath

Read only

Former Member
0 Likes
811

just put a break point before call transation statemeent and see the data in BDC_DATA intenal table...it should be same as SHDB transaction...u ll get the problem after diagnosis..

regards

Read only

Former Member
0 Likes
811

hi,

Just check after gui_upload are you getting all the data into your internal table as it is from the flat file or not.

This can be done wither run the code in debugger/put a break point after gui_upload before calling the bdc transaction.

This seems that your internal table is not getting populated with the appropriate data.

Pooja

Read only

Former Member
0 Likes
811

Hi,

first check you are flat file ,what type of flat file you are taking if you are taking comma seperated flat file here in gui_upload mention file type asc, and better to run the program in debugging mode like /h ,uknow data is coming to internal table ,and screen flow ,step by stpe .

Regards,

Madhu