Tip

Memory-buffering in selection screen

Normally when dealing with a very big selection screen, which contains check boxes, radio buttons and parameters, tracking the selection screen values for each execution is difficult. We can track the values if we have provided the memory ID for the fields. If not ???

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_rad3 radiobutton group rad1,
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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.