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 on table control

Former Member
0 Likes
9,773

Hello,

Can some one please help in with neat step by step expalination How to do a BDC for a table control. Screen shot will help me more to understand. Many link here dont help me much.

Please also let me know what makes the Table control/Step Loop different from normal way of having a BDC on normal screen if SHDB is used to record?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,227

Hi,

Yes, in case of Table control if you want to populate N number of records then you need to specify the FIELD NAME(ROW NUMBER) in BDC whereas in case of Normal screen, you only need to pass the Field Name.

RV45A-MABNR(01) = 1000

RV45A-MABNR(02) = 2000

RV45A-MABNR(03) = 3000

RV45A-MABNR(04) = 4000.

The above would be an example for four records in a table control for field MABNR.

Best regards,

Prashant

11 REPLIES 11
Read only

Former Member
0 Likes
4,227

hi suresh,

check the below link may be useful for you

Table control in BDC

http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

check the below link also u may find answers for all your q's

http://help.sap.com/saphelp_webas630/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/content.htm

if u find it useful plz mark the points

Regards,

Naveen

Read only

Former Member
0 Likes
4,227

naveen,

Let me put my questioin more straight forward. What is that makes BDC on Table control different than a BDC on normal screen?

Is Recording of scrolling left/right and page up/down is some thing different in Table controls

Read only

0 Likes
4,227

hi

good

bdc recording is same for both table control and the normal screen,but in case of the table control you can see the data in the table format and as you have mentioned you can have scrolling options and page up/down.

thanks

mrutyun

Read only

Former Member
0 Likes
4,228

Hi,

Yes, in case of Table control if you want to populate N number of records then you need to specify the FIELD NAME(ROW NUMBER) in BDC whereas in case of Normal screen, you only need to pass the Field Name.

RV45A-MABNR(01) = 1000

RV45A-MABNR(02) = 2000

RV45A-MABNR(03) = 3000

RV45A-MABNR(04) = 4000.

The above would be an example for four records in a table control for field MABNR.

Best regards,

Prashant

Read only

0 Likes
4,227

Hi,

As what Prashant said, when you are doing BDC for a table control what you can do is to manually number the fieldname. So for example, you counted the rows of the table control and it gave you 17 rows. So in your bdc, you can concatenate the field and the row number. This is a crude example:

table-field(01) --->this is row1

table-field(02) --->this is row2

table-field(03) --->this is row3 ...and so on...

Hope this helps!

P.S. Please award points for useful answers.

Read only

Former Member
0 Likes
4,227

In addition to the above, always remember that horizontal scrolling does not effect the recording, but vertical scrolling will be recorded.

Therefore, if you have to populate 10 rows of data into the table control and only 5 rows are visible on the screen, make sure that your recording contains a page down after populating 5 rows of data and then populate 5 more rows.

A better idea would be to record a pagedown after each row of data to be populated (this is applicable if the number of rows to be populated is dynamic)

Read only

Former Member
0 Likes
4,227

hi

good

as per your query there is two things

one is BDC recording using SDDB

second is passing those data to the table contol that you have designed using se51.

as you have been asked for the screen shot it is not possible to give you here,and i dont have any such example that can solve your problem like this.

follow this process->

1-do a recoreding using the shdb tcode

2-pass that recording to a report

3- write the report as per your requirement

4-design the table control in se51

5-call that screen in your report using

CALL SCREEN

6-pass the data into the table contol

i already given the answer of your second question.

thanks

mrutyun

Read only

Former Member
0 Likes
4,227

hi suresh,

try this code . in this code i used txn'ZCMAT' in this txn i used a table control.

include bdcrecx1.

start-of-selection.

perform open_group.

perform bdc_dynpro using 'SAPMZCMAT' '0100'.

perform bdc_field using 'BDC_CURSOR'

'W_R3'.

perform bdc_field using 'BDC_OKCODE'

'=OK1'.

perform bdc_field using 'W_R1'

''.

perform bdc_field using 'W_R3'

'X'.

perform bdc_dynpro using 'SAPMZCMAT' '0200'.

perform bdc_field using 'BDC_CURSOR'

'ZMRO_MATDATA-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'=ENTER'.

perform bdc_field using 'ZMRO_MATDATA-MATNR'

'100-100'.

perform bdc_dynpro using 'SAPMZCMAT' '0200'.

perform bdc_field using 'BDC_CURSOR'

'ZMRO_MATDATA-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'=TABSTRIP1_FC1'.

perform bdc_field using 'ZMRO_MATDATA-MATNR'

'100-100'.

perform bdc_field using 'ZMRO_MATDATA-ERSDA'

'19.07.2005'.

perform bdc_field using 'ZMRO_MATDATA-ERNAM'

'CHETAN'.

perform bdc_field using 'ZMRO_MATDATA-PSTAT'

'GOOD'.

perform bdc_field using 'ZMRO_MATDATA-LAEDA'

'19.07.2005'.

perform bdc_field using 'ZMRO_MATDATA-AENAM'

