cancel
Showing results for 
Search instead for 
Did you mean: 

Reg. Total in sap script

Former Member
0 Kudos

I want Total in my script

my script design is

Amt disc amt

abc 100

___________________

Total 100

so is there any standard text in sap scriptfor total ?????

or define variable in print prog and also in sap script????

give me suggetion step by step

Vishal

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos
naimesh_patel
Active Contributor
0 Kudos

Yes, you can define a variabe in your print program and pass it to the SAPScript.

LIKE:

Define L_SUM in the Global data.

DATA: L_SUM TYPE BSEG-DMBTR.


LOOP AT ITAB.
  L_SUM = L_SUM + ITAB-AMOUNT.
ENDLOOP.

CALL FUNCTION 'WRITE_FORM'
  WINDOW = 'MAIN'
  ELEMENT = 'TOTAL'.

Now, in your SAPScript, create a text element in MAIN window


/E TOTAL
*  Total,, &L_SUM&.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Naimesh,

But what i declare in itab-amount... cause i write currency field direct in sap script.

Like &regup-dmbtre&. i have not use iyab for currency(amount) field...

Vishal

naimesh_patel
Active Contributor
0 Kudos

Do you have your custom SAPScript and print program? I means Z developments

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Naimesh,

I have create new SAP Script and i use zprog of standard sap print prog.

Vishal

naimesh_patel
Active Contributor
0 Kudos

In your Z prog you are calling the WRITE_FROM for the MAIN window and the amount which you are printing.

After that CALL Funciton, just add that amount to one variable.

L_SUM = L_SUM + REGUP-DMBTR.

And use this L_SUM in your SAPScript as per my earlier post.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Naimesh,

when i debuging my print program I got a value of L_SUM as well as i debuging in script also but in sap script L_SUM value is blank....... i declare write call function

then L_SUM = L_SUM + REGUP-DMBTR.

give me suggetion in which point i missing.

Vishal

naimesh_patel
Active Contributor
0 Kudos

Data definition of the L_SUM must be in the global data definition or TOP include.

DATA: L_SUM LIKE BSEG-DMBTR.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Naimesh,

Sorry for late reply.... but yet not working L_SUM is a blank.

Vishal

naimesh_patel
Active Contributor
0 Kudos

You need to call the WRITE_FORM for the TOTAL text element after your L_SUM = L_SUM + REGUP-DMBTR calculation...

inside the loop:

L_SUM = L_SUM + REGUP-DMBTR .

and after the loop eg ENDLOOP.

CALL FUNCTION 'WRITE_FORM

ELEMENT = 'TOTAL'

WINDOW = 'MAIN'.

Regards,

Naimesh Patel

Former Member
0 Kudos

hi vishal,

did your problem related to total in sapscript get solved.

was the solution given by naimesh working?