on 07-29-2009 4:18 PM
Hi
I have to adapt a sapscript and i need a certain value for a variable.
For ex ekko-bukrs is empty in the report and i want to change it in the sapscript and give it a value
i tried the next:
/: define &ekko-bukrs& = '0001' but it did not work
Is it possible to change this variable in sapscript?
I cannot change the report since it is sap standard.
Hi Seba,
Writing &ekko-bukrs& = '0001' in script is not all advisable as it is Hard coding which is not a Good programming practice.
And as your driver program is a standard one so you have limitations. Moreover you can use the PERFORM command to call an ABAP subroutine (form) from any customized program. You can fetch the value from the routine and use it.
Code will look like in the sript:
/: PERFORM GET_BUKRS IN PROGRAM ZCJPERFO
/: USING &PAGE&
/: CHANGING &EKKO-BUKRS&
/: ENDPERFORM
REPORT QCJPERFO.
Form routine in the customize program.
FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
<body>
ENDFORM
Get back in case of doubts.
Cheers
Ajay
Edited by: ajay prak on Jul 29, 2009 8:51 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Seba,
you can use perform in the sapscript and then you can achieve your scenario in program.
see example code below and modify according to your needs,
/: PERFORM GET_PURORG_ADDRESS IN PROGRAM ZM_PURCHASE_ORDER-------->call this perform in sap script
/: USING &EKKO-EKORG&
/: CHANGING &V_EKORG&
/: ENDPERFORM
FORM GET_PURORG_ADDRESS TABLES in_par STRUCTURE itcsy------------------>call this in program
out_par STRUCTURE itcsy.
DATA :V_compcode LIKE <tablename-fieldname>.
if compcode is initial.
then assign here.
IF v_compcode IS NOT INITIAL.
out_par-value = v_compcode.
out_par-name = 'V_COMPCODE'.
MODIFY out_par INDEX 1.
ENDIF.
Edited by: suresh suresh on Jul 30, 2009 11:15 AM
Hi,
Try with below code.
/: PERFORM get_comp IN PROGRAM Z_bukrs
/: USING &EKKO-EBELN&
/: CHANGING &EKKO-BUKRS&
/: ENDPERFORM
FORM get_comp TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
DATA : wa_bukrs TYPE bukrs.
READ TABLE out_tab INDEX 1.
wa_bukrs = out_tab-value.
IF wa_bukrs IS INITIAL.
wa_bukrs = '0001'.
ENDIF.
READ TABLE out_tab INDEX 1.
MOVE wa_bukrs TO out_tab-value.
MODIFY out_tab INDEX sy-tabix.
ENDFORM. "get_comp
Regards
Bala Krishna
Edited by: Bala Krishna on Jul 30, 2009 12:58 PM
We should read out_tab value.
Edited by: Bala Krishna on Jul 30, 2009 12:59 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes you can change it. Try with capital letters
/: DEFINE &EKKO-BUKRS& = '0001'.
Regards
Krishna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.