Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Code to get total amount from the attach coe

Former Member
0 Likes
507

Hi,

We have one print program of sap script for 57F4 Challan print out from the below code we are getting all the items of 57f4 challan with there amount on the print out but at the end o fprogram i want to print the sum of amount of alla materials can u give the code or idead to modify the progra

Code with which it is printing the material with price

SELECT * FROM J_1IEXCDTL WHERE EXNUM = DOC_NO AND

EXDAT = DOC_DT.

PERFORM WRITE_FORM USING 'MAIN' 'ITEM_VALUES' 'SET'.

ENDSELECT.

PERFORM WRITE_FORM USING 'MAIN' 'DASH_LINE' 'SET'.

****

at the end i want to add the amount and then print .

regards,

zafar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
476

Hi,

Inbetween select and endselect add all the amount fields and pass it to one global variable.Pass the total field to form to print.

Regards,

Ramya.

4 REPLIES 4
Read only

Former Member
0 Likes
476

Hi,

Can u help on this, i am new to abap and in this code as the all filed is selected from table J_1IEXCDTL but there is no into so for adding all the amount to calculate the sum i am not getting where to do loop.

regards,

zafar

Read only

Former Member
0 Likes
477

Hi,

Inbetween select and endselect add all the amount fields and pass it to one global variable.Pass the total field to form to print.

Regards,

Ramya.

Read only

0 Likes
476

Hi,

Can i do as below

SELECT * FROM J_1IEXCDTL WHERE EXNUM = DOC_NO AND

EXDAT = DOC_DT.

SUM = SUM + J_1IEXCDTL-DMBTR

PERFORM WRITE_FORM USING 'MAIN' 'ITEM_VALUES' 'SET'.

ENDSELECT.

THEN IN SUM WILL I GET THE TOTAL AMOUNT.

regards,

zafar

Read only

0 Likes
476

Yes you will get the sum as it is in loop.Test it once?