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

fields grouped by LIFNR

Former Member
0 Likes
835

Hi experts!!

i am getting a structure as export parameter when i process a FM and this structure consists of some fields. After this i want to group these fields grouped by LIFNR and display out put. Please let me know how to group the content of the internal table fields grouped by lifnr.

Please help me with the code.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
792

Hi,

I suppose that you are getting the data as a internal table from the tables parameter, why dont you simply sort the table by vendor (lifnr) and then display, sorting would group your lines based on lifnr.

Regards,

Himanshu

Hi experts!!

i am getting a structure as export parameter when i process a FM and this structure consists of some fields. After this i want to group these fields grouped by LIFNR and display out put. Please let me know how to group the content of the internal table fields grouped by lifnr.

Please help me with the code.

3 REPLIES 3
Read only

Former Member
0 Likes
793

Hi,

I suppose that you are getting the data as a internal table from the tables parameter, why dont you simply sort the table by vendor (lifnr) and then display, sorting would group your lines based on lifnr.

Regards,

Himanshu

Read only

Former Member
0 Likes
792

sort itab by lifnr.

Read only

0 Likes
792

Hello,

Group by functionality is only avaliable for ABAP SQL's and not for internal table but you can use AT..ENDAT statement in

LOOP AT ITAB...ENDLOOP to simulate the group by functionality.

Following are the various options available:

LOOP AT <itab>.

AT FIRST. ... ENDAT.

AT NEW <f1>. ...... ENDAT.

AT NEW <f2 >. ...... ENDAT.

.......

<single line processing>

.......

AT END OF <f2>. ... ENDAT.

AT END OF <f1>. ... ENDAT.

AT LAST. .... ENDAT.

ENDLOOP.

For more information youn can refer to following link:

http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb381a358411d1829f0000e829fbfe/content.htm

Also, for other aggregate function like min, max, sum you need to do processing using LOOP AT <ITAB>...ENDLOOP

No standard commands are avaliable in SAP ABAP for above functions.

Thanks,

Prashant