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: 

Radiobutton for different output in alv grid

0 Kudos
869

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

4 REPLIES 4

former_member1716
Active Contributor
569

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!

Sandra_Rossi
Active Contributor
0 Kudos
569

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.

BUTZ
Explorer
0 Kudos
569

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 ). 

0 Kudos
569

Hi. i solved in this way:

if rb_itm EQ 'X'

DELETE FCAT WHERE FIELDNAME 'ETENR' AND

FIELDNAME 'EINDT' AND

FIELDNAME 'WMENG'.