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 programming and table controls selColumns

Former Member
0 Likes
1,028

Hello,

I have a small question regarding BDC programming. I am already quite familiar with the process in creating one but I have one question regarding table control and its selColumns.

Transactions like pa40 would require its users to select one of the rows in the table controls via SelColumns. My questions is how would you simulate this using BDC.

Thanks people and take care.

9 REPLIES 9
Read only

Former Member
0 Likes
985

Hi,

I think as you select a row while recording it should capture the action.

Do u mean it does not capture any action while recording?

I think it should capture in normal recording.

VJ

Read only

0 Likes
985

Thanks guys i'll give it a shot late. Tell you how it goes.

Read only

0 Likes
985

FOR TABLE CONTROLS as said above if u record u cans ee as

FIELD(01)

FIELD(02)...........

but to make it general u need field(0n) but as it is not possible , to get it u need to use

concatenate statement to achive that.

ex:

RMM01-MATNR(01)..........RMM01-MATNR(N)

THE ABOVE can be achived as

N = val.

concatenate 'RMM01-MATNR(' N ')' INTO V_MATNR.

now

perform field_map using v_matnr

Read only

Former Member
0 Likes
985

if action type is on the first line of the table control, select it like this:

perform bdc_dynpro using 'SAPMP50A'        '2000'.
perform bdc_field using 'BDC_OKCODE'      '=PICK'.
perform bdc_field using 'RP50G-SELEC(01)' 'X'.

if its on the second line...then,

perform bdc_field using 'RP50G-SELEC(02)' 'X'.

and so on...

after that, normal processing...

perform bdc_field using 'RP50G-WERKS(01)' itab-werks.
perform bdc_field using 'RP50G-PERSG(01)' itab-persg.
perform bdc_field using 'RP50G-PERSK(01)' itab-persk.

....etc....etc.....

Hope this helps.

Cheers,

Syd.

Read only

vinod_gunaware2
Active Contributor
0 Likes
985

check this example..

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

Please look at the following sample code..

*********************************************

*BDC Example: Using Table Control in BDC

*******************************************

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.

regards

vinod

Read only

Former Member
0 Likes
985

Hai Chad Cheng

report Z_TAB_CONTRL_01

no standard page heading line-size 255.

data : begin of it_kna1 occurs 0,

kunnr like RF02D-KUNNR,

D0130 like RF02D-D0130,

end of it_kna1.

data : begin of it_kna2 occurs 0,

kunnr like RF02D-KUNNR,

BANKS like KNBK-BANKS,

BANKL like KNBK-BANKL,

BANKN like KNBK-BANKN,

koinh like KNBK-koinh,

end of it_kna2.

data : V_Count(2) type n.

data : V_Val(15).

include bdcrecx1.

start-of-selection.

perform Get_Data1.

perform Get_Data2.

perform open_group.

loop at it_kna1.

V_Count = '04'.

perform bdc_dynpro using 'SAPMF02D' '0106'.

perform bdc_field using 'BDC_CURSOR'

'RF02D-D0130'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02D-KUNNR'

'10002103'.

perform bdc_field using 'RF02D-D0130'

'X'.

perform bdc_dynpro using 'SAPMF02D' '0130'.

perform bdc_field using 'BDC_OKCODE'

'=P+'.

perform bdc_dynpro using 'SAPMF02D' '0130'.

perform bdc_field using 'BDC_OKCODE'

'=P+'.

perform bdc_dynpro using 'SAPMF02D' '0130'.

loop at it_kna2 where kunnr = it_kna1-kunnr.

if v_count = '10'.

perform bdc_field using 'BDC_OKCODE'

'=P+'.

perform bdc_dynpro using 'SAPMF02D' '0130'.

v_count = '00'.

endif.

V_Count = V_Count + 1.

concatenate 'KNBK-KOINH(' V_Count ')' into V_Val.

perform bdc_field using 'BDC_CURSOR'

'KNBK-KOINH(09)'.

concatenate 'KNBK-BANKS(' V_Count ')' into V_Val.

perform bdc_field using V_Val

it_kna2-BANKS.

concatenate 'KNBK-BANKL(' V_Count ')' into V_Val.

perform bdc_field using V_Val

it_kna2-BANKL.

concatenate 'KNBK-BANKN(' V_Count ')' into V_Val.

perform bdc_field using V_Val

it_kna2-BANKN.

concatenate 'KNBK-KOINH(' V_Count ')' into V_Val.

perform bdc_field using V_Val

it_kna2-KOINH.

endloop.

perform bdc_field using 'BDC_OKCODE'

'=UPDA'.

perform bdc_transaction using 'FD02'.

clear : it_kna1,it_kna2.

endloop.

perform close_group.

&----


*& Form Get_Data1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM Get_Data1 .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = 'C:\tab_contl.txt'

FILETYPE = 'ASC'

  • ITEM = ' '

  • FILEMASK_MASK = ' '

  • FILEMASK_TEXT = ' '

  • FILETYPE_NO_CHANGE = ' '

  • FILEMASK_ALL = ' '

  • FILETYPE_NO_SHOW = ' '

  • LINE_EXIT = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • SILENT = 'S'

  • IMPORTING

  • FILESIZE =

  • CANCEL =

  • ACT_FILENAME =

  • ACT_FILETYPE =

TABLES

DATA_TAB = it_kna1

  • EXCEPTIONS

  • CONVERSION_ERROR = 1

  • INVALID_TABLE_WIDTH = 2

  • INVALID_TYPE = 3

  • NO_BATCH = 4

  • UNKNOWN_ERROR = 5

  • GUI_REFUSE_FILETRANSFER = 6

  • OTHERS = 7

.

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. " Get_Data1

&----


*& Form Get_Data2

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM Get_Data2 .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = 'C:\tab_cont1.txt'

FILETYPE = 'ASC'

  • ITEM = ' '

  • FILEMASK_MASK = ' '

  • FILEMASK_TEXT = ' '

  • FILETYPE_NO_CHANGE = ' '

  • FILEMASK_ALL = ' '

  • FILETYPE_NO_SHOW = ' '

  • LINE_EXIT = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • SILENT = 'S'

  • IMPORTING

  • FILESIZE =

  • CANCEL =

  • ACT_FILENAME =

  • ACT_FILETYPE =

TABLES

DATA_TAB = it_kna2

  • EXCEPTIONS

  • CONVERSION_ERROR = 1

  • INVALID_TABLE_WIDTH = 2

  • INVALID_TYPE = 3

  • NO_BATCH = 4

  • UNKNOWN_ERROR = 5

  • GUI_REFUSE_FILETRANSFER = 6

  • OTHERS = 7

.

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. " Get_Data2

Thanks & regards

Sreenivasulu P

Read only

Former Member
0 Likes
985

y dont u search for a FM to update the actions of EMP

like this : HR_BEN_COB_UPDATE_AFTER_ACTION.

Read only

Former Member
0 Likes
985

Hi,

go through this link

http://www.sapgenie.com/phpBB2/viewtopic.php?t=11442&view=previous&sid=4d479ba17500a84a25af0932fbf0e...

i think this will help you.

reward points if helpfull.

Read only

Former Member
0 Likes
985

thi link too can help you

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

if found help full reward points