Using an SAP class CL_MMIM_USERDEFAULTS, we can store the selection screen values in the buffer memory and retrieve the same as required. So, once the program execution is over, the selection screen values will be moved to the buffer memory so we can use the same at the second run from the memory.
Hope this will be very useful in terms of complex selection screen in a user's point of view.
zbuffer_usage .
* Tables
tables : payr,mara,t001,t001w.
* Selection Screen
selection-screen : begin of block blk1 with frame title text-001.
parameters : p_zbukr type payr-zbukr,
p_hbkid type pcec-hbkid,
p_hktid type pcec-hktid,
p_stapl type pcec-stapl,
p_chk1 as checkbox,
p_chk2 as checkbox.
selection-screen : end of block blk1.
selection-screen : begin of block blk2 with frame title text-001.
select-options : s_bukrs for t001-bukrs memory id buk,
s_werks for t001w-werks memory id wrk.
parameters : p_rad1 radiobutton group rad1,
p_rad2 radiobutton group rad1,
Requires Free Membership to View
p_rad4 radiobutton group rad1. selection-screen : end of block blk2.
* Creating the ref for the class cl_mmim_userdefaults.
data: obj_ref type ref to cl_mmim_userdefaults.
initialization.
* Creating the Reference for the object
if obj_ref is initial.
create object obj_ref
exporting i_action = 'ZBUFFER_USAGE'.
endif.
* get the input data from the buffer
perform esdus_get_parameters.
at selection-screen.
* save the input data to the buffer
perform esdus_save_parameters.
start-of-selection.
*&---------------------------------------------------------------------*
*& Form esdus_get1_parameters
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form esdus_get_parameters .
p_zbukr = obj_ref->get( 'p_zbukr' ).
p_hbkid = obj_ref->get( 'p_hbkid' ).
p_hktid = obj_ref->get( 'p_hktid' ).
p_stapl = obj_ref->get( 'p_hktid' ).
p_chk1 = obj_ref->get( 'p_chk1' ).
p_chk2 = obj_ref->get( 'p_chk2' ).
p_rad1 = obj_ref->get( 'p_rad1' ).
p_rad2 = obj_ref->get( 'p_rad2' ).
p_rad3 = obj_ref->get( 'p_rad3' ).
p_rad4 = obj_ref->get( 'p_rad4' ).
* Check the radio button rule
if p_rad1 = '' and
p_rad2 = '' and
p_rad3 = '' and
p_rad4 = ''.
move 'X' to p_rad1.
clear : p_rad2, p_rad3,p_rad4.
endif.
endform. " esdus_get_parameters
*&---------------------------------------------------------------------*
*& Form esdus_save1_parameters
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form esdus_save_parameters .
* Only for the Dialog Mode
check : sy-batch is initial.
call method obj_ref->set( i_element = 'p_zbukr'
i_active = p_zbukr ).
call method obj_ref->set( i_element = 'p_hbkid'
i_active = p_hbkid ).
call method obj_ref->set( i_element = 'p_hktid'
i_active = p_hktid ).
call method obj_ref->set( i_element = 'p_stapl'
i_active = p_stapl ).
call method obj_ref->set( i_element = 'p_chk1'
i_active = p_chk1 ).
call method obj_ref->set( i_element = 'p_chk2'
i_active = p_chk2 ).
call method obj_ref->set( i_element = 'p_rad1'
i_active = p_rad1 ).
call method obj_ref->set( i_element = 'p_rad2'
i_active = p_rad2 ).
call method obj_ref->set( i_element = 'p_rad2'
i_active = p_rad2 ).
call method obj_ref->set( i_element = 'p_rad3'
i_active = p_rad3 ).
call method obj_ref->set( i_element = 'p_rad4'
i_active = p_rad4 ).
call method obj_ref->flush.
commit work.
endform. " esdus_save_parameters
This was first published in June 2004

Join the conversationComment
Share
Comments
Results
Contribute to the conversation