Displaying multiple tables using ALV
Hi,
My requirement is something like for particular employee number, i need to display a set of data. The data is spread across in say, 3 different internal tables. I need to display the data
Emp no 1
itab1
itab2
itab3
empno 2
itab1
itab2
itab3
and so on. I tried using the functions REUSE_ALV_BLOCK_LIST_APPEND and REUSE_ALV_BLOCK_LIST_DISPLAY within a loop.
But it does not serve the purpose.
Can anybody let me know as to how do i do it ?
Regards
Uma
dont know exactly
but is this useful
REUSE_ALV_HIERSEQ_LIST_DISPLAY
Hi,
My requirement is something like for particular employee number, i need to display a set of data. The data is spread across in say, 3 different internal tables. I need to display the data
Emp no 1
itab1
itab2
itab3
empno 2
itab1
itab2
itab3
and so on. I tried using the functions REUSE_ALV_BLOCK_LIST_APPEND and REUSE_ALV_BLOCK_LIST_DISPLAY within a loop.
But it does not serve the purpose.
Can anybody let me know as to how do i do it ?
Regards
Uma
Use 'REUSE_ALV_GRID_DISPLAY' as follows
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
it_fieldcat = gt_fieldcat[]
i_save = g_save
is_variant = gs_variant
it_events = gt_events[]
IMPORTING
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
TABLES
t_outtab = gt_linedata
EXCEPTIONS
program_error = 1
OTHERS = 2.
Gt_linedata is an internal table that you've defined yourself within your ABAP that holds all three table's data.
Then use gt_fieldcat to store your ALV columns:
ls_fieldcat-fieldname = 'BEDNR'.
ls_fieldcat-ref_tabname = 'EKPO'.
APPEND ls_fieldcat TO p_gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'LICHA'.
ls_fieldcat-ref_tabname = 'MCH1'.
APPEND ls_fieldcat TO p_gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'MAKTX'.
ls_fieldcat-ref_tabname = 'IT_LINEDATA'.
ls_fieldcat-seltext_s = 'Mat. Desc.'.
ls_fieldcat-seltext_m = 'Material Desc.'.
ls_fieldcat-seltext_l = 'Material Description'.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = '000030'.
APPEND ls_fieldcat TO p_gt_fieldcat.
ls_fieldcat-fieldname = 'GRQTY'.
ls_fieldcat-ref_tabname = 'IT_LINEDATA'.
ls_fieldcat-seltext_s = 'GR Qty'.
ls_fieldcat-seltext_m = 'Goods Rec. Qty'.
ls_fieldcat-seltext_l = 'Goods Receipt Qty'.
ls_fieldcat-inttype = 'P'. " Int Type P
ls_fieldcat-do_sum = 'X'. " Sum Value
ls_fieldcat-just = 'R'. " Right Align
ls_fieldcat-ddictxt = 'M'. " Display Medium desc.
ls_fieldcat-outputlen = '000013'.
APPEND ls_fieldcat TO p_gt_fieldcat.
ls_fieldcat-fieldname = 'PRQTY'.
ls_fieldcat-ref_tabname = 'IT_LINEDATA'.
ls_fieldcat-seltext_s = 'Prod. Qty'.
ls_fieldcat-seltext_m = 'Production Qty'.
ls_fieldcat-seltext_l = 'Production Qty'.
ls_fieldcat-outputlen = '000013'.
APPEND ls_fieldcat TO p_gt_fieldcat.
ls_fieldcat-fieldname = 'ODQTY'.
ls_fieldcat-ref_tabname = 'IT_LINEDATA'.
ls_fieldcat-seltext_s = 'Own Dam. Qty'.
ls_fieldcat-seltext_m = 'Own Damage Qty'.
ls_fieldcat-seltext_l = 'Own Damage Qty'.
ls_fieldcat-outputlen = '000015'.
APPEND ls_fieldcat TO p_gt_fieldcat.
ls_fieldcat-fieldname = 'SDQTY'.
ls_fieldcat-ref_tabname = 'IT_LINEDATA'.
ls_fieldcat-seltext_s = 'Supp. Dam. Qty'.
ls_fieldcat-seltext_m = 'Supplier Damage Qty'.
ls_fieldcat-seltext_l = 'Supplier Damage Qty'.
ls_fieldcat-outputlen = '000017'.
APPEND ls_fieldcat TO p_gt_fieldcat.
ls_fieldcat-fieldname = 'LPQTY'.
ls_fieldcat-ref_tabname = 'IT_LINEDATA'.
ls_fieldcat-seltext_s = 'Supp. Dam. < 2%'.
ls_fieldcat-seltext_m = 'Supp. Dam. < 2%'.
ls_fieldcat-seltext_l = 'Supp. Dam. Qty < 2% of GR Qty'.
ls_fieldcat-ddictxt = 'M'.
ls_fieldcat-outputlen = '000016'.
APPEND ls_fieldcat TO p_gt_fieldcat.
ls_fieldcat-fieldname = 'HPQTY'.
ls_fieldcat-ref_tabname = 'IT_LINEDATA'.
ls_fieldcat-seltext_s = 'Supp. Dam. >= 2%'.
ls_fieldcat-seltext_m = 'Supp. Dam. >= 2%'.
ls_fieldcat-seltext_l = 'Supp. Dam. Qty >= 2% of GR Qty'.
ls_fieldcat-ddictxt = 'M'.
ls_fieldcat-outputlen = '000016'.
APPEND ls_fieldcat TO p_gt_fieldcat.
ls_fieldcat-fieldname = 'CGQTY'.
ls_fieldcat-ref_tabname = 'IT_LINEDATA'.
ls_fieldcat-seltext_s = 'Coil Gain'.
ls_fieldcat-seltext_m = 'Coil Gain Qty'.
ls_fieldcat-seltext_l = 'Coil Gain Qty'.
ls_fieldcat-inttype = 'P'. " Int Type P
ls_fieldcat-do_sum = 'X'. " Sum Value
ls_fieldcat-just = 'R'. " Right Align
ls_fieldcat-ddictxt = 'M'. " Display Medium desc.
ls_fieldcat-outputlen = '000014'.
APPEND ls_fieldcat TO p_gt_fieldcat.
Hi! someone mentioned this function module which displays the report from two tables being passed to this function 1 for header and 1 for item.
I'm using this function in my ALV report.
I have a problem with the report values alignment. If someone could please help me.
I want to display 3 lines.
1- company code, date
2- material, plant
3- purchase orders
this is sorted by company code, material and plant.
currently, i populate the header table with the company code, date, material and plant.
and populate the item table with material, plant, PO number
but the report displays with this alignment:
company code date
material1 plant
PO number1
PO number2
material2 plant
PO number3
PO number4
Please if you could help me have the report display with this alignment:
company code date
material1 plant
PO number1
POnumber2
material2 plant
PO number3
PO number4
I'd really appreciate if you guys could help
Thanks!!
brez
hi sorry the last log didnt show the alignment.
the current alignment shows the material on the second line with the plant but its to the right of the date (in line 1).
i wanted to have the company code and material starting at the same column.
the company code in line 1 and then right under it, the material.
right now, although the company code is on the 1st line, and teh material is on the second, the alignment of material is on the right of the date. if the date ends at the 2nd inch of the ruler, the material is written under it at the start of the 3rd inch of the ruler.
Please advise if you know the solution to this. thanks