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: 

Problem in At new

former_member342013
Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

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

Regards,

Sunny Desai

Former Member
0 Kudos

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?

0 Kudos

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.

0 Kudos
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.

Former Member
0 Kudos

hI,

Plse check by moving the MODIFY statement before ENDAT.

Regards,

Rajeswari

Former Member
0 Kudos

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