on 08-28-2008 6:56 AM
Hello ppl,
Currently the MAIN window of my SAPscript is coded as below:
/: IF condition = 'L'
/* Qty = &RESBD-MENGE(C)&
/: ENDIF
now i want to print it as
Qty = &RESBD-MENGE& minus &RESBD-DENMNG&.
Both the values are present in the sapscript at runtime.
How do i calculate this in sapscript and print the result?
Pls help.
Hello David,
Add the code accordingly
/: DEFINE &TOTAL&
/: PERFORM GET_TOTAL IN PROGRAM Z101812_SCRIPT
/: USING &RESBD-MENGE&
/: USING &RESBD-DENMNG&.
/: CHANGING &TOTAL&
ENDPERFORM -
Add this in script
/*Total = &TOTAL&. -
delete this
ST &TOTAL&---ST is standard paragraph here
in report:
FORM get_total TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
data: MENGE type MENGE,
DENMNG type DENMNG,
total type total. "Give according types
loop at in_tab.
case in_tab-name
when 'MENGE'.
menge = in_tab-value.
when 'DENMNG'.
DENMNG = in_tab-value.
endcase.
endloop.
total = menge - DENMNG. " U can do any calculation
loop at out_tab.
case in_tab-name
when 'TOTAL'.
out_tab-value = TOTAL.
modify out_tab.
endcase.
endloop
ENDFORM. "get_total
Regards,
Subbu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use perform statement with using menge and denmng and changing qty as using and changing parameters respectively
declare qty field in your script using DEFINE
eg.
perform <performname> in program <prgname>
using &RESBD-MENGE&
using &RESBD-DENMNG&
changing &QTY&
in your form -- endform.
form <perform name> tables in_tab structure itcsy
out_tab structure itcsy
read table in_tab index 1.
w_menge = in_tab-value.
read table in_tab index 2.
w_denmng = in_tab-value.
w_qty = w_menge - w_denmng.
read table out_tab index 1.
move w_qty to out_tab-value.
modify out_tab.
endform.
display the qty field in your script.
regards
padma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Padmavathi,
For the test purpose, i have written as below:
in sapscript:
/: DEFINE &TOTAL&
/: PERFORM GET_TOTAL IN PROGRAM Z101812_SCRIPT
/: USING &WA_EKPO-NETPR&
/: CHANGING &TOTAL&
Total = &TOTAL&.
in report:
FORM get_total TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
data: price type vbap-netwr,
total type vbap-netwr.
read table in_tab index 1.
price = in_tab-value.
total = price + 10.
read table out_tab index 1.
move total to out_tab-value.
modify out_tab.
ENDFORM. "get_total
But, the total is not being printed.
Can you pls help me find out the reason?
Thanks.
hi David,
the calculation has to be done in the Print Program, you cannot do that in the SAPScript!
hope this helps
ec
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In the same window, Assign the dynamci values to another fields, after that do the calculation, after display result.
regards
jana
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 | |
23 | |
11 | |
9 | |
8 | |
5 | |
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.