Skip to Content
avatar image
Former Member

BDC scroll down with OK_CODE '=P+'

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

10 Answers

  • avatar image
    Former Member
    Aug 26, 2011 at 06: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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • Aug 26, 2011 at 07: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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • Aug 26, 2011 at 07:32 AM

    I can't see BDC_CURSOR for your BDC_OKCODE = '=P+'.

    Try placing the cursor for the okcode page down.

    Regards

    Mishra

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 26, 2011 at 07: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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    Aug 26, 2011 at 09: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 26, 2011 at 11:51 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 26, 2011 at 12: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

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 30, 2011 at 10: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.
    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 06, 2013 at 05: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

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 13, 2013 at 12:31 PM

    hi

    i am also facing same problem  ...

    may i know the sloution for this...

    many thanks

    Add comment
    10|10000 characters needed characters exceeded