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

Former Member
0 Likes
1,063

HI,

How to do BDC with table control.

I found the out the code from SDN but,

How to do the scrolling of the table control?.

From the code I found out I could only enter the data into the control until its not scrolled.

How to pass the excess data,

Please help me.

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,028

HI .. this is the simple program for table control in BDC ..

report ZBDC_XK01N

no standard page heading line-size 255.

DATA: BEGIN OF ITAB OCCURS 0,

lifnr like LFA1-LIFNR,

BUKRS LIKE RF02K-BUKRS,

EKORG LIKE RF02K-EKORG,

KTOKK LIKE RF02K-KTOKK,

ANRED LIKE LFA1-ANRED,

NAME1 LIKE LFA1-NAME1,

SORTL LIKE LFA1-SORTL,

LAND1 LIKE LFA1-LAND1,

END OF ITAB.

DATA: BEGIN OF ITAB2 OCCURS 0,

LIFNR LIKE LFA1-LIFNR,

BANKS LIKE LFBK-BANKS,

BANKL LIKE LFBK-BANKL,

BANKN LIKE LFBK-BANKN,

KOINH LIKE LFBK-KOINH,

END OF ITAB2.

DATA COUNT TYPE CHAR2 .

DATA: T_BANKS(20), T_BANKL(20), T_BANKN(20), T_KOINH(20).

include bdcrecx1.

start-of-selection.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\Documents and Settings\Administrator\Desktop\VENDOR.txt'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = '#'

TABLES

DATA_TAB = ITAB[].

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\Documents and Settings\Administrator\Desktop\BANK.txt'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = '#'

TABLES

DATA_TAB = ITAB2[].

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' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-KTOKK'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-LIFNR'

itab-lifnr.

perform bdc_field using 'RF02K-BUKRS'

itab-BUKRS.

perform bdc_field using 'RF02K-EKORG'

itab-ekorg.

perform bdc_field using 'RF02K-KTOKK'

itab-KTOKK.

perform bdc_dynpro using 'SAPMF02K' '0110'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-LAND1'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFA1-ANRED'

itab-ANRED.

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_dynpro using 'SAPMF02K' '0120'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-BEGRU'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

CLEAR count .

LOOP AT ITAB2 WHERE LIFNR = ITAB-LIFNR.

COUNT = COUNT + 1 .

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = COUNT

IMPORTING

OUTPUT = COUNT.

CONCATENATE 'LFBK-BANKS(' COUNT ')' INTO T_BANKS .

CONCATENATE 'LFBK-BANKL(' COUNT ')' INTO T_BANKL .

CONCATENATE 'LFBK-BANKN(' COUNT ')' INTO T_BANKN .

CONCATENATE 'LFBK-KOINH(' COUNT ')' INTO T_KOINH .

