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

Sample code for this!!

Former Member
0 Likes
619

Hi all! Plz go through this!! Hope you understood this

material no item no description

1 10 abc

1 80 cde

1 35 fgh

1 50 ijk

1 95 lmn

2 52 xyz

Now for the same material we have to concatenate the description only for the least 3 of the item no(10,35,50) how to write a code for this?

Plz send me to emadduri@gmail.com

4 REPLIES 4
Read only

Former Member
0 Likes
588

hi Madhuri,

first collect the least item numbers in to variables and then proceed with concatenation ...

i.e,

sort itab-item ascending.

collect the first 3 values in to variables and use

concatenate statement.

Regards,

Santosh

Read only

Former Member
0 Likes
588

hi

data: text(200) type c.

sort i_tab by item.

loop at i_tab.

if sy-tabix = 0.

move i_tab-desc to text.

elseif sy-tabix < 3.

concatenate i_tab-desc text

into text

seperated by sapce.

endif.

endloop.

Read only

Former Member
0 Likes
588

sort itab by matnr item.

loop at itab.

lv_tabix = sy-tabix.

at new matnr.

read itab index lv_tabix.

loop at itab where matnr = itab-matnr.

if count < 3.

count = count + 1.

concatenate desc itab-desc into desc separated by space.

else.

clear count.

clear desc.

exit.

endif.

itab_new-matnr = itab-matnr.

itab_new-desc = desc.

append itab_new.

clear itab_new.

endloop.

endat.

endloop.

Regards,

Ravi

Read only

Former Member
0 Likes
588

Hi,

sort itab by mat_no item_no.


loop at itab.

  at new mat_no.
    count = 1.
    if wa_temp is not initial.
       append wa_temp into Itab_new.
    endif.
  endat.

  if count le 3.
   wa_temp-mat_no = itab-mat_no.
   
   concatenate wa_temp-desc itab-desc
   into wa_temp-desc
   seperated by space.
 endif.


endloop.