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

alv grid

Former Member
0 Likes
2,444

Hello Experts,

please help me to create this layout in alv grid display .

Item no.

Material no

quantity

Delivery date

Purchase  requisition 1000001

10

11111616

12

12/06/2013

20

67678688

11

12/06/2013

Purchase  requisition 1000002

10

56464646

3

12/04/2013

Purchase  requisition 1000003

30

45521514

6

12/06/2013

40

87975451

9

8/05/2013

what code i have to use here for purchase requisition only .

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,386

If it is ok to have the purchase requisition as the summary after all line items, then you can do it using the normal reuse_alv_grid_display FM

Just make the Purchase requisition in the field catalog no_out attribute = 'X'. And give the text for purchase requsition 'Purchase Requisition'.

lv_pos = lv_pos + 1.
   CLEAR gw_alv_fieldcat.
   gw_alv_fieldcat-fieldname = 'EBELN'.
   gw_alv_fieldcat-tabname   = 'IT_TAB'.
   gw_alv_fieldcat-seltext_l = 'Purchase Requisition'.
   gw_alv_fieldcat-col_pos   = lv_pos.
   gw_alv_fieldcat-outputlen = 7.
   gw_alv_fieldcat-no_out = 'X'.
   gw_alv_fieldcat-key = 'X'.
   APPEND gw_alv_fieldcat TO gt_alv_fieldcat.

Include ALV sort table to sort the table by purchase requisition field.

   wa_sort-spos = '01' .
   wa_sort-fieldname = 'EBELN'.
   wa_sort-tabname = 'IT_ITAB'.
   wa_sort-up = 'X'.
   wa_sort-subtot = 'X'.
   APPEND wa_sort TO i_sort .

Would this be fine? 🙂

11 REPLIES 11
Read only

aferngas
Active Participant
0 Likes
2,386

Hi,

Unfortunately ALV Grid doesn't allow different types of lines. This layout can only be created with the old write-style REUSE_ALV_HIERSEQ_LIST_DISPLAY. Also you can use the ALV Tree but it isn't exactly the same layout.

Regards,

Alex

Read only

Former Member
0 Likes
2,386

thank you alex ,

i am new to abap but if you look into ME5A (in alv mode) report it will show you the same output as i shown you . after debugging the whole   report i haven't seen REUSE_ALV_HIERSEQ_LIST_DISPLAY or alv tree .

is there any other way or method to do this ?




Read only

Former Member
0 Likes
2,386

The function used there is REUSE_ALV_GRID_DISPLAY_LVC

Read only

0 Likes
2,386

Please check ME5A and try to adapt the same logic. Check in debugging how it is doing it

Read only

aferngas
Active Participant
0 Likes
2,386

Hi Jess,

ME5A doesn't use any type of ALV. It's a simple write report... The REUSE_ALV_HIERSEQ_LIST_DISPLAY framework can helps you to create the same ME5A layout.

There is an example of use:

http://wiki.scn.sap.com/wiki/display/Snippets/ALV+Hierarchical+Table+Using+FM+-+REUSE_ALV_HIERSEQ_LI...

Regards,

Alex

Read only

Former Member
0 Likes
2,387

If it is ok to have the purchase requisition as the summary after all line items, then you can do it using the normal reuse_alv_grid_display FM

Just make the Purchase requisition in the field catalog no_out attribute = 'X'. And give the text for purchase requsition 'Purchase Requisition'.

lv_pos = lv_pos + 1.
   CLEAR gw_alv_fieldcat.
   gw_alv_fieldcat-fieldname = 'EBELN'.
   gw_alv_fieldcat-tabname   = 'IT_TAB'.
   gw_alv_fieldcat-seltext_l = 'Purchase Requisition'.
   gw_alv_fieldcat-col_pos   = lv_pos.
   gw_alv_fieldcat-outputlen = 7.
   gw_alv_fieldcat-no_out = 'X'.
   gw_alv_fieldcat-key = 'X'.
   APPEND gw_alv_fieldcat TO gt_alv_fieldcat.

Include ALV sort table to sort the table by purchase requisition field.

   wa_sort-spos = '01' .
   wa_sort-fieldname = 'EBELN'.
   wa_sort-tabname = 'IT_ITAB'.
   wa_sort-up = 'X'.
   wa_sort-subtot = 'X'.
   APPEND wa_sort TO i_sort .

Would this be fine? 🙂

Read only

0 Likes
2,385

Great! It's looks fine and really similar to concept issued

Read only

0 Likes
2,385

Read only

0 Likes
2,385

thank you susmitha its working .

Read only

0 Likes
2,385

How did you do it?

Read only

0 Likes
2,385

solution of this thread ....

(1)  prepare field catalog  .

  wa_fcat-fieldname  = 'BANFN'.

   wa_fcat-tabname   = 'IT_TAB'.

   wa_fcat-seltext_l = 'Purchase Requisition'.  " this will display text of summary .

   wa_fcat-col_pos   = lv_pos.

   wa_fcat-outputlen = 7.

  wa_fact-no_out     =  'X'. " this is must if u want to display as summary after all line items.

(2) note that you have at least one numeric or quantity/currency  filed to be marked as do_sum = 'X'.

wa_fcat-fieldname  = 'MENGE'.  " quantity field

   wa_fcat-tabname   = 'IT_TAB'.

   wa_fcat-seltext_l = 'QUANTITY'

   wa_fcat-col_pos   = lv_pos.

   wa_fcat-do_sum = 'X'.

(3) prepare sort table .

sort the table by purchase requisition field.

   wa_sort-spos = '01' .
   wa_sort-fieldname = 'BANFN'.
   wa_sort-up = 'X'.
   wa_sort-subtot = 'X'.
   APPEND wa_sort TO i_sort .


(4) now add the filedcatalog and sort table in reuse_alv_grid_display .

this is also applicable in oo alv  as i did in set_table_for_first_display .