'VISHNOI'.

perform bdc_field using 'ZMRO_MATDATA-VPSTA'

'GOOD'.

perform bdc_field using 'ZMRO_STORAGE-LGORT'

'X001'.

perform bdc_field using 'ZMRO_STORAGE-VMUML'

'142.000'.

perform bdc_field using 'ZMRO_STORAGE-LFGJA'

'2006'.

perform bdc_field using 'ZMRO_STORAGE-LABST'

'14.000'.

perform bdc_field using 'ZMRO_STORAGE-LFMON'

'10'.

perform bdc_field using 'ZMRO_STORAGE-VMLAB'

'150.000'.

perform bdc_dynpro using 'SAPMZCMAT' '0200'.

perform bdc_field using 'BDC_CURSOR'

'ZMRO_MATDATA-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'=TC_PLANT_INSR'.

perform bdc_field using 'ZMRO_MATDATA-MATNR'

'100-100'.

perform bdc_field using 'ZMRO_MATDATA-ERSDA'

'19.07.2005'.

perform bdc_field using 'ZMRO_MATDATA-ERNAM'

'CHETAN'.

perform bdc_field using 'ZMRO_MATDATA-PSTAT'

'GOOD'.

perform bdc_field using 'ZMRO_MATDATA-LAEDA'

'19.07.2005'.

perform bdc_field using 'ZMRO_MATDATA-AENAM'

'VISHNOI'.

perform bdc_field using 'ZMRO_MATDATA-VPSTA'

'GOOD'.

perform bdc_dynpro using 'SAPMZCMAT' '0200'.

perform bdc_field using 'BDC_OKCODE'

'=MOD'.

perform bdc_field using 'ZMRO_MATDATA-MATNR'

'100-100'.

perform bdc_field using 'ZMRO_MATDATA-ERSDA'

'19.07.2005'.

perform bdc_field using 'ZMRO_MATDATA-ERNAM'

'CHETAN'.

perform bdc_field using 'ZMRO_MATDATA-PSTAT'

'GOOD'.

perform bdc_field using 'ZMRO_MATDATA-LAEDA'

'19.07.2005'.

perform bdc_field using 'ZMRO_MATDATA-AENAM'

'VISHNOI'.

perform bdc_field using 'ZMRO_MATDATA-VPSTA'

'GOOD'.

perform bdc_field using 'BDC_CURSOR'

'T_PLANT-KZDIE(04)'.

perform bdc_field using 'T_PLANT-WERKS(04)'

'004'.

perform bdc_field using 'T_PLANT-XCHAR(04)'

't'.

perform bdc_field using 'T_PLANT-EKGRP(04)'

'102'.

perform bdc_field using 'T_PLANT-DISMM(04)'

'14'.

perform bdc_field using 'T_PLANT-DISPO(04)'

'20'.

perform bdc_field using 'T_PLANT-KZDIE(04)'

't'.

perform bdc_dynpro using 'SAPMZCMAT' '0200'.

perform bdc_field using 'BDC_OKCODE'

'/EBACK'.

perform bdc_field using 'BDC_CURSOR'

'ZMRO_MATDATA-MATNR'.

perform bdc_dynpro using 'SAPMZCMAT' '0200'.

perform bdc_field using 'BDC_CURSOR'

'ZMRO_MATDATA-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'=ENTER'.

perform bdc_field using 'ZMRO_MATDATA-MATNR'

'100-100'.

perform bdc_dynpro using 'SAPMZCMAT' '0200'.

perform bdc_field using 'BDC_CURSOR'

'ZMRO_MATDATA-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'=TABSTRIP1_FC2'.

perform bdc_field using 'ZMRO_MATDATA-MATNR'

'100-100'.

perform bdc_dynpro using 'SAPMZCMAT' '0200'.

perform bdc_field using 'BDC_OKCODE'

'/EBACK'.

perform bdc_field using 'BDC_CURSOR'

'ZMRO_MATDATA-MATNR'.

perform bdc_dynpro using 'SAPMZCMAT' '0100'.

perform bdc_field using 'BDC_OKCODE'

'/EBACK'.

perform bdc_field using 'BDC_CURSOR'

'%#AUTOTEXT003'.

*perform bdc_transaction using 'ZCMAT'.

CALL TRANSACTION 'ZCMAT' USING BDCDATA

MODE 'A'

UPDATE 'A'

MESSAGES INTO MESSTAB.

perform close_group.

hope it will help u .

if yes than give points.

with regards

chetan vishnoi

Read only

former_member480923
Active Contributor
0 Likes
4,227

Hi

Please look at the following piece of code

REPORT Y730_BDC5 .
*HANDLING TABLE CONTROL IN BDC
DATA : BEGIN OF IT_DUMMY OCCURS 0,
       DUMMY(100) TYPE C,
       END OF IT_DUMMY.
