‎2009 Jun 30 3:18 AM
Hey folks,
I have written bdc for ME31k and when it reaches 26 record it says Field ekpo-lgort(27) doesn't exist on the screen SAPMM06E 0220. It has to do something with the scolling. I am pasting the code writen by me . i have tried but couldn't figure it out. Could some body tell me where I am doing the mistake in the code.
Thanks in advance.
w = 1.
LOOP AT it_item INTO wa_item WHERE ebeln = wa_header-ebeln.
CONCATENATE 'EKPO-EMATN( ' w ' )' INTO ws_field1.
CONCATENATE 'EKPO-NETPR( ' w ' )' INTO ws_field2.
CONCATENATE 'EKPO-WERKS( ' w ' )' INTO ws_field3.
CONCATENATE 'EKPO-MATKL( ' w ' )' INTO ws_field4.
CONCATENATE 'EKPO-LGORT( ' w ' )' INTO ws_field5.
CONCATENATE 'EKPO-UNTTO( ' w ' )' INTO ws_field6.
CONCATENATE 'EKPO-UEBTO( 'w ' )' INTO ws_field7.
PERFORM dynpro USING:
'X' 'SAPMM06E' '0220',
' ' 'BDC_OKCODE' '/00',
' ' ws_field1 wa_item-matnr,
' ' 'EKPO-KTMNG(01)' wa_item-ktmng,
' ' ws_field2 wa_item-netpr,
' ' ws_field3 wa_item-werks,
' ' ws_field4 wa_item-matkl,
' ' ws_field5 wa_item-lgort.
PERFORM dynpro USING:
' ' 'BDC_OKCODE' '=DETA'.
*PERFORM dynpro USING:
'X' 'SAPMM06E' '0211',
' ' WS_FIELD6 wa_item-under,
' ' WS_FIELD7 wa_item-over.
w = w + 1.
indx = indx + 1.
ENDLOOP.
PERFORM dynpro USING:
'X' 'SAPMM06E' '0220',
' ' 'BDC_OKCODE' '=BU'.
PERFORM call_transaction USING w_tcode.
Regards
Rock
‎2009 Jun 30 4:23 AM
Rock,
You need to code the page down within your BDC session. So when you you reach 26 record you need to add the logic to do the page down once. Make sure that after this you reset your counter.
Cheers,
Neil.
‎2009 Jun 30 5:03 AM
Hi Rock,
i think you followed this logic after filling the header structures then when you came to line item screens you are passing one by one in that screen if you follow this logic it will be a problem because after the end it won't go,
just try this logic,
after filling the header structure when you come to line item screen you can see line item no at the bottom just fill the first line item say 10 and fill records correspondingly and save, for the second record come from header then when you reach line item screen then pass 20 and save, like that complete for one set, then go for second set by using any on change of commands for the second set.
‎2009 Jun 30 5:30 AM
Hi suresh
but i need the header to be executed only once . and it shud go into items and populate the items . problem comes only when the items are greater than 26.
is there any solution.
Regards
Rock
‎2009 Jun 30 5:36 AM
Hi
Check this wiki,
[Newline in BDC|http://wiki.sdn.sap.com/wiki/x/xQKmB]
In ME31K you have a new line button to insert the line items into the respective fields so do the same in BDC and you will achieve.
The scenario what you have in the hand is same as the wiki just follow the code of newline adding.
Regards
Sarves
‎2009 Jun 30 6:58 AM
I have inserted the following code but doesn't seem wo work . its throwing me an error saying ekpo-lgort(27) doesn't exist on the screen. happens at 27th record.
LOOP AT it_header INTO wa_header.
PERFORM convert_date USING sy-datum
CHANGING w_vedat.
PERFORM convert_date USING wa_header-kdate
CHANGING w_kdate.
PERFORM convert_date USING wa_header-ihran
CHANGING w_ihran.
PERFORM convert_date USING wa_header-zzprcdate
CHANGING w_zzprcdate.
PERFORM f_populate_bdc_fields.
ENDLOOP.
CLEAR: it_bdcdata.
REFRESH: it_bdcdata.
PERFORM dynpro USING:
'X' 'SAPMM06E' '0200',
' ' 'BDC_OKCODE' '/00',
' ' 'EKKO-LIFNR' wa_header-lifnr,
' ' 'RM06E-EVART' wa_header-evart ,
' ' 'RM06E-VEDAT' w_vedat,
' ' 'EKKO-EKORG' wa_header-ekorg,
' ' 'EKKO-EKGRP' wa_header-ekgrp.
PERFORM dynpro USING:
'X' 'SAPMM06E' '0201',
' ' 'BDC_OKCODE' '/00',
' ' 'EKKO-KDATE' w_kdate,
' ' 'EKKO-SPRAS' 'EN',
' ' 'EKKO-ZTERM' wa_header-zterm,
' ' 'EKKO-WAERS' 'USD',
' ' 'EKKO-ZBD1T' wa_header-zbd1t,
' ' 'EKKO-LLIEF' wa_header-llief,
' ' 'EKKO-KTWRT' wa_header-ktwrt,
' ' 'EKKO-INCO1' wa_header-inco1,
' ' 'EKKO-INCO2' wa_header-inco2,
' ' 'EKKO-IHRAN' w_ihran,
' ' 'EKKO-ANGNR' wa_header-angnr,
' ' 'EKKO-IHREZ' wa_header-ihrez,
' ' 'EKKO-VERKF' wa_header-verkf,
' ' 'EKKO-UNSEZ' wa_header-unsez,
' ' 'EKKO-TELF1' wa_header-telf1,
' ' 'EKKO-LLIEF' wa_header-llief,
' ' 'EKKO-ZZPRCDATE' w_zzprcdate.
w = 1.
LOOP AT it_item INTO wa_item WHERE ebeln = wa_header-ebeln.
CONCATENATE 'EKPO-EMATN( ' w ' )' INTO ws_field1.
CONCATENATE 'EKPO-NETPR( ' w ' )' INTO ws_field2.
CONCATENATE 'EKPO-WERKS( ' w ' )' INTO ws_field3.
CONCATENATE 'EKPO-MATKL( ' w ' )' INTO ws_field4.
CONCATENATE 'EKPO-LGORT( ' w ' )' INTO ws_field5.
CONCATENATE 'EKPO-UNTTO( ' w ' )' INTO ws_field6.
CONCATENATE 'EKPO-UEBTO( 'w ' )' INTO ws_field7.
PERFORM dynpro USING:
'X' 'SAPMM06E' '0220',
' ' 'BDC_OKCODE' '/00',
' ' ws_field1 wa_item-matnr,
' ' 'EKPO-KTMNG(01)' wa_item-ktmng,
' ' ws_field2 wa_item-netpr,
' ' ws_field3 wa_item-werks,
' ' ws_field4 wa_item-matkl,
' ' ws_field5 wa_item-lgort.
PERFORM dynpro USING:
' ' 'BDC_OKCODE' '=DETA'.
*PERFORM dynpro USING:
'X' 'SAPMM06E' '0211',
' ' WS_FIELD6 wa_item-under,
' ' WS_FIELD7 wa_item-over.
w = w + 1.
indx = indx + 1.
ENDLOOP.
PERFORM dynpro USING:
'X' 'SAPMM06E' '0220',
' ' 'BDC_OKCODE' '=BU'.
PERFORM call_transaction USING w_tcode.
I have tried all the means but doesn't work can someone help.
‎2009 Jun 30 7:10 AM
Rock,
The problem is there are only 26 lines displayed on the page. Once you reach 26 lines you need to force a page down on the screen to the 27th line is available on the screen.
Go to the BDC recorder (Transaction SHDB) and record a session that has more than 26 lines. You will capture the page down code, Normally this is 'P+'. Once you have filled the 26th pass the page down command.
Please note though that after the first page down there will be less than 26 lines available for entry so your code will have to reflect this.
If this is not clear let me know and I will give you a code snippet.
Cheers,
Neil.
‎2009 Jun 30 7:16 AM
Hi,
Just try it this way,
LOOP AT it_item INTO wa_item WHERE ebeln = wa_header-ebeln.
CONCATENATE 'EKPO-EMATN( ' w ' )' INTO ws_field1.
CONCATENATE 'EKPO-NETPR( ' w ' )' INTO ws_field2.
CONCATENATE 'EKPO-WERKS( ' w ' )' INTO ws_field3.
CONCATENATE 'EKPO-MATKL( ' w ' )' INTO ws_field4.
CONCATENATE 'EKPO-LGORT( ' w ' )' INTO ws_field5.
CONCATENATE 'EKPO-UNTTO( ' w ' )' INTO ws_field6.
CONCATENATE 'EKPO-UEBTO( 'w ' )' INTO ws_field7.
PERFORM dynpro USING:
'X' 'SAPMM06E' '0220',
' ' 'BDC_OKCODE' '/00',
' ' ws_field1 wa_item-matnr,
* ' ' 'EKPO-KTMNG(01)' wa_item-ktmng,
' ' ws_field2 wa_item-netpr,
' ' ws_field3 wa_item-werks,
' ' ws_field4 wa_item-matkl,
' ' ws_field5 wa_item-lgort.
w = w + 1.
if w > 2.
w = 2.
"Added a new screen with bdc_okcode
perform dynpro using:
'X' 'SAPMM06E' '0220',
' ' 'BDC_OKCODE' '=NP'
endif.
* PERFORM dynpro USING:
* ' ' 'BDC_OKCODE' '=DETA'.
*PERFORM dynpro USING:
* 'X' 'SAPMM06E' '0211',
* ' ' WS_FIELD6 wa_item-under,
* ' ' WS_FIELD7 wa_item-over.
indx = indx + 1.
ENDLOOP.
PERFORM dynpro USING:
'X' 'SAPMM06E' '0220',
' ' 'BDC_OKCODE' '=BU'.
PERFORM call_transaction USING w_tcode.Regards
Sarves
‎2009 Jun 30 7:55 AM
‎2009 Jun 30 8:04 AM
‎2009 Jun 30 7:04 AM
Hi Rock,
You have not mentioned anywhere, at what position counter 'W' will refresh after page down.
So clear it just after gets value more tha 26 and then proceed.
Put some if condition inside the loop to check the counter, so that it never goes above 26.
Regds,
Anil