Application Development and Automation 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: 
Read only

modify

Former Member
0 Likes
458
data: wa_compalz  like line of out_cif_compalz.

 loop at t_ppm.
    l_tabix = sy-tabix.
    read table out_cif_compalz into wa_compalz with key logcomp = t_ppm-logcomp.
    if sy-subrc eq 0.
*    if wa_compalz-logcomp eq t_ppm-logcomp.
      t_ppm-matnr = wa_compalz-matnr_alt.
      modify t_ppm index l_tabix.
    endif.
    select single zzacronym into l_acronym from
           zmchar where zzmatnr = t_ppm-matnr.
    if sy-subrc eq 0.
      select single zzmatnr into lv_matnr
      from zmchar where zzacronym = l_acronym
      and zzpkgtypds = 'FNG'.
      if sy-subrc eq 0.
        wa_compalz-matnr_alt = lv_matnr.
        modify out_cif_compalz  from wa_compalz transporting
matnr_alt.
        clear lv_matnr.
        clear l_acronym.
      endif.
    endif.
  endloop.

In the above code I am trying to modify the matnr of some entries to table out_cif_compalz and ending up with error.

Please let me know how to fix it .

2 REPLIES 2
Read only

Former Member
0 Likes
430

HI,

Take the index after read stament and use that in your second modify statement.

data: wa_compalz like line of out_cif_compalz.

<b> data : lv_tabix like sy-tabix.</b>

loop at t_ppm.

l_tabix = sy-tabix.

read table out_cif_compalz into wa_compalz with key logcomp = t_ppm-logcomp.

if sy-subrc eq 0.

<b> lv_tabix = sy-tabix.</b>

  • if wa_compalz-logcomp eq t_ppm-logcomp.

t_ppm-matnr = wa_compalz-matnr_alt.

modify t_ppm index l_tabix.

endif.

select single zzacronym into l_acronym from

zmchar where zzmatnr = t_ppm-matnr.

if sy-subrc eq 0.

select single zzmatnr into lv_matnr

from zmchar where zzacronym = l_acronym

and zzpkgtypds = 'FNG'.

if sy-subrc eq 0.

wa_compalz-matnr_alt = lv_matnr.

modify out_cif_compalz from wa_compalz <b>index lv_tabix</b> transporting

matnr_alt.

clear lv_matnr.

clear l_acronym.

endif.

endif.

endif.

endloop

Thanks

Mahesh

Read only

former_member194669
Active Contributor
0 Likes
430

Hi,


data: wa_compalz  like line of out_cif_compalz.
data: v_tabix like sy-tabix."<<<  Check this
 
loop at t_ppm.
    l_tabix = sy-tabix.
    read table out_cif_compalz into wa_compalz with key logcomp = t_ppm-logcomp.
    if sy-subrc eq 0.
     v_tabix = sy-tabix.
     t_ppm-matnr = wa_compalz-matnr_alt.
     modify t_ppm index l_tabix.
     select single zzacronym into l_acronym from
           zmchar where zzmatnr = t_ppm-matnr.
     if sy-subrc eq 0.
       select single zzmatnr into lv_matnr
         from zmchar where zzacronym = l_acronym
              and zzpkgtypds = 'FNG'.
       if sy-subrc eq 0.
         wa_compalz-matnr_alt = lv_matnr.
         modify out_cif_compalz  from wa_compalz index v_tabix transporting matnr_alt.
          "<<< check above line 
         clear lv_matnr.
         clear l_acronym.
       endif.
     endif.
    endif    "<<<<<<<<<<<
endloop.
                  

aRs