06-05-2008 7:27 AM
Hi Experts,
I'm facing one problem with table control while doing BDC. In the table control, only three lines are visible. After filling three lines information, i need to scroll the table control to enter fourth, fifth and so. But i'm getting ok-code as '/00', which is not wrking and when i tried to populate values in fourth row, the third row values are replaced. What should i do now? Is there any solution for this. Please suggest me ASAP.
Thanks & Regards,
Siva Sankar.
06-05-2008 7:46 AM
Hi Siva,
First of all tell me for which transaction ur making a BDC.
Whenever we are making a BDC for table control there are
many ways to do it, now the one which ur mentioning here
will need P++ as an ok code, but this will only work when your
table control is filled to it's last line.You have to define a counter in you table control's internal table and in ur case when ever counter = 3 use P++ as an ok-code and again set the counter to 1 when done.
Do it, it will surely help you out.
Cheers...!!!
Sid
06-05-2008 7:31 AM
Hi,
scroll down the table control for each line item.
Regards
Sriram
Edited by: Srirama Murthy Maddirala on Jun 5, 2008 8:31 AM
06-05-2008 7:38 AM
Hi Sriram,
Thanks for ur quick reply. Ya I'm scrolling for each line item, but while scrolling i'm getting ok-code as '/00', which means pressing enter. So its not scrolling and when i'm trying to put values of new line, last but one line values are replaced. I think you got my problem.
Regards,
Siva Sankar.
06-05-2008 7:42 AM
Sample Code for BDC with table control.
perform bdc_dynpro using 'SAPLCOIH' '0101'.
perform bdc_field using 'BDC_CURSOR' 'CAUFVD-AUFNR'.
perform bdc_field using 'BDC_OKCODE' '=MUEB'.
perform bdc_field using 'CAUFVD-AUFNR' W_SORD_NUM.
IF del_flag = 'X'.
perform bdc_dynpro using 'SAPLCOIH' '3000'.
perform bdc_field using 'BDC_OKCODE' '=BU'.
ELSE.
perform bdc_dynpro using 'SAPLCOIH' '3000'.
perform bdc_field using 'BDC_OKCODE' '/00'.
ENDIF.
perform bdc_field using 'CAUFVD-KTEXT' wa_parts-part_desc.
perform bdc_field using 'BDC_CURSOR' 'RESBD-WEMPF(01)'.
READ TABLE it_afko INTO wa_afko
WITH KEY aufnr = w_sord_num.
REFRESH :IT_PARTS_TMP.
IT_PARTS_TMP[] = IT_PARTS[].
LOOP AT it_parts INTO wa_parts.
w_sy_tabix = sy-tabix.
READ TABLE it_resb INTO wa_resb
WITH KEY rsnum = wa_afko-rsnum
aufnr = w_sord_num
posnr = wa_parts-itemno
xloek = ''.
IF sy-subrc = 0.
DELETE it_parts INDEX w_sy_tabix.
ENDIF.
ENDLOOP.
CLEAR : IDX.
LOOP AT it_parts INTO wa_parts.
qty = wa_parts-quantity.
IDX = IDX + 1.
condense IDX .
w_page_dn = IDX .
condense w_page_dn.
***************Code for more than 3 line item to add
IF w_page_dn = 1.
perform bdc_dynpro using 'SAPLCOIH' '3000'.
perform bdc_field using 'BDC_OKCODE' '=P+'.
perform bdc_dynpro using 'SAPLCOIH' '3000'.
perform bdc_field using 'BDC_OKCODE' '=P+'.
perform bdc_dynpro using 'SAPLCOIH' '3000'.
perform bdc_field using 'BDC_OKCODE' '=P+'.
w_page_dn = 2.
IDX = w_page_dn.
condense IDX .
ELSEIF w_page_dn > 3.
perform bdc_dynpro using 'SAPLCOIH' '3000'.
perform bdc_field using 'BDC_OKCODE' '=P+'.
perform bdc_dynpro using 'SAPLCOIH' '3000'.
perform bdc_field using 'BDC_OKCODE' '=P+'.
perform bdc_dynpro using 'SAPLCOIH' '3000'.
perform bdc_field using 'BDC_OKCODE' '=P+'.
w_page_dn = 2.
IDX = w_page_dn.
condense IDX .
ENDIF.
*************************
CLEAR: wa_resb.
IF wa_resb IS INITIAL.
CONCATENATE 'RESBD-ABLAD(' IDX ')' INTO fnam.
perform bdc_field using fnam
wa_parts-usage.
CONCATENATE 'RESBD-MATNR(' IDX ')' INTO fnam.
perform bdc_field using fnam
wa_parts-partno.
CONCATENATE 'RESBD-MENGE(' IDX ')' INTO fnam.
perform bdc_field using fnam
qty.
CONCATENATE 'RESBD-EINHEIT(' IDX ')' INTO fnam.
perform bdc_field using fnam
wa_parts-unit.
CONCATENATE 'RESBD-LGORT(' IDX ')' INTO fnam.
perform bdc_field using fnam
wa_parts-sloc.
CONCATENATE 'RESBD-WERKS(' IDX ')' INTO fnam.
perform bdc_field using fnam
wa_parts-plant.
CONCATENATE 'RESBD-VORNR(' IDX ')' INTO fnam.
perform bdc_field using fnam
wa_qapo-vornr. .
CONCATENATE 'RESBD-CHARG(' IDX ')' INTO fnam.
perform bdc_field using fnam
wa_parts-batch.
ENDIF.
CLEAR: wa_resb.
ENDLOOP .
w_page_dn = 0.
perform bdc_dynpro using 'SAPLCOIH' '3000'.
perform bdc_field using 'BDC_OKCODE' '=BU'.
perform bdc_transaction USING 'IW32'.
Regards,
Swarup
06-05-2008 7:46 AM
Hi Siva,
First of all tell me for which transaction ur making a BDC.
Whenever we are making a BDC for table control there are
many ways to do it, now the one which ur mentioning here
will need P++ as an ok code, but this will only work when your
table control is filled to it's last line.You have to define a counter in you table control's internal table and in ur case when ever counter = 3 use P++ as an ok-code and again set the counter to 1 when done.
Do it, it will surely help you out.
Cheers...!!!
Sid
06-05-2008 8:22 AM
Hi Siddarth,
Thanks for your reply. I'm doing this bdc for ME21 transaction. But the problem is not with line item deatils filling. There is no problem with that. There is one more table control in header level which is purely customized. There are no other provision to scroll, we have to press on down-arrow button after filling three line item's details. But here i'm getting '/00' as ok-code. I have tried with 'P+' and '=P' ok-codes also. but BDC giving error like 'This function not defined'. What should we do now?
Regards,
Siva Sankar.
06-05-2008 8:36 AM
ok
shiva I got ur problem lil bit,
now ur saying that table control screen is customized,
and u have to press the down arrow before doing it.....rite.
Now do one thing, go to ur customized screen in se80 or se51
and for that button (down arrow) define a FctCode in attributes and use the same in Ok-code in ur BDC.I am sure u have shud have written a code for that down arrow button,if yes then it will surely work.
Leavingn for the day,,,,,catch u later....ask me if u didn't get anything
Cheers...!!!
Sid
06-05-2008 8:00 AM
hi,
Inorder to acheive table scroll downing feature , we have to make use of bdc-okcode p+. in the perform statements.
refer the sample code:
IF CNT > 3.
perform bdc_field using 'BDC_OKCODE' '=P+'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKN(01)'.
perform bdc_field using 'BDC_OKCODE' '=VW'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKN(01)'.
perform bdc_field using 'BDC_OKCODE' '=VW'.
CNT = 1.
ENDIF.
Reward if helpful
Rgds
Umakanth