Skip to Content
author's profile photo Former Member
Former Member

Problem while incrementing the index

Hi Friends,

I am working on creating Credit memos and return orders through BDC. For the item level, I am incrementing the index in order to enter the MATNR, POSNR, KWMENG etc. I have seven lines open in my screen. So when I have an order greater than or equal to seven lines, the program is showing an error that that line does not exist in the screen. Please, let me know what is the solution for this.

Thanks,

Raj

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Mar 24, 2006 at 04:49 PM

    Hi, as Srinivas post before that should work, I just edited some lines, I guess was just mistyped.

    idx = 01.

    LOOP AT itabi WHERE ihrez = itabh-ihrez.

    PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

    • PERFORM bdc_field USING 'BDC_OKCODE' '=POAN'.

    CONCATENATE 'VBAP-ABGRU(' idx ')' INTO fnam.

    PERFORM bdc_field USING 'BDC_CURSOR' fnam.

    CONCATENATE 'RV45A-MABNR(' idx ')' INTO fnam.

    PERFORM bdc_field USING fnam itabi-mabnr.

    CONCATENATE 'VBAP-ZMENG(' idx ')' INTO fnam.

    PERFORM bdc_field USING fnam itabi-zmeng.

    CONCATENATE 'VBAP-POSNR(' idx ')' INTO fnam.

    PERFORM bdc_field USING fnam itabi-posnr.

    CONCATENATE 'VBAP-ABGRU(' idx ')' INTO fnam.

    PERFORM bdc_field USING fnam 'Z2'.

    PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

    PERFORM bdc_field USING 'BDC_OKCODE' '=PKO1'.

    CONCATENATE 'VBAP-POSNR(' idx ')' INTO fnam.

    PERFORM bdc_field USING 'BDC_CURSOR' fnam.

    PERFORM bdc_dynpro USING 'SAPMV45A' '5003'.

    PERFORM bdc_field USING 'BDC_OKCODE' '/00'.

    PERFORM bdc_field USING 'BDC_CURSOR' 'KOMV-KSCHL(01)'.

    PERFORM bdc_dynpro USING 'SAPMV45A' '5003'.

    PERFORM bdc_field USING 'BDC_OKCODE' '=V69A_KOAN'.

    PERFORM bdc_field USING 'BDC_CURSOR' 'KOMV-KSCHL(01)'.

    PERFORM bdc_dynpro USING 'SAPMV45A' '5003'.

    PERFORM bdc_field USING 'BDC_OKCODE' '/00'.

    PERFORM bdc_field USING 'BDC_CURSOR' 'KOMV-KWERT(07)'.

    PERFORM bdc_field USING 'KOMV-KSCHL(02)' 'ZPR0'.

    PERFORM bdc_field USING 'KOMV-KBETR(02)' itabi-kbetr1.

    PERFORM bdc_field USING 'KOMV-KSCHL(03)' 'ZPRS'.

    PERFORM bdc_field USING 'KOMV-KBETR(03)' itabi-kbetr2.

    PERFORM bdc_field USING 'KOMV-KSCHL(04)' 'ZR1'.

    PERFORM bdc_field USING 'KOMV-KWERT(04)' itabi-kwert1.

    PERFORM bdc_field USING 'KOMV-KSCHL(05)' 'ZLWR'.

    PERFORM bdc_field USING 'KOMV-KWERT(05)' itabi-kwert2.

    PERFORM bdc_field USING 'KOMV-KSCHL(06)' 'ZLDL'.

    PERFORM bdc_field USING 'KOMV-KWERT(06)' itabi-kwert3.

    PERFORM bdc_field USING 'KOMV-KSCHL(07)' 'ZLFB'.

    PERFORM bdc_field USING 'KOMV-KWERT(07)' itabi-kwert4.

    • perform bdc_field using 'KOMV-KSCHL(08)'

    • 'ZLBD'.

    • perform bdc_field using 'KOMV-KWERT(08)'

    • '0.00'.

    PERFORM bdc_dynpro USING 'SAPMV45A' '5003'.

    PERFORM bdc_field USING 'BDC_OKCODE' '=T\13'.

    PERFORM bdc_dynpro USING 'SAPMV45A' '4003'.

    PERFORM bdc_field USING 'BDC_OKCODE' '/EBACK'.

    PERFORM bdc_field USING 'BDC_CURSOR' 'VBAP-ZZRFAR'.

    PERFORM bdc_field USING 'VBAP-ZZRWAR' itabi-wcd.

    PERFORM bdc_field USING 'VBAP-ZZRFAR' itabi-fcd.

    <b>IF idx >= 2.</b>

    *-- from third line onwards start doing '+'

    PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

    PERFORM bdc_field USING 'BDC_OKCODE' '=POAN'.

    <b>idx = 1.</b>

    ELSE.

    *-- this will increment it to 2 and then the IF will takeover

    idx = idx + 1.

    ENDIF.

    ENDLOOP.

    PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

    PERFORM bdc_field USING 'BDC_OKCODE''=SICH'.

    Another way to do this is, usually the way I go, is to just execute the next two lines for every incoming line:

    PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

    PERFORM bdc_field USING 'BDC_OKCODE' '=POAN'.

    Hope it Helps.

    Regards,

    Gilberto Li

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 24, 2006 at 03:23 PM

    I believe that when you get to that point, you will need to fire a page down in the OKCODE. I think maybe P+ may work. I have seen many posts that cover this. I usually try to stay away from doing this kind of thing with table controls in BDC, are you sure there is not a BAPI or function module that will work for you?

    BDC: How to enter data in Table control (With wizard) using scrolling?

    Regard,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

    • If it is the 2nd line, something like this should work.

      idx = 01.
      LOOP AT itabi WHERE ihrez = itabh-ihrez.
        PERFORM bdc_dynpro USING 'SAPMV45A'   '4001'.
      <b>*  PERFORM bdc_field  USING 'BDC_OKCODE' '=POAN'.</b>
        CONCATENATE 'VBAP-ABGRU(' idx ')' INTO fnam.
        PERFORM bdc_field  USING 'BDC_CURSOR' fnam.
        CONCATENATE 'RV45A-MABNR(' idx ')' INTO fnam.
        PERFORM bdc_field  USING fnam         itabi-mabnr.
        CONCATENATE 'VBAP-ZMENG(' idx ')' INTO fnam.
        PERFORM bdc_field  USING fnam         itabi-zmeng.
        CONCATENATE 'VBAP-POSNR(' idx ')' INTO fnam.
        PERFORM bdc_field  USING fnam         itabi-posnr.
        CONCATENATE 'VBAP-ABGRU(' idx ')' INTO fnam.
        PERFORM bdc_field  USING fnam         'Z2'.
      
        PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
        PERFORM bdc_field USING 'BDC_OKCODE' '=PKO1'.
        CONCATENATE 'VBAP-POSNR(' idx ')' INTO fnam.
        PERFORM bdc_field USING 'BDC_CURSOR' fnam.
      
        PERFORM bdc_dynpro USING 'SAPMV45A' '5003'.
        PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
        PERFORM bdc_field USING 'BDC_CURSOR' 'KOMV-KSCHL(01)'.
      
        PERFORM bdc_dynpro USING 'SAPMV45A' '5003'.
        PERFORM bdc_field USING 'BDC_OKCODE' '=V69A_KOAN'.
        PERFORM bdc_field USING 'BDC_CURSOR' 'KOMV-KSCHL(01)'.
      
        PERFORM bdc_dynpro USING 'SAPMV45A' '5003'.
        PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
        PERFORM bdc_field USING 'BDC_CURSOR' 'KOMV-KWERT(07)'.
      
        PERFORM bdc_field USING 'KOMV-KSCHL(02)' 'ZPR0'.
        PERFORM bdc_field USING 'KOMV-KBETR(02)' itabi-kbetr1.
        PERFORM bdc_field USING 'KOMV-KSCHL(03)' 'ZPRS'.
        PERFORM bdc_field USING 'KOMV-KBETR(03)' itabi-kbetr2.
        PERFORM bdc_field USING 'KOMV-KSCHL(04)' 'ZR1'.
        PERFORM bdc_field USING 'KOMV-KWERT(04)' itabi-kwert1.
        PERFORM bdc_field USING 'KOMV-KSCHL(05)' 'ZLWR'.
        PERFORM bdc_field USING 'KOMV-KWERT(05)' itabi-kwert2.
        PERFORM bdc_field USING 'KOMV-KSCHL(06)' 'ZLDL'.
        PERFORM bdc_field USING 'KOMV-KWERT(06)' itabi-kwert3.
        PERFORM bdc_field USING 'KOMV-KSCHL(07)' 'ZLFB'.
        PERFORM bdc_field USING 'KOMV-KWERT(07)' itabi-kwert4.
      * perform bdc_field using 'KOMV-KSCHL(08)'
      * 'ZLBD'.
      * perform bdc_field using 'KOMV-KWERT(08)'
      * '0.00'.
      
        PERFORM bdc_dynpro USING 'SAPMV45A' '5003'.
        PERFORM bdc_field USING 'BDC_OKCODE'  '=T13'.
      
        PERFORM bdc_dynpro USING 'SAPMV45A' '4003'.
        PERFORM bdc_field USING 'BDC_OKCODE'  '/EBACK'.
        PERFORM bdc_field USING 'BDC_CURSOR'  'VBAP-ZZRFAR'.
        PERFORM bdc_field USING 'VBAP-ZZRWAR'  itabi-wcd.
        PERFORM bdc_field USING 'VBAP-ZZRFAR'  itabi-fcd.
      <b>  IF sy-tabix >= 2.
      *-- from third line onwards start doing '+'
          PERFORM bdc_dynpro USING 'SAPMV45A'   '4001'.
          PERFORM bdc_field  USING 'BDC_OKCODE' '=POAN'.
        ELSE.
      *-- this will increment it to 2 and then the IF will takeover
          idx = idx + 1.
        ENDIF.</b>
      ENDLOOP.
      
      PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
      PERFORM bdc_field USING 'BDC_OKCODE''=SICH'.

  • Posted on Mar 24, 2006 at 04:28 PM

    Hi Raj,

    Please try to code BDC_OKCODE = '/00' after looping 7 times. It should open next 7th line items.

    Hope this will help.

    Regards,

    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.