on 12-08-2010 1:28 PM
Hi,
I want to add two fields(DMBTR and MWSTS) which are Currency values from the BSIK table and display the answer in a Sap Script form and I have to do this addition on the SAP script itself.
Any Input will be highly appreciated.
Thank you.
Hi wesleymabunda,
You can build a small logic as stated in the below example.
Inside you SAP script call a routine. before you display "MWSTS"
Example:
/: PERFORM GET_TOTAL IN PROGRAM ZROUTINE
/: USING &BSIK-DMBTR&
/: USING &BSIK-MWSTS&
/: CHANGING &TOTAL&
/: ENDPERFORM
Now goto transaction code SE38
And create a new program as ZROUTINE. Logic inside the program should be as stated in the example.
Example:
FORM GET_TOTAL TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
DATA: LV_DMBTR LIKE BSIK-DMBTR,
lv_MWSTS LIKE BSIK-MWSTS,
lv_total LIKE regup-zbukr.
CLEAR: lv_dmbtr,
lv_MWSTS,
lv_total.
READ TABLE in_tab INDEX 1.
lv_dmbtr = in_tab-value.
READ TABLE in_tab INDEX 2.
lv_mwsts = in_tab-value.
lv_total = lv_dmbtr + lv_mwsts.
IF NOT lv_total IS INITIAL.
READ TABLE out_tab INDEX 1.
out_tab-value = lv_total.
MODIFY out_tab INDEX 1.
ENDIF.
ENDFORM.
Now go back to SE71, inside your SAp script display &TOTAL& on the location you want to display it. Change the above logic a bit, if you need grand total.
I guess, above information, will help you to close the thread.
Regards,
SaiRam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you already have BSIK-DMBTR , then just put &BSIK-DMBTR& in your SAPScript form where you want it to be printed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You r enhancing standard script or custom script.
If u add any code to standard script using subroutine pool and using PERFORM statement.
STEP1:First where u want to display the two fields in that FIRST WE NEED TO CREATE /E ELEMENT.
STEP2:Pass the two fields data into that script through DRIVER PROGRAM.
STEP3:Create one more /E ELEMENT1 FOR TOTAL.
STEP4:That data calucaltae in driver program pass the total into RESPECTIVE SCRIPT.
CALL FUNCTION WRITE "Two fields values.
ELEMENT = ELE1.
CALL FUNCTION WRITE "TOTAL
ELEMENT = ELE2.
*********THIS PERFORM CALL IN SCRIPT IF U ENHANCE THE STANDARD PROGRAM****
PERFORM FORNAM IN PROGRAM (ZDRIVERPPG) USING "INPUPARAMETERS) CHANGING OUTPUTPAR
*************FORM CALL IN DRIVER PG**************************************
FORM FORMNAME TABLES IT_TAB1 STRUCTURE ITCSY
ITA_TAB2 STRUCTURE ITCSY.
ENDFORM.
REGARDS,
MURALII
Hi Muralii
I cannot modify the print program because it is a Standard Sap Print Program, I have to do modifications and additions on the Sap Script, I just tried creating an element like this:
/E Answer = &WA_ITAB-ITEMPRICE& + &WA_ITAB-ITEMPRICE&
Total Amount = Answer,
but I got an internal error.
User | Count |
---|---|
86 | |
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.