‎2009 Feb 12 10:15 AM
i have a requirement where i have to customize the layout dynamically in the report output.the layout should be changed as per the selection screen field entry.is this possible?
‎2009 Feb 12 10:30 AM
refer below demo program....
BALVSD01.
this can be did through following f.m
REUSE_ALV_VARIANT_DEFAULT_GET
REUSE_ALV_VARIANT_F4
‎2009 Feb 12 10:19 AM
Hi,
U can use
loop at screen.
if screen-name CS 'FIELD1'.
screen-active = 0.
modify screen.
endif.
endloop.
This is used to modify screen depending on fields.
‎2009 Feb 12 10:22 AM
Hi,
This can be done by
At selection-screen output event..
just execute and observe how it behaves...when u click on the second radio button the field p_name2 will disapper..
Copy it and execute it...
selection-screen begin of block b1 with frame.
parameters:
p_sales radiobutton group grp user-command UC default 'X',
p_order radiobutton group grp.
selection-screen end of block b1.
parameters:
p_name type sy-uname modif id g1,
p_name1 type sy-uname modif id g2.
selection-screen begin of block b2 with frame.
parameters:
p_name2 type sy-uname modif id g3.
selection-screen end of block b2.
at selection-screen output.
if p_sales NE 'X'.
loop at screen.
if screen-group1 CS 'G3'.
screen-active = 0.
modify screen.
endif.
endloop.
Regards
Kiran
‎2009 Feb 12 10:27 AM
Hi,
Check this one, How it is changing dynamically
TABLES : mara,marc.
*******************************************************************************************
************************Selection screen fields******************************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_meth1 RADIOBUTTON GROUP g1 USER-COMMAND g1,
p_meth2 RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK matnr
WITH FRAME TITLE text-002.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS : so_matnr FOR marc-matnr MODIF ID m1.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS : so_werks FOR marc-werks MODIF ID m1 .
SELECTION-SCREEN END OF BLOCK matnr.
SELECTION-SCREEN BEGIN OF BLOCK file WITH FRAME TITLE text-003.
SELECTION-SCREEN SKIP 1.
PARAMETERS: p_fpath TYPE ibipparms-path MODIF ID m2 LOWER CASE.
SELECTION-SCREEN END OF BLOCK file.
SELECTION-SCREEN BEGIN OF BLOCK date WITH FRAME TITLE text-004.
SELECTION-SCREEN SKIP 1.
PARAMETERS : p_date TYPE datuv. "CCT51576.
SELECTION-SCREEN END OF BLOCK date.
***************************************************************************************
***********************Screen Validation*********************************************
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'M1'.
IF p_meth1 <> 'X'.
screen-active = 1.
ENDIF.
IF p_meth2 = 'X'.
screen-active = 0.
ENDIF.
WHEN 'M2'.
IF p_meth2 = 'X'.
screen-active = 1.
ELSE.
screen-active = 0.
ENDIF.
IF p_meth1 = 'X'.
screen-active = 0.
ENDIF.
ENDCASE.
MODIFY SCREEN.
ENDLOOP.
‎2009 Feb 12 10:30 AM
refer below demo program....
BALVSD01.
this can be did through following f.m
REUSE_ALV_VARIANT_DEFAULT_GET
REUSE_ALV_VARIANT_F4
‎2009 Feb 12 10:36 AM
hi guys
U have not understood what my requirement is . i dont want details reg creation of button on selection screen . i want to know if we can change the layout of the output fields displayed based on the layout i give as input .pls tell me the logic to do the same..
‎2009 Feb 12 10:45 AM
Hi,
Would you please be more specific do you wnat to change the layout of the ALV on the selection screen or the change the display of the parameters on the selection screen...
Regards,
Siddarth
‎2009 Feb 12 10:57 AM
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
I_STRUCTURE_NAME = 'SFLIGHT'
*I_SAVE = 'A' * " * A = All => Standard & User*
TABLES
T_OUTTAB = GT_SFLIGHT.
if u specify this option then u will get change layout push button option in report output ---through that u can create n number of layout and as i specified above u can use that f.m to get the .saved layout variant in selection screen as per u need to display the o/p.
‎2009 Feb 12 11:42 AM
hi niki
i have created many layouts for the output . in the selection screen field i have to input the layouts what i have saved. What FM i have to use?
‎2009 Feb 12 11:55 AM
Hi Rakesh,
Use this FM : REUSE_ALV_VARIANT_F4
hope it helps,
Pratik
‎2009 Feb 16 4:41 AM
Hi,
You can also do it by uploading the file into an internal table using GUI_UPLOAD and if you want to do some modifications you can do that and then using function module reuse_alv_list_display you can display the alv....
Regards,
Siddarth
‎2009 Feb 12 10:49 AM
hi rakesh,
you can change the layout by using call screen statement, i.e when a particular radio button statement is selected use call screen and the layout'll change.
regards,
Dheeraj
‎2009 Feb 12 10:59 AM
am asking about report output not module pool.
hi siddharth
i want the output of the ALV grid that has to be modify dynamically according to layout selected on the selection screen.
‎2009 Feb 12 11:10 AM
Hi,
try using lvc_s_layo structure.
see this example.
w_lay-grid_title = 'Flight details'.
w_lay-zebra = 'X'.
w_lay-edit = 'X'.
w_lay-no_toolbar = 'X'.
w_lay-CWIDTH_OPT = 'X'.
pass this w_lay .
CALL METHOD r_alv_grid->set_table_for_first_display
exporting
is_layout = w_lay
‎2009 Feb 12 11:18 AM
Hi,
Take a look at the demo program BCALV_GRID_10 'Load a layout before list display' of package SLIS.
regards,
Advait
‎2009 Feb 12 11:17 AM
Hi,
If u want to display your layout dynamically, then u have to used
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
i_style_table =
it_fieldcatalog = it_fcat
i_length_in_byte =
IMPORTING
ep_table = it_tab
e_style_fname =
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
where it_fcat is ur fieldcat & it_tab is ur internal tabel.
Then u have to used field symbol to assign the values to the table..
then same dispaly list using 'REUSE_ALV_GRID_DISPLAY'.