Skip to Content
author's profile photo Former Member
Former Member

set/get parameter

Hi,

can anybody explain about set/get parameters and when we use them. if possiable with an example.

regards,

vijay.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 09:13 AM

    hi,

    in your report there is a field like matnr, when you click the matnr you want to drill down into material master screen in that case

    PARAMETER ID OF MATNR IS MAT

    MATNR = '293838383'

    SET PARAMETER ID 'MAT' FIELD MATNR.

    CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

    then the screen populate material master screen

    like wise we can use get for retrieve the value

    DATA : REPID LIKE SY-REPID.

    GET PARAMETER ID 'RID' FIELD REPID.

    set/get is sap memory that is for global use

    cheers,

    sasi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 09:15 AM

    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9e0435c111d1829f0000e829fbfe/content.htm

    example

    report ztest.

    SET PARAMETER ID 'BLN' FIELD refbn.

    SET PARAMETER ID 'BUK' FIELD refbk.

    SET PARAMETER ID 'GJR' FIELD refgj.

    CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.

    U can also set certain defalt value in ur profile

    in tcode SU3, parameters tab.

    this is basically refers to sap memory.

    regards

    gv

    Message was edited by: Venkat

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 09:16 AM

    Hi vijay,

    below link might help you.

    http://help.sap.com/saphelp_erp2004/helpdata/en/d7/e21344408e11d1896b0000e8322d00/frameset.htm

    reward points and close the thread if your question is solved.

    regards,

    venu.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 27, 2005 at 10:36 AM

    The sentences GET and SET are used to share values

    between transactions.

    <b>Example for GET Parameter:</b>

    DATA: BEGIN OF LAST_LOGON, 
    DATE LIKE SY-DATUM, 
    TIME LIKE SY-UZEIT, 
    DATE_NOW LIKE SY-DATUM, 
    TIME_NOW LIKE SY-UZEIT, 
    END OF LAST_LOGON. 
    
    GET PARAMETER ID 'US2' FIELD LAST_LOGON. 
    
    write:/ 'Previous logon: ', last_logon-date, last_logon-time,
    / 'Current logon: ', last_logon-date_now, last_logon-time_now

    .

    Also

    GET PARAMETER ID key FIELD f.

    Effect

    Transfers the value stored under the key pid from the global user-related SAP memory memory to the field f .

    The key pid must consist of three characters. For an overview of the keys (parameters) used, refer to the SAP system description or the appropriate function in the ABAP/4 Development Workbench.

    The return code value is set as follows:

    SY-SUBRC = 0 A value was read from SAP memory.

    SY_SUBRC = 4 No value was found in SAP memory under the specified key .

    Example

    Read the program name from SAP memory:

    DATA : REPID(8).
    GET PARAMETER ID 'RID' FIELD REPID.

    SET PARAMETER ID pid FIELD f.

    Effect

    Writes the contents of the field f to the global SAP memory under the key pid . If the key already contains a value, it is overwritten.

    The key pid must consist of three characters. You can find a list of the keys (parameters) used in the SAP system description or in the ABAP/4 Development Workbench.

    Example

    DATA: REPID(8) VALUE 'RFSCHU01'.
    SET PARAMETER ID '<b>RID</b>' FIELD REPID.

    <b>

    Only three Char allowed</b>

    Kindly reward points and close the thread or else get back with queries.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 10:38 AM

    if you want to initialze the input fields of a transactions with some values , you use set

    thanks

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 11:03 AM

    Hi Vijay,

    From the replies above I believe you would've got a clear idea of using SET/GET Parameter Ids.

    In summary

    For ex:

    <b>SET</b> PARAMETER ID pid FIELD f.

    Writes the contents of the field f to the global user-specific SAP memory under the ID pid

    <b>GET</b> Parameter ID pid field f.

    Transfers the value stored under the key pid from the global user-related SAP memory to the field f.

    <b>A correction for one of the reply above</b>:

    I just wanted to make it clear that A parameter ID can be up to <b>20</b> characters long.

    It is not just limited to <b>3</b> characters of length as specified in earlier explanations.

    Please reward points if you find this explanation useful.

    Thanks,

    Siva

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 27, 2005 at 11:35 AM

    Set parameter and Get Parameter are used to store and retrieve variables form SAP memory.

    <b>SET PARAMETER ID pid FIELD f.</b> : Writes the contents of the field f to the global user-specific SAP memory under the ID pid

    eg:

    DATA : post(1) TYPE c value 'X'.

    SET PARAMETER ID 'PST' FIELD post.

    The contents of the variable post are stored in the SAP memory under the id 'PST'. If the id already exists, then it will be overwritten. The user can get its value even from another program.

    The global, user-specific SAP memory is available to a user for the duration of a single terminal session. Values written to it are retained even when the user exits a program.

    <b>GET PARAMETER ID pid FIELD f.</b> : Transfers the value stored under the key pid from the global user-related SAP memory to the field f.

    eg.

    DATA : post1(1) TYPE c value 'X'.

    GET PARAMETER ID 'PST' FIELD post1.

    The value in the SAP memory variable 'PST' is read into the variable post1. If the read was successful, the return code will be 0. Else, due to reasons like SAP memory variable not found etc, sy-subrc = 4.

    You should not use SAP memory for temporary storage because a user's parallel sessions use the same global memory.

    Just to give a simple example to show how two programs reads the same memory variable and thus communicate with each other, even when one of them has been terminated.

    A program zreport_all, performs many functionalities like posting document, viewing document, deleting document etc. Another report zreport_post(tcode : zpost), calls the second report zreport_all for posting the document. Second report calls a function module for posting the documents and automatically exits after executing that function. The control thus returns to the first report. In the first report, if the documents have been posted, the information message should be given as well as commit work should be done.

    How can the first report know whether the documents have been posted or not?

    report zreport_all.

    ....

    case sy-tcode.

    ...............

    when 'zpost'.

    • Select the document to be posted based on some selection criteria. If no documents have been selected or if the document was created by the same user, then document should not be posted, else the document will be posted.

    select single * from vbkpf where ....

    if sy-subrc ne 0.

    exit.

    elseif vbkpf-uname eq sy-uname.

    exit.

    else.

    SET PARAMETER ID 'PST' FIELD post.

    CALL FUNCTION 'ZPRELIMINARY_POSTING_POST_ALL'

    EXPORTING

    bupbi = xbinp

    TABLES

    t_vbkpf = tbkpf.

    endif.

    when 'zdel'.

    .............

    endcase.

    In the second program.

    report zreport_post.

    ..........

    SUBMIT zreport_all AND RETURN.

    ....

    GET PARAMETER ID 'PST' FIELD post1.

    if post1 = 'X'.

    Commit Work.

    WAIT UP TO 3 SECONDS.

    Write : 'The document has been posted'.

    endif.

    ............

    Thus even though the other program was terminated, still, the first program is able to retrieve the value of a variable set by the other program in SAP memory.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.