Memory-buffering in selection screen

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

    When you register, you will start receiving targeted emails from my award-winning team of editorial writers. Our goal is to keep you informed on the hottest topics and biggest challenges faced by SAP professionals today.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchSAP.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchSAP.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

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

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.

    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.