on 12-18-2008 7:46 AM
Hello Experts,
I am currently developing a form wherein I need to change the value of a variable defined in the standard
driver program through the sapscript form. Unfortunately, I cannot customize this standard program since this is used by many other
subsidiaries. So, is there anyway that I can change a variable defined in the driver program via sapscript?
I tried to use a PERFORM to change its value but it is not working.
I hope you can help me guys. Thank you and take care!
Hi,
You can do it using PERFORM statement, can you paste how you wrote your PERFORM statement and its corresponding Subroutine
Regards
Bala Krishna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guys,
Here is what I did. I am trying to change the value of BKPF-GJAHR from '2007' to '2008'. So in my sapscript it goes something like this:
SAPSCRIPT:
/: perform change_gjahr in program zchange_gjahr
/: using &BKPF-GJAHR&
/: changing &BKPF-GJAHR&
/: endperform
ZCHANGE_GJAHR:
FORM change_gjahr TABLES im_input STRUCTURE itcsy
ex_output STRUCTURE itcsy.
field-symbols: <fs_input> type itcsy,
<fs_output> type itcsy.
constants: lcc_gjahr type char10 value 'BKPF-GJAHR'.
read table im_input assigning <fs_input> with key name = lcc_gjahr.
if sy-subrc = 0.
if <fs_input>-value = '2007'.
read table ex_output assigning <fs_output> with key name = lcc_gjahr.
if sy-subrc = 0.
<fs_output>-value = '2008'.
endif.
endif.
endform.
Hi,
Do as below, define a variable in SAPScript using DEFINE statement for GJHAR, and remove the output field BKPF-GJHAR in SAPScript value, give the defined variable in place of that (GJHAR).
do the following modification in your coding both in FORM and soubroutine, hope this will solve
/: DEFINE &GJHAR& = '0000'
/: perform change_gjahr in program zchange_gjahr
/: using &BKPF-GJAHR&
/: changing &GJAHR&
/: endperform
FORM change_gjahr TABLES im_input STRUCTURE itcsy
ex_output STRUCTURE itcsy.
data : wa_gjhar TYPE bkpf-gjhar.
READ TABLE im_input INDEX 1.
wa_gjhar = im_input-value.
IF wa_gjhar = '2007'.
wa_gjhar = '2008'.
ENDIF.
READ TABLE ex_output INDEX 1.
MOVE wa_gjhar TO ex_output-value.
MODIFY ex_output INDEX sy-tabix.
endform.
Regards
Bala Krishna
Hi,
If you use the same variable BKPF-GJHAR, its value will be always same in form, as it is coming from the Driver program.
In the above subroutine program it changes the value according to condition, if conditions fails it retains the original value.
Regards
Bala Krishna
Edited by: Bala Krishna on Dec 19, 2008 11:46 AM
SAP SCRIPT:
/: PERFORM GET_ATTNDEE_INFO IN PROGRAM ZHR_TRNG
/: USING &PPVAR-EOBJD&
/: CHANGING &ATTND&
/: ENDPERFORM
Executable Prog.:
REPORT ZHR_TRNG.
FORM GET_ATTNDEE_INFO TABLES IN_PAR STRUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
DATA : LOC_CODE(8),
WF_NAME LIKE PA0001-ENAME, "----Location Code
WF_SOBID LIKE HRP1001-SOBID. "----Business Event Code
DATA: BEGIN OF ITAB_ECODE OCCURS 0,
ECODE(8),
END OF ITAB_ECODE.
DATA: NAME1 TYPE STRING.
READ TABLE IN_PAR INDEX 1.
LOC_CODE = IN_PAR-VALUE.
SELECT SOBID FROM HRP1001 INTO WF_SOBID
WHERE OBJID = LOC_CODE AND OTYPE ='E' AND PLVAR = '01' AND SCLAS = 'P'.
APPEND WF_SOBID TO ITAB_ECODE .
ENDSELECT.
IF SY-SUBRC = 0.
LOOP AT ITAB_ECODE.
SELECT SINGLE ENAME FROM PA0001 INTO WF_NAME
WHERE PERNR = ITAB_ECODE-ECODE ." AND ENDDA >= '31.12.9999' .
CONCATENATE 'Mr ' WF_NAME ',' NAME1 INTO NAME1.
IF SY-SUBRC = 0 .
OUT_PAR-NAME = 'ATTND'.
OUT_PAR-VALUE = NAME1.
APPEND OUT_PAR.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. "GET_USR_INFO
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.