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: 

How to display two movement type for same PO no.in same row in alv grid.

Former Member
0 Kudos

Hi All

      I have one PO no suppose 1812006400 which have 2 movement type(BWART) suppose 101 & 351 i want to show the both movement

type in one row.now in my case its showing two different row.i made 1 seperate column in final internal table i.e. movement type2.Plz help us.

      Kindly see attachment..

4 REPLIES 4

VijayaKrishnaG
Active Contributor
0 Kudos

Hi Shinde,

Instead of showing both the movement types in same row, sort the fields PO Number, PO Date and PO Type in ALV Grid.

This functionality should be added to the grid before displaying it.

If you have built with function modules, you have add this feature in Field Catalog or else if you have used Classes you have to call method ADD_SORT of class CL_SALV_SORTS.

Regards,

Vijay

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Samadhan,

Try the following code for merging the Movement type into single row using Control Break statements(AT END OF...AT END).


"Sort the internal table based on PO Number and movement type

    SORT IT_TABLE BY PO_NUMBER BWART.

"Process the LOOP.

   LOOP AT IT_TABLE INTO WA_FINAL.

     WA_FINAL-PO_NUMBER = WA_TABLE-PO_NUMBER.

 

     "Merge Movement type

     IF WA_FINAL-BWART IS INITIAL. 

      WA_FINAL-BWART = WA_TABLE-BWART.

     ELSE.

     CONCATENATE WA_FINAL-BWART '/' WA_TABLE-BWART INTO WA_FINAL-BWART.

     ENDIF.

     AT END OF PO_NUMBER

      FLAT_END = 1.

     ENDAT.

   

     IF FLAG_END = 1.

      APPEND WA_FINAL TO IT_FINAL.

      CLEAR: WA_FINAL,

                   FLAG_END.

     ENDIF.

    ENDLOOP.

Regards

Rajkumar Narasimman

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

IMHO what you did is better.

But if you have to sum maybe you need to create extra quantity , amount fields .

If you decide on the one line solution you can use the "RENAMING WITH SUFFIX suffix" to include the same structure more the once.

See

Regards.

raymond_giuseppi
Active Contributor
0 Kudos

If you cannot get more than 2 movement types (repair in DIMP ?) define a final table with duplicated (and renamed/suffix) columns, and sort the first itab and fill the new easily in a loop with {AT NEW init final/count/map/AT END} append logic. (I suppose sort/group with EKPO-EBELN/EBLP + MSEG-MBLNR/MJAHR)

Else read once the extracted table to identify max number of movements, build a dynamic table with PO fields and n x Movement fields suffixed and fill it the same way (add some ASSIGN statement)

Regards,

Raymond