Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

internal table looping

Former Member
0 Kudos

Dear Experts,

i'm using this code for my report, in development its working but in prd its not wrkng., sy-tabix value is 1 indev., but in prd its zero., is there any other way to do this., kindly help on this issue, in this report i will have only one line item.,.,


  LOOP AT it_regup INTO wa_regup.

    READ TABLE it_lfa1  INTO wa_lfa1 INDEX sy-tabix.
    READ TABLE it_lfbk  INTO wa_lfbk INDEX  sy-tabix.
    READ TABLE it_bseg  INTO wa_bseg INDEX sy-tabix.
    READ TABLE it       INTO wa      INDEX sy-tabix.
    READ TABLE it_bkpf  INTO wa_bkpf INDEX sy-tabix.
    READ TABLE it_bnka  INTO wa_bnka INDEX sy-tabix.
    READ TABLE it_reguh INTO wa_reguh INDEX  sy-tabix.

   if wa_reguh-rbetr > 0.
      wa_final_1-rbetr = wa_reguh-rbetr * 1.
      ELSEIF
        wa_reguh-rbetr < 0.
        wa_final_1-rbetr = wa_reguh-rbetr * -1.
        endif.
    wa_final_1-t_null   = ''.
    wa_final_1-t_null_n = 'N'.
    wa_final_1-T_NULL10 = 'NEFT'.
    wa_final_1-smtp_addr = wa-smtp_addr.
    wa_final_1-bankn = wa_lfbk-bankn.  "BENEFICIARY ACCOUNT NUMBER.
    wa_final_1-bkref = wa_lfbk-bkref. "ifsc code
    wa_final_1-blart = wa_bkpf-blart. "for transaction type
    wa_final_1-wrbtr = wa_bseg-wrbtr. "INSTRUMENT NUMBER.
    wa_final_1-sgtxt = wa_bseg-sgtxt. "for payment details 1.
    wa_final_1-name1 = wa_lfa1-name1.  "BENEFIT NAME
    wa_final_1-xref1 = wa_bseg-xref1. "DRAWEE LOCATION
    wa_final_1-xref2 = wa_bseg-xref2. "PRINT LOCATION
    wa_final_1-vblnr = wa_regup-vblnr. "instruction recference number
    wa_final_1-xblnr = wa_regup-xblnr. "customer reference number
    wa_final_1-budat = wa_bkpf-budat.
    wa_final_1-banka = wa_bnka-banka.
    wa_final_1-bkont = wa_lfbk-bkont. "bene bank branch name
    wa_final_1-dmbtr = lv_variable.
    APPEND wa_final_1 TO it_final_1.
    CLEAR : wa_final_1.
    clear : lv_variable.

  ENDLOOP.

.

Thanks and regards,

Thirukumaran. R

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Try this


DATA:
  v_tabix TYPE SYTABIX
  .

