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: 

BDC for multiple lin items

Former Member
0 Kudos

Hi All,

In my BDC BDCDATA table is populated properly but when I am trying to put the data in to the BDC_INSERT it is talking only first item insted.

Please Suggest

Regards

Sagar

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

When populating table control the index of the fieldname changes... you need to concatenate the index to the fieldname inorder to populate the correct line item

check this sample code.

LOOP AT itab_fields WHERE count EQ w_index.
    ADD 1 TO w_tabix.

    IF w_tabix gt <no> " number of visible lines of the table control of the screen

      PERFORM bdc_dynpro      USING 'SAPLSD41' '2200'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                   w_fname.

      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=P+'.
      w_tabix = 2.
    ENDIF.
    CONCATENATE 'DD03P-FIELDNAME(' w_tabix ')' INTO w_fname.
    CONCATENATE 'DD03P-KEYFLAG(' w_tabix ')' INTO w_fkey.
    CONCATENATE 'DD03D-DATATYPE(' w_tabix ')' INTO w_ftype.
    CONCATENATE 'DD03P-LENG(' w_tabix ')' INTO w_flen.
    CONCATENATE 'DD03P-DDTEXT(' w_tabix ')' INTO w_fdesc.

    PERFORM bdc_dynpro      USING 'SAPLSD41' '2200'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING w_fname
                                  itab_fields-fname.
    PERFORM bdc_field       USING w_fkey
                                  itab_fields-fkey.
    PERFORM bdc_field       USING w_ftype
                                  itab_fields-ftype.
    PERFORM bdc_field       USING w_flen
                                    itab_fields-flen.
    PERFORM bdc_field       USING w_fdesc
                                  itab_fields-fdesc.


  ENDLOOP.

regards

padma

Edited by: Padmavathi Palli on Sep 22, 2008 11:17 AM

1 REPLY 1

Former Member
0 Kudos

Hi,

When populating table control the index of the fieldname changes... you need to concatenate the index to the fieldname inorder to populate the correct line item

check this sample code.

LOOP AT itab_fields WHERE count EQ w_index.
    ADD 1 TO w_tabix.

    IF w_tabix gt <no> " number of visible lines of the table control of the screen

      PERFORM bdc_dynpro      USING 'SAPLSD41' '2200'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                   w_fname.

      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=P+'.
      w_tabix = 2.
    ENDIF.
    CONCATENATE 'DD03P-FIELDNAME(' w_tabix ')' INTO w_fname.
    CONCATENATE 'DD03P-KEYFLAG(' w_tabix ')' INTO w_fkey.
    CONCATENATE 'DD03D-DATATYPE(' w_tabix ')' INTO w_ftype.
    CONCATENATE 'DD03P-LENG(' w_tabix ')' INTO w_flen.
    CONCATENATE 'DD03P-DDTEXT(' w_tabix ')' INTO w_fdesc.

    PERFORM bdc_dynpro      USING 'SAPLSD41' '2200'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING w_fname
                                  itab_fields-fname.
    PERFORM bdc_field       USING w_fkey
                                  itab_fields-fkey.
    PERFORM bdc_field       USING w_ftype
                                  itab_fields-ftype.
    PERFORM bdc_field       USING w_flen
                                    itab_fields-flen.
    PERFORM bdc_field       USING w_fdesc
                                  itab_fields-fdesc.


  ENDLOOP.

regards

padma

Edited by: Padmavathi Palli on Sep 22, 2008 11:17 AM