08-26-2011 7:23 AM
Hi All,
I am facing a problem with BDC scoll down. I have written BDC for MB1C with serial numbers. i have 100 serial numbers for my 100 qty. While running BDC i am not able to fill more than 19 rows( max allowed rows for that windaw) . So i have used '=P' OK_CODE.....while excecuting this i am getting error......"P Function not defined".
Can anyone help me ........Following is the my BDC code for looping to enter serial numbers.
MOVE 1 TO v_indx.
*DO V_CNT TIMES.
LOOP AT IT_EXCEL1 WHERE WERKS = IT_EXCEL-WERKS
AND LGORT = IT_EXCEL-LGORT
AND MATNR = IT_EXCEL-MATNR
AND CHARG = IT_EXCEL-CHARG.
perform bdc_dynpro using 'SAPLIPW1' '0200'.
CONCATENATE 'RIPW0-SERNR(' v_indx ')' INTO V_FNAM.
perform bdc_field using 'BDC_CURSOR'
V_FNAM.
perform bdc_field using V_FNAM
IT_EXCEL1-SERNR.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
v_indx = v_indx + 1.
ENDLOOP.
08-26-2011 7:49 AM
Try this,
before statement for OK_CODE = '=P+' add condition, if v_indx = 19. Also before endif clear v_indx so that for next page down it will again get triggered after 19 items.
Edited by: 118775 on Aug 26, 2011 8:50 AM
Edited by: 118775 on Aug 26, 2011 8:50 AM
08-26-2011 8:23 AM
Hi
I have traid with our logic, But it is replacing the first 19 rows only every time.....
Pls help me.
08-26-2011 8:29 AM
Did you simulated via SHDB your transasction code?
Seems that the Transaction you want to duplicate via BDC do not support OK_CODE P+
Sorry, i did a mistake, via shdb, i got ok_code =P+.
You could approach the question in other way.
Instead of filling the rows and then scroll down, you could use the Function code =NLE that allow to insert a new single position.
Edited by: Simone Milesi on Aug 26, 2011 9:34 AM
08-26-2011 10:22 AM
Hi,
But now its giving the same error for P+ after if condition also?
Its replacing same line as its again getting same index starting from one... Declare another variable say lv_count and in loop increment line ur v_indx. And now check condition if lv_count = 19 and inside if clear lv_count. So that lv_indx won't get affected and it will edit correct line item.
Thanks,
Mihika
08-26-2011 8:10 AM
Instead of filling up the 19 rows then doing a page down.. Try the approach of filling one row and a scroll.
You can trigger the scroll using the function code "/00".
Regards
Mishra
08-26-2011 8:33 AM
Hi Mishra,
I have traid with our logic also.... i have 100 serial numbers.....if i am excexuting in All Screens mode.....it entered 19 rows continuously & each time it is showing " Exactly 100 serial numbers must be selected
(instead of 19) " Info message & at last it is showing error for RIPW0-SERNR(20) does not exits on the screen. similar for all rest rowa up to 100.
how to solve this.
can anyone give me some sample code.
08-26-2011 8:48 AM
Hi
I believe there isn't an ok-code for scoll down/up the table in that screen, that mean it can be managed by the vertical scroll bar only, but the bar can't be simulate by BDC program.
Probably you should use the BAPI BAPI_GOODSMVT_CREATE instead of a bdc program
Max
08-26-2011 8:32 AM
I can't see BDC_CURSOR for your BDC_OKCODE = '=P+'.
Try placing the cursor for the okcode page down.
Regards
Mishra
08-26-2011 8:45 AM
Hi,
Try this below piece of code.
IF v_indx GE 20.
perform bdc_dynpro using 'SAPLIPW1' '0200'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
v_indx = 2.
ENDIF.
Regards,
Nagaraj
08-26-2011 8:56 AM
Hi,
If i traid to use '=P' OK_CODE while running BDC in 'A' Mode......when ever OK_CODE = '=P'.......it is showing error
" Function not defined ".
What i have to do?
Is there any thing to include in my program regarding Function Codes activation?
08-26-2011 9:07 AM
Hi,
Declare
Data Ls_options type CTU_PARAMS.
then
before
your scroll BDC logic runs add this
LS_options-DEFSIZE = 'X' .
LS_options-RACOMMIT = 'X' .
LS_options-NOBINPT = 'X' .
LS_options-NOBIEND = 'X' .
I hope it will capture ur scroll ok code. revert me if any further clarification required
Regards,
Ketan
08-26-2011 9:41 AM
08-26-2011 9:55 AM
Hi,
It seems the ok_code =P+ IS not correct.You need to check the exact ok_code for new line or page down... then only the code given by me will work.. if there is no ok code defined for new line , then you might need to see if any bapi's available for ur requrement.
Regards,
Nagaraj
08-26-2011 10:17 AM
Hi,
Try this.This worked for me.
for page down
WHILE v_position GT 19.
PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=P+'.
v_position = v_position - 13.
ENDWHILE.
Where v_position stores the line number
and replace 'SAPMF02K' '0320' with your program name and dynpro number
regards,
Sucharita
08-26-2011 12:51 PM
Is there a BAPI? If so, use of a BAPI is always preferable to BDC and call transaction. That said, I've always had much better results in these kinds of list with a single entry, enter key press, reposition screen with new line entry or P+, then next entry on line with subscript 2 or 3.....repeat until every row has been processed. You cannot rely upon the number of rows in a screen...different users might have different resolution/sizes...you therefore need to address one row at a time.
But, please consider whether or not you can use a BAPI...they're so much easier to work with and they do the "SAP way" and they are already optimized for performance, etc.
08-26-2011 1:42 PM
Hi,
P+ (=P+ in the BDC) is not a universal function code, but only one which is defined in ABAP lists . So, 99% of time, it doesn't work for all others situations (like yours).
Scrolling a table control is not so easy to do. When you record a page down on a table control in SHDB, you'll get probably a /00 which corresponds to Enter. When you play the recording, it won't scroll. The issue is that "page down" is processed in 2 parts, it changes the "top line" of the table control, and executes Enter. But it's not possible to record/play the "top line" information.
The solution is that the program usually implements a function code:
either "add new line"
or "position at line"
Sometimes, the function code is hidden so you must look at inside the program (or search SAP notes, like here: [SAP note 187946 (No positioning on PRT overview in routing)|https://service.sap.com/sap/support/notes/187946 ])
And sometimes, there's no function code at all, and then you're stuck ! (or use SAP GUI scripting, but it may only work in dialog).
You may also try Max/DaveL proposition (BAPI instead of BDC).
Sandra
08-30-2011 11:48 AM
See the following example
move 1 to idx1.
SORT idata BY code.
LOOP AT idata WHERE code = itab1-code.
PERFORM bdc_field USING 'BDC_CURSOR' v_mat.
PERFORM bdc_field USING 'BDC_OKCODE' '=OK4'.
move idx1 to idx.
CONDENSE idx.
CONCATENATE 'MARA-MATNR(' idx ')' INTO v_mat.
CONCATENATE 'QTY(' idx ')' INTO v_qty.
PERFORM bdc_field USING v_mat idata-matcode.
PERFORM bdc_field USING v_qty idata-qty.
perform bdc_field using 'BDC_OKCODE' '=P++'.
idx1 = idx1 + 1.
ENDLOOP.
02-06-2013 5:54 AM
Instead of Using '=p+' try with Insert OK CODE IT WILL WORK FINE in your items table .
This is VA01 item table loop condition ..
loop at it_va01a into wa_va01a where index = wa_header-index.
if sy-tabix = 1.
concatenate 'RV45A-MABNR(' idx ')' into fnam.
perform bdc_field using fnam
wa_va01a-mabnr.
concatenate 'RV45A-KWMENG(' idx ')' into fnam.
perform bdc_field using fnam
wa_va01a-kwmeng.
endif.
if sy-tabix >= 2.
idx = 2.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=POAN'.
concatenate 'RV45A-MABNR(' idx ')' into fnam.
perform bdc_field using fnam
wa_va01a-mabnr.
concatenate 'RV45A-KWMENG(' idx ')' into fnam.
perform bdc_field using fnam
wa_va01a-kwmeng.
endif.
endloop.
Hope this will solve your issue.
Regards,
Alan Babu
09-13-2013 1:31 PM
hi
i am also facing same problem ...
may i know the sloution for this...
many thanks
01-24-2020 1:19 AM