CONDENSE: T_BANKS(20), T_BANKL(20), T_BANKN(20), T_KOINH(20).

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-KOINH(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using T_BANKS

ITAB2-banks.

perform bdc_field using T_BANKL

ITAB2-BANKL.

perform bdc_field using T_BANKN

itab2-bankn.

perform bdc_field using T_KOINH

ITAB2-KOINH.

  • perform bdc_dynpro using 'SAPLBANK' '0100'.

  • perform bdc_field using 'BDC_OKCODE'

  • '/E'.

  • perform bdc_field using 'BDC_CURSOR'

  • 'BNKA-BANKA'.

  • perform bdc_dynpro using 'SAPMF02K' '0130'.

  • perform bdc_field using 'LFBK-BANKS(01)'

  • 'IN'.

  • perform bdc_field using 'LFBK-BANKL(01)'

  • 'YFFF'.

*

*

  • perform bdc_dynpro using 'SAPMF02K' '0130'.

  • perform bdc_field using 'BDC_CURSOR'

  • 'LFBK-KOINH(05)'.

  • perform bdc_field using 'BDC_OKCODE'

  • 'ENTR'.

  • perform bdc_field using 'LFBK-BANKS(02)'

  • 'in'.

  • perform bdc_field using 'LFBK-BANKS(03)'

  • 'in'.

  • perform bdc_field using 'LFBK-BANKL(01)'

  • 'YFFF'.

  • perform bdc_field using 'LFBK-BANKL(02)'

  • 'YFFF'.

  • perform bdc_field using 'LFBK-BANKL(03)'

  • 'YFFF'.

  • perform bdc_field using 'LFBK-BANKL(04)'

  • 'YFFF'.

  • perform bdc_field using 'LFBK-BANKL(05)'

  • 'YFFF'.

  • perform bdc_field using 'LFBK-BANKN(02)'

  • '768567577'.

  • perform bdc_field using 'LFBK-BANKN(03)'

  • '768567578'.

  • perform bdc_field using 'LFBK-BANKN(04)'

  • '768567579'.

  • perform bdc_field using 'LFBK-BANKN(05)'

  • '768567580'.

  • perform bdc_field using 'LFBK-KOINH(02)'

  • 'kumar'.

  • perform bdc_field using 'LFBK-KOINH(03)'

  • 'Arun'.

  • perform bdc_field using 'LFBK-KOINH(04)'

  • 'abbc'.

  • perform bdc_field using 'LFBK-KOINH(05)'

  • 'Sankar'.

  • perform bdc_field using 'LFBK-BANKS(04)'

  • 'in'.

  • perform bdc_field using 'LFBK-BANKS(05)'

  • 'in'.

IF COUNT = '05'.

CLEAR COUNT .

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-BANKS(01)'.

perform bdc_field using 'BDC_OKCODE'

'=P+'.

ENDIF .

  • perform bdc_dynpro using 'SAPMF02K' '0130'.

  • perform bdc_field using 'BDC_CURSOR'

  • 'LFBK-KOINH(01)'.

  • perform bdc_field using 'BDC_OKCODE'

  • '=ENTR'.

  • perform bdc_field using 'LFBK-BANKS(01)'

  • 'in'.

  • perform bdc_field using 'LFBK-BANKL(01)'

  • 'YFFF'.

  • perform bdc_field using 'LFBK-BANKN(01)'

  • '768567581'.

  • perform bdc_field using 'LFBK-KOINH(01)'

  • 'Lgh'.

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'

'160000'.

perform bdc_field using 'LFB1-FDGRV'

'a1'.

perform bdc_dynpro using 'SAPMF02K' '0215'.

perform bdc_field using 'BDC_CURSOR'

'LFB1-ZTERM'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFB1-ZTERM'

''.

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'

'=UPDA'.

perform bdc_field using 'LFM1-WAERS'

'inr'.

perform bdc_transaction using 'XK01'.

ENDLOOP.

perform close_group.

10 REPLIES 10
Read only

Former Member
0 Likes
1,028

Hi ,

Yes initially u can ente data till the last row in the screen.If you want to add additional rows you have to write code for scroll bar.Just count the total no of current screen rows .If the data exceeds the total then do the page up.If you record u can get the code for page up.

Read only

0 Likes
1,028

hi,

Thnk for the answer,

How can I count the number of lines?

It varies from system to sytem.

It depends on the resolution of the screen

how can I get the values dynamically?

regards

Read only

Former Member
0 Likes
1,028

Hi,

Instead of counting the number of lines getting displayed on the screen,

better do a page down for each record so that it will always give you the first visible line to enter the data.

This may help you better in resolving entering the data .... what ever may be number of lines in the internal table, the latest record will be displayed in the top line..........

Regards,

Venkatesh

Read only

0 Likes
1,028

hi,

I tried the same way but the problem is that

the first record is being changed everytime but did not go to next line.

i am getting the status message that

'SCROLLING IS POSSIBLE ONLY IF ALL LINES ARE FILLED'

regards

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,028

Hi,

Yes, a BDC made for a table control will work on that system only i.e., it depends on the number of lines in the table control, so that the screen may be scrolled to next page for further entries.

So, you can try executing BDC on your table control in module pool programming because you can take a specified number of lines and code appropiately.

Hope this helps you.

Thanks & Regards,

Tarun Gambhir

Read only

Former Member
0 Likes
1,028

Hi Gambhir,

Ur ans is a bit convincing,

but the problem is that I am doing that for Vendor master update as there is no FM available for that to do in Backgrount task

could you help me in this regard

Read only

Former Member
0 Likes
1,029

HI .. this is the simple program for table control in BDC ..

report ZBDC_XK01N

no standard page heading line-size 255.

DATA: BEGIN OF ITAB OCCURS 0,

lifnr like LFA1-LIFNR,

BUKRS LIKE RF02K-BUKRS,

EKORG LIKE RF02K-EKORG,

KTOKK LIKE RF02K-KTOKK,

ANRED LIKE LFA1-ANRED,

NAME1 LIKE LFA1-NAME1,

SORTL LIKE LFA1-SORTL,

LAND1 LIKE LFA1-LAND1,

END OF ITAB.

DATA: BEGIN OF ITAB2 OCCURS 0,

LIFNR LIKE LFA1-LIFNR,

BANKS LIKE LFBK-BANKS,

BANKL LIKE LFBK-BANKL,

BANKN LIKE LFBK-BANKN,

KOINH LIKE LFBK-KOINH,

END OF ITAB2.

DATA COUNT TYPE CHAR2 .

DATA: T_BANKS(20), T_BANKL(20), T_BANKN(20), T_KOINH(20).

include bdcrecx1.

start-of-selection.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\Documents and Settings\Administrator\Desktop\VENDOR.txt'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = '#'

TABLES

DATA_TAB = ITAB[].

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\Documents and Settings\Administrator\Desktop\BANK.txt'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = '#'

TABLES

DATA_TAB = ITAB2[].

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' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-KTOKK'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-LIFNR'

itab-lifnr.

perform bdc_field using 'RF02K-BUKRS'

itab-BUKRS.

perform bdc_field using 'RF02K-EKORG'

itab-ekorg.

perform bdc_field using 'RF02K-KTOKK'

itab-KTOKK.

perform bdc_dynpro using 'SAPMF02K' '0110'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-LAND1'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFA1-ANRED'

itab-ANRED.

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_dynpro using 'SAPMF02K' '0120'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-BEGRU'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

CLEAR count .

LOOP AT ITAB2 WHERE LIFNR = ITAB-LIFNR.

COUNT = COUNT + 1 .

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = COUNT

IMPORTING

OUTPUT = COUNT.

CONCATENATE 'LFBK-BANKS(' COUNT ')' INTO T_BANKS .

CONCATENATE 'LFBK-BANKL(' COUNT ')' INTO T_BANKL .

CONCATENATE 'LFBK-BANKN(' COUNT ')' INTO T_BANKN .

CONCATENATE 'LFBK-KOINH(' COUNT ')' INTO T_KOINH .

CONDENSE: T_BANKS(20), T_BANKL(20), T_BANKN(20), T_KOINH(20).

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-KOINH(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using T_BANKS

ITAB2-banks.

perform bdc_field using T_BANKL

ITAB2-BANKL.

perform bdc_field using T_BANKN

itab2-bankn.

perform bdc_field using T_KOINH

ITAB2-KOINH.

  • perform bdc_dynpro using 'SAPLBANK' '0100'.

  • perform bdc_field using 'BDC_OKCODE'

  • '/E'.

  • perform bdc_field using 'BDC_CURSOR'

  • 'BNKA-BANKA'.

  • perform bdc_dynpro using 'SAPMF02K' '0130'.

  • perform bdc_field using 'LFBK-BANKS(01)'

  • 'IN'.

  • perform bdc_field using 'LFBK-BANKL(01)'

  • 'YFFF'.

*

*

  • perform bdc_dynpro using 'SAPMF02K' '0130'.

  • perform bdc_field using 'BDC_CURSOR'

  • 'LFBK-KOINH(05)'.

  • perform bdc_field using 'BDC_OKCODE'

  • 'ENTR'.

  • perform bdc_field using 'LFBK-BANKS(02)'

  • 'in'.

  • perform bdc_field using 'LFBK-BANKS(03)'

  • 'in'.

  • perform bdc_field using 'LFBK-BANKL(01)'

  • 'YFFF'.

  • perform bdc_field using 'LFBK-BANKL(02)'

  • 'YFFF'.

  • perform bdc_field using 'LFBK-BANKL(03)'

  • 'YFFF'.

  • perform bdc_field using 'LFBK-BANKL(04)'

  • 'YFFF'.

  • perform bdc_field using 'LFBK-BANKL(05)'

  • 'YFFF'.

  • perform bdc_field using 'LFBK-BANKN(02)'

  • '768567577'.

  • perform bdc_field using 'LFBK-BANKN(03)'

  • '768567578'.

  • perform bdc_field using 'LFBK-BANKN(04)'

  • '768567579'.

  • perform bdc_field using 'LFBK-BANKN(05)'

  • '768567580'.

  • perform bdc_field using 'LFBK-KOINH(02)'

  • 'kumar'.

  • perform bdc_field using 'LFBK-KOINH(03)'

  • 'Arun'.

  • perform bdc_field using 'LFBK-KOINH(04)'

  • 'abbc'.

  • perform bdc_field using 'LFBK-KOINH(05)'

  • 'Sankar'.

  • perform bdc_field using 'LFBK-BANKS(04)'

  • 'in'.

  • perform bdc_field using 'LFBK-BANKS(05)'

  • 'in'.

IF COUNT = '05'.

CLEAR COUNT .

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-BANKS(01)'.

perform bdc_field using 'BDC_OKCODE'

'=P+'.

ENDIF .

  • perform bdc_dynpro using 'SAPMF02K' '0130'.

  • perform bdc_field using 'BDC_CURSOR'

  • 'LFBK-KOINH(01)'.

  • perform bdc_field using 'BDC_OKCODE'

  • '=ENTR'.

  • perform bdc_field using 'LFBK-BANKS(01)'

  • 'in'.

  • perform bdc_field using 'LFBK-BANKL(01)'

  • 'YFFF'.

  • perform bdc_field using 'LFBK-BANKN(01)'

  • '768567581'.

  • perform bdc_field using 'LFBK-KOINH(01)'

  • 'Lgh'.

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'

'160000'.

perform bdc_field using 'LFB1-FDGRV'

'a1'.

perform bdc_dynpro using 'SAPMF02K' '0215'.

perform bdc_field using 'BDC_CURSOR'

'LFB1-ZTERM'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFB1-ZTERM'

''.

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'

'=UPDA'.

perform bdc_field using 'LFM1-WAERS'

'inr'.

perform bdc_transaction using 'XK01'.

ENDLOOP.

perform close_group.

Read only

0 Likes
1,028

Hi,

Thnks for the code

But the point is that I dont have the value of COUNT

how can I get the value dynamically?

Is there any system variable which captures the default lines of Tbale control.

Read only

0 Likes
1,028

Dynamically ? No you must force the screen size :

You will know the number of rows of the table control by looking at the dynpro source (SE51). When you run the CALL TRANSACTION, force to use the standard screen size like this :

DATA ls_options TYPE CTU_PARAMS.
ls_options-defsize = 'X'.
CALL TRANSACTION 'XXX'
   USING ...
   OPTIONS FROM ls_options.

For more information, see [abap documentation for DEFSIZE|http://help.sap.com/abapdocu/en/ABAPCALL_TRANSACTION_BDC_OPTIONS.htm]

Read only

Former Member
0 Likes
1,028

hello

please check this link

https://wiki.sdn.sap.com/wiki/display/ABAP/bdcontable+control

thnaks

geeta gupta