LOOP AT it_regup INTO wa_regup.
 
    " VVVV CHANGE HERE
    v_tabix = SY-TABIX .

    " VVV CHANGE each of these.
    READ TABLE it_lfa1  INTO wa_lfa1 INDEX v_tabix.
    READ TABLE it_lfbk  INTO wa_lfbk INDEX  v_tabix.
    READ TABLE it_bseg  INTO wa_bseg INDEX v_tabix.
    READ TABLE it       INTO wa      INDEX sy-v_tabix.
    READ TABLE it_bkpf  INTO wa_bkpf INDEX v_tabix.
    READ TABLE it_bnka  INTO wa_bnka INDEX v_tabix.
    READ TABLE it_reguh INTO wa_reguh INDEX  v_tabix.
 
   if wa_reguh-rbetr > 0.
      wa_final_1-rbetr = wa_reguh-rbetr * 1.
      ELSEIF
        wa_reguh-rbetr < 0.
        wa_final_1-rbetr = wa_reguh-rbetr * -1.
        endif.
    wa_final_1-t_null   = ''.
    wa_final_1-t_null_n = 'N'.
    wa_final_1-T_NULL10 = 'NEFT'.
    wa_final_1-smtp_addr = wa-smtp_addr.
    wa_final_1-bankn = wa_lfbk-bankn.  "BENEFICIARY ACCOUNT NUMBER.
    wa_final_1-bkref = wa_lfbk-bkref. "ifsc code
    wa_final_1-blart = wa_bkpf-blart. "for transaction type
    wa_final_1-wrbtr = wa_bseg-wrbtr. "INSTRUMENT NUMBER.
    wa_final_1-sgtxt = wa_bseg-sgtxt. "for payment details 1.
    wa_final_1-name1 = wa_lfa1-name1.  "BENEFIT NAME
    wa_final_1-xref1 = wa_bseg-xref1. "DRAWEE LOCATION
    wa_final_1-xref2 = wa_bseg-xref2. "PRINT LOCATION
    wa_final_1-vblnr = wa_regup-vblnr. "instruction recference number
    wa_final_1-xblnr = wa_regup-xblnr. "customer reference number
    wa_final_1-budat = wa_bkpf-budat.
    wa_final_1-banka = wa_bnka-banka.
    wa_final_1-bkont = wa_lfbk-bkont. "bene bank branch name
    wa_final_1-dmbtr = lv_variable.
    APPEND wa_final_1 TO it_final_1.
    CLEAR : wa_final_1.
    clear : lv_variable.
 
  ENDLOOP.

This method had solved the problem for me before.

If this is not the problem you are talking about, please expand.

Thank you,

Steven Coolbaugh

Edited by: Steven Coolbaugh on Sep 4, 2009 11:37 PM

Edited by: Steven Coolbaugh on Sep 4, 2009 11:52 PM

6 REPLIES 6

ThomasZloch
Active Contributor
0 Kudos

Looking at the code inside the loop, it might be some sort of self-defense mechanism of the production environment.

Thomas

Former Member
0 Kudos

Why don't you debug the program and see what the value of sy-tabix after:

1) Entering the loop

2) Each READ

I think you'll find that it changes and you don't get the result you want.

Or maybe Thomas is right

Rob

Edited by: Rob Burbank on Sep 4, 2009 10:21 AM

Former Member
0 Kudos

Hi thirukumaran rajendran ,

Check the data in the tables where the information is being taken into production to fill the internal table it_regup apparently be empty.

Or try doing the readings to internal tables using With Key.

LOOP AT it_regup INTO wa_regup.

READ TABLE it_lfa1 INTO wa_lfa1 WITH KEY field = wa_regup-field .

Hope this information is help to you.

Regards,

José

Former Member
0 Kudos

Try this


DATA:
  v_tabix TYPE SYTABIX
  .

LOOP AT it_regup INTO wa_regup.
 
    " VVVV CHANGE HERE
    v_tabix = SY-TABIX .

    " VVV CHANGE each of these.
    READ TABLE it_lfa1  INTO wa_lfa1 INDEX v_tabix.
    READ TABLE it_lfbk  INTO wa_lfbk INDEX  v_tabix.
    READ TABLE it_bseg  INTO wa_bseg INDEX v_tabix.
    READ TABLE it       INTO wa      INDEX sy-v_tabix.
    READ TABLE it_bkpf  INTO wa_bkpf INDEX v_tabix.
    READ TABLE it_bnka  INTO wa_bnka INDEX v_tabix.
    READ TABLE it_reguh INTO wa_reguh INDEX  v_tabix.
 
   if wa_reguh-rbetr > 0.
      wa_final_1-rbetr = wa_reguh-rbetr * 1.
      ELSEIF
        wa_reguh-rbetr < 0.
        wa_final_1-rbetr = wa_reguh-rbetr * -1.
        endif.
    wa_final_1-t_null   = ''.
    wa_final_1-t_null_n = 'N'.
    wa_final_1-T_NULL10 = 'NEFT'.
    wa_final_1-smtp_addr = wa-smtp_addr.
    wa_final_1-bankn = wa_lfbk-bankn.  "BENEFICIARY ACCOUNT NUMBER.
    wa_final_1-bkref = wa_lfbk-bkref. "ifsc code
    wa_final_1-blart = wa_bkpf-blart. "for transaction type
    wa_final_1-wrbtr = wa_bseg-wrbtr. "INSTRUMENT NUMBER.
    wa_final_1-sgtxt = wa_bseg-sgtxt. "for payment details 1.
    wa_final_1-name1 = wa_lfa1-name1.  "BENEFIT NAME
    wa_final_1-xref1 = wa_bseg-xref1. "DRAWEE LOCATION
    wa_final_1-xref2 = wa_bseg-xref2. "PRINT LOCATION
    wa_final_1-vblnr = wa_regup-vblnr. "instruction recference number
    wa_final_1-xblnr = wa_regup-xblnr. "customer reference number
    wa_final_1-budat = wa_bkpf-budat.
    wa_final_1-banka = wa_bnka-banka.
    wa_final_1-bkont = wa_lfbk-bkont. "bene bank branch name
    wa_final_1-dmbtr = lv_variable.
    APPEND wa_final_1 TO it_final_1.
    CLEAR : wa_final_1.
    clear : lv_variable.
 
  ENDLOOP.

