Associating SET/GET Parameters to Screen elements

VN:F [1.9.3_1094]
Rating: 9.3/10 (3 votes cast)

In my previous post, Using SET/GET Parameter ID in SAP, I discussed about how to create SET/GET parameters and then how to use them to transfer data from one external (main) session to the other within the same user (terminal) session.

We will now see how the parameter ids can be attached to screen elements in order to populate them by default with the previously set parameter value.

This can be done in the following ways:

Attaching SET/GET Parameters to Selection Screen

You can attach SET/GET parameter to Selection screen parameters / selection options using the keyword MEMORY ID.

PARAMETER para TYPE datatype MEMORY ID parameterid.

SELECT-OPTION sopt FOR datatype MEMORY ID parameterid.

Here, parameterid is the SET/GET parameter id attached to selection screen parameter para and select option sopt. On attaching this parameter id to the selection screen elements, they will automatically get defaulted to whatever value is stored in the parameter id in the SAP memory.

An example mentioned below will clarify the behaviour.

Here, the first program sets the value of parameter id BUK as ‘0001′.

SET PARAMETER ID ‘BUK’ FIELD ‘0001′.

REPORT first_program.

SET PARAMETER ID ‘BUK’ FIELD ‘0001′.

After executing this program the value of parameter id BUK will be set to ‘0001′ in SAP memory.

Now, lets see what happens when the 2nd program is executed after the above one.

REPORT second_program.

PARAMETER: p_cocd TYPE bukrs MEMORY ID buk.

You will obtain the following result:

Attaching SET/GET Parameter with Selection screen parameter

Attaching SET/GET Parameter with Selection screen parameter

You can observe that the selection screen parameter ‘Company Code’ got automatically filled with value ‘0001′ since the value of parameter id BUK was set to ‘0001′ in the SAP memory by the first_program.

Attaching SET/GET Parameter to the Screen Field

Parameter IDs can be assigned to normal ABAP screen fields. This can be done from two places.

First option is through the screen field’s properties in the Screen’s ‘Layout’. You can go to the Screen painter (transaction SE51) and open the ‘Layout Editor’ for your screen. Here, You can double click the screen field to open its attribute’s popup where you can specify the parameter id.

Attaching SET/GET Parameter with Screen fields

Attaching SET/GET Parameter with Screen fields

In the attributes, you can specify the respective parameter id to be attached to the screen field. This alone doesn’t work. You will find two checkboxes ‘SET Parameter’ & ‘GET Parameter’ below the field ‘Parameter ID’. If you mark the checkbox ‘GET Parameter’, the system will automatically fetch the value of specified parameter id from SAP memory & fill the screen field with fethced value if it’s not filled programatically.

You can mark the checkbox ‘SET Parameter’ to automatically set the value of parameter id in the SAP memory to the value typed by the user in the screen field. This can come handy in increasing the usability of your frequently used screens. I would advice to use this feature judiciously because excessive use of this feature may sometime irritate the user.

The Second option to do the same thing is also through Screen painter (transaction SE51). You can go to screen’s ‘Element list’. Here in the ‘Special attributes’ tab, you can specify parameter id in the column ‘Parameter ID’ against you screen field. You will also find checkboxes ‘SET Parameter’ & ‘Get Parameter’.

Attaching SET/GET Parameter to Data Element

You can attach the SET/GET Parameter to Data element. To do this, go to the data element’s definition using transaction SE11. Here, you will find a field ‘Parameter ID’ in the tab ‘Further Characteristics’. In this field, you can specify the parameter ID which you want to associate this data element with.

Attaching SET/GET Parameter with Data element

Attaching SET/GET Parameter with Data element

Whenever a field is added from data dictionary to the screen (dynpro), which is associated with a data element having a parameter id, the parameter id is fetched to the screen field’s attribute. So, you will not have to specify the parameter id manually in each screen where you add a field with this data element. The rest of behaviour is similar to the previous section.

Hope, I have been clear enough in explaining the topic. Please do comment, if you find something to add.

VN:F [1.9.3_1094]
Rating: 9.3/10 (3 votes cast)
Associating SET/GET Parameters to Screen elements, 9.3 out of 10 based on 3 ratings
Hey friends!!! Don't forget to promote the post by pressing the buttons below, if you liked it...
  • Digg
  • del.icio.us
  • StumbleUpon
  • Twitthis
  • Yahoo! Buzz
  • Facebook
  • Technorati
  • LinkedIn

4 comments to Associating SET/GET Parameters to Screen elements

  • [...] my next posts ( Associating SET/GET Parameters to Screen elements & Persisting SET/GET Parameter values in User Profile ), we will continue to learn how to use [...]

  • I enjoy this site, it is worth me coming back

    VA:F [1.9.3_1094]
    Rating: +1 (from 1 vote)
  • Raveesh

    I enjoyed reading your article on SPA/GPA.

    Just one query..

    Do you mean to say that we can create parameter IDs in two ways.
    1) Programmatically using SE80.
    2) In the data element

    Please confirm i ma right or wrong.

    Raveesh

    VA:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
  • Lokesh

    Can you please tell me, How to clear the sap memory.
    I have already tried eith this: “SET PARAMETER ID ‘VKO’ FIELD space”. But still after this when I am coming back to program selection scrren, still the sales organiztion is there (Still taking from the sap memory.

    Many thanks in advance.

    VA:F [1.9.3_1094]
    Rating: 0 (from 0 votes)

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>