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

Logic to segregate a field

Former Member
0 Likes
1,862

Hi everyone,

I am stuck in a requirement wherein I need to segregate a field base on some values. w is The screenshot of what my debugger is below:

The fields are from table AUSP. My requirement is that I have to concatenate the values of ATWRT for recurring values of ATINN (as highlighted above) and display the remaining values of ATWRT for non recurring values of ATINN. The output of the above table should be like below:

Just like for the 9 series above , the same goes for the rest of the series as well. So for the 12 series it will be like :

Can anyone please help me out with the logic for the above ?

Regards,

Manish

6 REPLIES 6
Read only

DoanManhQuynh
Active Contributor
0 Likes
1,749

as your description I suppose that you want to group data base on OBJEK and ATINN.

i think below logic should be work ( dont have system right now to check so you can base on this ideal to check yourself):

loop at itab into wa_source 
     group by ( objek = wa_source-objek atinn = wa_source-atinn )
     into wa_key.
  append wa_source to final_itab
         assigning field-symbols(<fs>). " here we have the group 
  loop at group wa_key into wa_mem.
    <fs>-atwrt = |{ <fs>-atwrt },{wa_mem-atwrt}|." here we concatente atwrt
  endloop.
endloop.

Read only

0 Likes
1,749

Hi,

Sorry but I am not able to understand your code. Can you tell me what is wa_key and wa_mem ? Also can u do it using a work area instead of field symbol ?

Read only

matt
Active Contributor
0 Likes
1,749

Have you tried reading the ABAP documentation?

Read only

1,749

im using GROUP BY in internal table to achive your goal, you should copy the source code to your system and check. its ok to do it using work area, you can try the old technical AT END to concatenate data and append it to one temporary table, its simply logic thinking not something complicate.

Read only

0 Likes
1,749

Thanks Quynh, I got the result using AT END OF. 🙂

Read only

matt
Active Contributor
0 Likes
1,749

Question already posted here: https://answers.sap.com/questions/622149/divide-a-field-into-3-different-fields.html

This question is closed. I've reopened the other one.

Please ask questions once and once only. If they need bumping up, you can add a comment.

Matt Billingham - Community Moderator