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

BDC

Former Member
0 Likes
1,177

Hi,

Iam gettimg error that "ST_BDCDATA" is a table without a header line and therefore has no component called "PROGRAM".(Bold letters)

REPORT ZBDC_TAB1.

TYPES:

BEGIN OF TY_SOURCE,

KUNNR(10) TYPE C,

LAND1(2) TYPE C,

NAME(30) TYPE C,

ORT01(30) TYPE C,

TELF1(10) TYPE C,

END OF TY_SOURCE.

DATA:

ST_SOURCE TYPE TY_SOURCE,

IT_SOURCE TYPE TABLE OF TY_SOURCE,

  • STRUCTURE AND INTERNAL TABLE FOR BDC MAPPING

ST_BDCDATA TYPE BDC_DATA,

IT_BDCDATA TYPE TABLE OF BDCDATA.

START-OF-SELECTION.

PERFORM UPLOAD.

LOOP AT IT_SOURCE INTO ST_SOURCE.

PERFORM MAPPING.

CALL TRANSACTION 'ZMP_TAB1_TC'

USING IT_BDCDATA.

ENDLOOP.

&----


*& Form UPLOAD

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM UPLOAD .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'c:\textcustomer.txt'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = ' '

HEADER_LENGTH = 0

READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = it_source

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.

ENDIF.

ENDFORM. " UPLOAD

&----


*& Form MAPPING

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM MAPPING .

<b>REFRESH IT_BDCDATA.

ST_BDCDATA-PROGRAM = 'ZMP_TAB1'.

ST_BDCDATA-DYNPRO = '9001'.

ST_BDCDATA-DYNBEGIN = ' '.

ST_BDCDATA-FNAM = KNA1-KUNNR.

ST_BDCDATA-FVAL = ST_SOURCE-KUNNR.</b>

APPEND ST_BDCDATA TO IT_BDCDATA.

ENDFORM. " MAPPING

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,100

declare like this

ST_BDCDATA type BDCDATA,

check the coding of mine in your previous thread

regards

shiba dutta

13 REPLIES 13
Read only

Former Member
0 Likes
1,101

declare like this

ST_BDCDATA type BDCDATA,

check the coding of mine in your previous thread

regards

shiba dutta

Read only

gopi_narendra
Active Contributor
0 Likes
1,100

its not BDC_DATA

it is BDCDATA

ST_BDCDATA TYPE BDCDATA, " BDCDATA

Regards

Gopi

Read only

Former Member
0 Likes
1,100

hi,

change the declaration of st_bdcdata as

ST_BDCDATA TYPE BDCDATA

regards,

Navneeth K.

Read only

Former Member
0 Likes
1,100

Declare like

ST_BDCDATA TYPE<b> BDCDATA,</b>(without underscore)

IT_BDCDATA TYPE TABLE OF BDCDATA.

Read only

Former Member
0 Likes
1,100

Hi Ram,

REPORT ZBDC_TAB1.

TYPES:

BEGIN OF TY_SOURCE,

KUNNR(10) TYPE C,

LAND1(2) TYPE C,

NAME(30) TYPE C,

ORT01(30) TYPE C,

TELF1(10) TYPE C,

END OF TY_SOURCE.

DATA:

ST_SOURCE TYPE TY_SOURCE,

IT_SOURCE TYPE TABLE OF TY_SOURCE,

  • STRUCTURE AND INTERNAL TABLE FOR BDC MAPPING

<b>ST_BDCDATA TYPE BDCDATA,

IT_BDCDATA TYPE STANDARD TABLE OF BDCDATA WITH HEADER LINE.

</b>

Thanks,

Vinay

Read only

Former Member
0 Likes
1,100

HI,

st_bdcdata type bdcdata.

it is not bdc_data.

ST_BDCDATA-FNAM = KNA1-KUNNR.

in this u need to pass the field name different for each mandatory element.

see this sample code.

DATA:BEGIN OF ITAB OCCURS 0,

LIFNR LIKE LFA1-LIFNR,

KTOKK LIKE LFA1-KTOKK,

NAME1 LIKE LFA1-NAME1,

SORTL LIKE LFA1-SORTL,

LAND1 LIKE LFA1-LAND1,

REGIO LIKE LFA1-REGIO,

END OF ITAB.

DATA BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:/BHARAT/VEND.TXT'

FILETYPE = 'ASC'

TABLES

DATA_TAB = ITAB.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = 'VENDOR'

KEEP = 'X'

USER = SY-UNAME

PROG = SY-CPROG.

LOOP AT ITAB.

perform bdc_dynpro using 'SAPMF02K' '0107'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-LIFNR'.

perform bdc_field using 'RF02K-LIFNR'

ITAB-LIFNR.

perform bdc_field using 'RF02K-KTOKK'

ITAB-KTOKK.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0110'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-NAME1'.

perform bdc_field using 'LFA1-NAME1'

ITAB-NAME1.

perform bdc_field using 'LFA1-SORTL'

ITAB-SORTL.

perform bdc_field using 'LFA1-LAND1'

ITAB-LAND1.

perform bdc_field using 'LFA1-REGIO'

ITAB-REGIO.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0120'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-KUNNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

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 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

*perform bdc_transaction using 'MK01'.

*

*perform close_group.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'MK01'

TABLES

DYNPROTAB = BDCTAB.

REFRESH BDCTAB.

ENDLOOP.

CALL FUNCTION 'BDC_CLOSE_GROUP'.

FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCTAB.

BDCTAB-PROGRAM = PROGRAM.

BDCTAB-DYNPRO = DYNPRO.

BDCTAB-DYNBEGIN = 'X'.

APPEND BDCTAB.

ENDFORM.

FORM BDC_FIELD USING FNAM FVAL.

CLEAR BDCTAB.

BDCTAB-FNAM = FNAM.

BDCTAB-FVAL = FVAL.

APPEND BDCTAB.

ENDFORM.

rgds,

bharat.

Read only

Former Member
0 Likes
1,100

Hi Ram,

Declare ST_BDCDATA as

data: Begin of ST_BDCDATA occurs 0 .

Include structure BDCDATA .

data: end of ST_BDCDATA .

Regards

Arun

Read only

Former Member
0 Likes
1,100

Hi,

I had created the function module zmp_tab1.

But here iam getting error that Field "KNA1-KUNNR" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement . . . . . . . . . .

Read only

0 Likes
1,100

Hi Ram,

FNAM is the name of the filed and it is a character variable hence put the value in single quotes.

FORM MAPPING .

REFRESH IT_BDCDATA.

ST_BDCDATA-PROGRAM = 'ZMP_TAB1'.

ST_BDCDATA-DYNPRO = '9001'.

ST_BDCDATA-DYNBEGIN = ' '.

<b>ST_BDCDATA-FNAM = 'KNA1-KUNNR'.</b>

ST_BDCDATA-FVAL = ST_SOURCE-KUNNR.

APPEND ST_BDCDATA TO IT_BDCDATA.

ENDFORM.

Thanks,

Vinay

Read only

0 Likes
1,100

Hi,

declare tables: kna1 .

it will not give this error.

regards,

Ruchika

reward if useful........

Read only

0 Likes
1,100

declare tables :kna1 in the top after your report statement.

Regards

Gopi

Read only

0 Likes
1,100

Hi Ram,

Declare the table in the function module or in the function group

Regards

Arun

Read only

0 Likes
1,100

declare 'KNA1-KUNNR' <within quotes> not KNA1-KUNNR

regards

shiba dutta