09-27-2005 10:08 AM
Hi,
can anybody explain about set/get parameters and when we use them. if possiable with an example.
regards,
vijay.
09-27-2005 10: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
09-27-2005 10: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
09-27-2005 10: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.
09-27-2005 11: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.
09-27-2005 11:38 AM
if you want to initialze the input fields of a transactions with some values , you use set
thanks
09-27-2005 12:03 PM
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
09-27-2005 12:35 PM
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.