DATA : BEGIN OF IT_XK01 OCCURS 0,
       LIFNR(10) TYPE C,
       BUKRS(4)  TYPE C,
       EKORG(4)  TYPE C,
       KTOKK(4)  TYPE C,
       NAME1(30) TYPE C,
       SORTL(10) TYPE C,
       LAND1(3)  TYPE C,
       SPRAS(2)  TYPE C,
       AKONT(6)  TYPE C,
       FDGRV(2)  TYPE C,
       WAERS(3)  TYPE C,
       END OF IT_XK01,
       BEGIN OF IT_BANK OCCURS 0,
       BANKS(3)  TYPE C,
       BANKL(10) TYPE C,
       BANKN(10) TYPE C,
       KOINH(30) TYPE C,
       LIFNR(10) TYPE C,
       END OF IT_BANK.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
       IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'WS_UPLOAD'
 EXPORTING
   FILENAME                      = 'C:VENDOR.TXT'
   FILETYPE                      = 'ASC'
 TABLES
   DATA_TAB                      = IT_DUMMY.

LOOP AT IT_DUMMY.
  IF IT_DUMMY-DUMMY+0(2) = '11'.
    IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).
    IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).
    IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).
    IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).
    IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).
    IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).
    IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).
    IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).
    IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).
    IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).
    IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).
    APPEND IT_XK01.
  ELSE.
    IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).
    IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).
    IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).
    IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).
    IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).
    APPEND IT_BANK.
  ENDIF.
ENDLOOP.

LOOP AT IT_XK01.
REFRESH IT_BDCDATA.
perform bdc_dynpro      using 'SAPMF02K' '0100'.
perform bdc_field       using 'BDC_CURSOR'
                              'RF02K-REF_LIFNR'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'RF02K-LIFNR'
                              IT_XK01-LIFNR.
perform bdc_field       using 'RF02K-BUKRS'
                              IT_XK01-BUKRS.
perform bdc_field       using 'RF02K-EKORG'
                              IT_XK01-EKORG.
perform bdc_field       using 'RF02K-KTOKK'
                              IT_XK01-KTOKK.
perform bdc_dynpro      using 'SAPMF02K' '0110'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFA1-TELX1'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'LFA1-NAME1'
                              IT_XK01-NAME1.
perform bdc_field       using 'LFA1-SORTL'
                              IT_XK01-SORTL.
perform bdc_field       using 'LFA1-LAND1'
                              IT_XK01-LAND1.
perform bdc_field       using 'LFA1-SPRAS'
                              IT_XK01-SPRAS.
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-KOINH(02)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
DATA : FNAM(20) TYPE C,
       IDX      TYPE C.
  MOVE 1 TO IDX.
LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.
  CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.
  perform bdc_field       using FNAM
                                IT_BANK-BANKS.

  CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.
  perform bdc_field       using FNAM
                                IT_BANK-BANKL.

  CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.
  perform bdc_field       using FNAM
                                IT_BANK-BANKN.

  CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.
  perform bdc_field       using FNAM
                                IT_BANK-KOINH.
  IDX = IDX + 1.
ENDLOOP.

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 'SAPMF02K' '0210'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFB1-FDGRV'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'LFB1-AKONT'
                              IT_XK01-AKONT.
perform bdc_field       using 'LFB1-FDGRV'
                              IT_XK01-FDGRV.
perform bdc_dynpro      using 'SAPMF02K' '0215'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFB1-ZTERM'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_dynpro      using 'SAPMF02K' '0220'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFB5-MAHNA'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_dynpro      using 'SAPMF02K' '0310'.
perform bdc_field       using 'BDC_CURSOR'
                              'LFM1-WAERS'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'LFM1-WAERS'
                              IT_XK01-WAERS.
perform bdc_dynpro      using 'SAPMF02K' '0320'.
perform bdc_field       using 'BDC_CURSOR'
                              'WYT3-PARVW(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_dynpro      using 'SAPLSPO1' '0300'.
perform bdc_field       using 'BDC_OKCODE'
                              '=YES'.
CALL TRANSACTION 'XK01' USING IT_BDCDATA
                        MODE  'A'
                       UPDATE 'S'
                     MESSAGES INTO IT_BDCMSGCOLL.
ENDLOOP.

FORM BDC_DYNPRO USING PROG SCR.
  CLEAR IT_BDCDATA.
  IT_BDCDATA-PROGRAM = PROG.
  IT_BDCDATA-DYNPRO  = SCR.
  IT_BDCDATA-DYNBEGIN = 'X'.
  APPEND IT_BDCDATA.
ENDFORM.

FORM BDC_FIELD USING FNAM FVAL.
  CLEAR IT_BDCDATA.
  IT_BDCDATA-FNAM = FNAM.
  IT_BDCDATA-FVAL  = FVAL.
  APPEND IT_BDCDATA.
ENDFORM.

Hope this Helps

Anirban

Read only

Former Member
0 Likes
4,227

Hi Suresh,

Check the Following,

<a href="http://www.sap-img.com/bdc.htm">BDC</a>

Regards,

Arun Sambargi.