‎2007 Aug 16 6:09 PM
Hi,
can anyone send me a program which has the use of Get parameter .
thnk u all.
satya
‎2007 Aug 16 6:19 PM
<b>GET</b>
DATA: para TYPE tpara-paramid VALUE 'RID',
prog TYPE sy-repid.
GET PARAMETER ID para FIELD prog.
IF sy-subrc <> 0.
MESSAGE 'Parameter not found' TYPE 'I'.
ENDIF.
<b>SET</b>
DATA: carrier TYPE spfli-carrid,
connection TYPE spfli-connid.
START-OF-SELECTION.
SELECT carrid connid
FROM spfli
INTO (carrier, connection).
WRITE: / carrier HOTSPOT, connection HOTSPOT.
HIDE: carrier, connection.
ENDSELECT.
AT LINE-SELECTION.
SET PARAMETER ID: 'CAR' FIELD carrier,
'CON' FIELD connection.
CALL TRANSACTION 'DEMO_TRANSACTION'.
‎2007 Aug 16 6:21 PM
Hi Aman,
can u plz tell me how its used and wht is the use of get parameter.
satya
‎2007 Aug 16 6:22 PM
Hi Satya,
<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.
Thanks,
Vinay
‎2007 Aug 16 8:21 PM
hi there,
not sure if this will be any use but is a basic program show use of set and get parameter id
http://www.sapdevelopment.co.uk/tips/tips_paramid.htm
Mart
‎2007 Aug 16 8:24 PM
here is a good document to know how this works.
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9e0435c111d1829f0000e829fbfe/frameset.htm
Thanks
A.
<i>please reward points and close the thread if answer useful and problem is solved.</i>