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

Problem in At new

Former Member
0 Likes
855

Hi

i have written below code

CLEAR : wa_final.

LOOP AT it_final INTO wa1_final.

idx1 = sy-tabix.

at new LICNO.

CLEAR : vcount.

ENDAT.

vcount = vcount + 1.

wa1_final-NOM = wa_final-NOM.

modify it_final FROM wa1_final INDEX idx1.

ENDLOOP.

my requirement is

if i have 3 same "NICNO" then NOM should be displayed only once

EG :

NICNO          NOM
1               M1
1
1
2               M2
3               M3

what is wrong in my above code ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
816

What does the work area wa_final contain? Also what is the use of the counter here? Does it have anything to do with the question here?

What does the work area wa_final contain? Also what is the use of the counter here? Does it have anything to do with the question here?

6 REPLIES 6
Read only

Former Member
0 Likes
816

Hi,

Sort your table by LICNO first before looping into the table.

Regards,

Sunny Desai

Read only

Former Member
0 Likes
817

What does the work area wa_final contain? Also what is the use of the counter here? Does it have anything to do with the question here?

Read only

0 Likes
816

Hi

Sorry

the code goes like this

CLEAR : wa_final.
      LOOP AT it_final INTO wa_final.
        idx1 = sy-tabix.
        at new LICNO.
          CLEAR : vcount.
          ENDAT.
       vcount = vcount + 1.
       wa1_final-NOM = wa_final-NOM.


 modify it_final FROM wa1_final INDEX idx1.

Read only

0 Likes
816
CLEAR : wa_final.
 LOOP AT it_final INTO wa_final.
        idx1 = sy-tabix.
        at new LICNO.
          CLEAR : vcount.
        ENDAT.
        
       vcount = vcount + 1.
 
      if vcount gt 1
       clear wa_final-NOM.
      endif.
 
       modify it_final FROM wa_final INDEX idx1.
ENDLOOP.
Read only

Former Member
0 Likes
816

hI,

Plse check by moving the MODIFY statement before ENDAT.

Regards,

Rajeswari

Read only

Former Member
0 Likes
816

Try Below code.

data : m_nom type nom.
CLEAR : wa_final.
m_nom = ' '.
LOOP AT it_final INTO wa1_final.
idx1 = sy-tabix.
move-corresponding wa1_final to wa_final.
if m_non = wa1_final-nom
 wa_final-nom = ' '.
 modify it_final from wa_final index idx1.
endif.
m_nom = wa1_final-nom.
endloop.

Regards

Vinod

Edited by: Vinod Kumar on Apr 9, 2010 5:06 PM