This method had solved the problem for me before.

If this is not the problem you are talking about, please expand.

Thank you,

Steven Coolbaugh

Edited by: Steven Coolbaugh on Sep 4, 2009 11:37 PM

Edited by: Steven Coolbaugh on Sep 4, 2009 11:52 PM

Former Member
0 Kudos

Hi,

use this method this will surely resolve ur issue....

data w_tabix type sy-tabix.
 LOOP AT it_regup INTO wa_regup.
   
  w_tabix = sy-tabix.
    READ TABLE it_lfa1  INTO wa_lfa1 INDEX w_tabix.
    if sy-subrc = 0.
      w_tabix = sy-tabix.
      READ TABLE it_lfbk  INTO wa_lfbk INDEX  w_tabix.
      if sy-subrc = 0.
        w_tabix = sy-tabix.
        READ TABLE it_bseg  INTO wa_bseg INDEX w_tabix.
        if sy-subrc = 0.
          w_tabix = sy-tabix.
          READ TABLE it       INTO wa      INDEX w_tabix.
          if sy-subrc = 0.
            w_tabix = sy-tabix.
            READ TABLE it_bkpf  INTO wa_bkpf INDEX w_tabix.
            if sy-subrc = 0.
              w_tabix = sy-tabix.
              READ TABLE it_bnka  INTO wa_bnka INDEX w_tabix.
              if sy-subrc = 0.
                w_tabix = sy-tabix.
                READ TABLE it_reguh INTO wa_reguh INDEX  w_tabix.
              endif.
            endif.
          endif.
       endif.
    endif.
  endif

Regards,

Siddarth

0 Kudos

>

> Hi,

>

>

> use this method this will surely resolve ur issue....

>

>

data w_tabix type sy-tabix.
>  LOOP AT it_regup INTO wa_regup.
>    
>   w_tabix = sy-tabix.
>     READ TABLE it_lfa1  INTO wa_lfa1 INDEX w_tabix.
>     if sy-subrc = 0.
>       w_tabix = sy-tabix.
>       READ TABLE it_lfbk  INTO wa_lfbk INDEX  w_tabix.
>       if sy-subrc = 0.
>         w_tabix = sy-tabix.
>         READ TABLE it_bseg  INTO wa_bseg INDEX w_tabix.
>         if sy-subrc = 0.
>           w_tabix = sy-tabix.
>           READ TABLE it       INTO wa      INDEX w_tabix.
>           if sy-subrc = 0.
>             w_tabix = sy-tabix.
>             READ TABLE it_bkpf  INTO wa_bkpf INDEX w_tabix.
>             if sy-subrc = 0.
>               w_tabix = sy-tabix.
>               READ TABLE it_bnka  INTO wa_bnka INDEX w_tabix.
>               if sy-subrc = 0.
>                 w_tabix = sy-tabix.
>                 READ TABLE it_reguh INTO wa_reguh INDEX  w_tabix.
>               endif.
>             endif.
>           endif.
>        endif.
>     endif.
>   endif

>

> Regards,

> Siddarth

That's different logic and may not return all that's needed.

Rob

Rob