cancel
Showing results for 
Search instead for 
Did you mean: 

How to do SUBTOTAL AND TOTAL in Main Window of SAPSCRIPT.

Former Member
0 Kudos

Hello Friends,

I am modifying standard SAPSCRIPT of packing slip. My client wants a subtotal and total in Main Window of Script for Eg. (They want Material Number wise Subtotal and finally Grandtotal at bottom in Main Window)

Now i got stucked up here how to do it ?

here is my sample code.

LOOP AT XVBPLP WHERE VENUM = SHENR.

IF XVBPLP-POSNR IS INITIAL.

  • Versandelement

PERFORM PACKING_TREE USING XVBPLP-UNVEL.

ELSE.

  • Lieferposition (Anteil)

VBPLP = XVBPLP.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'DELPOS'. "Main Window call

clear vbplp.

ENDLOOP.

Pls guide me for the same.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

HI,

For the Line items, put a ELEMENT in the Smartform, and you will call this with in the LOOP and ENDLOOP, so here with in the LOOP count the TOTAL value.

then create new element after the Line item Element, and call this Element after the Line items prints,

/E LINE_ITEM

&1& &2 & &3& " This will be in the loop and you need to caliculate the totla here

/E SUB_TOTAL.

&SUb_TOTAL& " After all the line items pritns then call this Element

Regards

Sudheer

Former Member
0 Kudos

Hello Sudheer,

Thanks for your kind help but i m little confused how to do it as i m doing it very first time so can u help me out with sample code for this or any other help file?

Regds,

Pritesh