2020 Nov 12 5:53 PM
Hi, i have this request in my report:
Using the FM REUSE_ALV_GRID_DISPLAY, generate the following output:
If radiobutton RB_ITM is selected, create the output with following fields:
EKKO-BUKRS
EKKO-AEDAT
EKKO-LIFNR
LFA1-NAME1
LFA1-LAND1
EKPO-EBELN
EKPO-MATNR
MAKT-MAKTX
EKPO-MENGE
EKPO-MEINS
If radiobutton RB_SCHED is selected, create the output with following fields:
EKKO-BUKRS
EKKO-AEDAT
EKKO-LIFNR
LFA1-NAME1
LFA1-LAND1
EKPO-EBELN
EKPO-MATNR
MAKT-MAKTX
EKPO-MENGE
EKPO-MEINS
EKET-ETENR
EKET-EINDT
EKET-WMENG.
For the moment i used a structure (with all fields) created in the data dictionary that i used in the field catalog merge
2020 Nov 12 6:29 PM
francescolamura,
You could design your report as below:
1) Have two sets of Field catalog one for first Radio button and another for second radio button.
2) Your Data fetch must also commence based on the Radio button selected.
3) Call the FM for ALV in AT END OF SELECTION event.
4) Ensure based on the condition which determines the Radio button selected you populate the respective field catalog and fetch data into internal table accordingly.
Regards!
2020 Nov 12 8:46 PM
One possibility is to code your program for all the columns, and create two ALV layout variants to select the columns you indicate, which are used based on the radio button. The two variants are to be transported as separate objects. Optionally, instead of a radio button group, you may use a listbox field with all existing variants (2 clicks instead of 1, but the advantage is that the user may create his own layout variants). All this is already discussed in the forum.
2020 Nov 13 11:30 AM
other possibility will be to hide the fields you didn't need:
column = salv_columns->get_column( ‘EINDT’ ).
column->set_visible( if_salv_c_bool_sap=>false ).
2020 Nov 14 3:21 PM
Hi. i solved in this way:
if rb_itm EQ 'X'
DELETE FCAT WHERE FIELDNAME 'ETENR' AND
FIELDNAME 'EINDT' AND
FIELDNAME 'WMENG'.