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

tota amount for same hsn codes in smartforms.

Former Member
0 Likes
1,766

hiii,

i need to print the total amount , cgst,igst,sgst, for multiple number of same hsn odes.

for example

hsn------------- amount----- cgst---- igs----t sgst

4016 ----------- 240 ---------10- -- 0------ 10

565------------ -450-------------- 6------ 0------- 6

4016------------478------------- 10----- 0------ 10

in this i have to add the total amount for same hsn i.e., 4016 = 240+478

565 = 450.

i written code as


LOOP AT gt_item INTO ls_item.
ls_item2-hsn = ls_item-hsn.
ls_item2-tax_val = ls_item-tax_val.
APPEND ls_item2 TO lt_item2.
clear ls_item2.
ENDLOOP.
move lt_item2 to t_final.
DELETE ADJACENT DUPLICATES FROM lt_item2 COMPARING hsn .


LOOP AT lt_item2 INTO ls_item2.
LOOP AT t_final INTO ls_final WHERE hsn = ls_item2-hsn .


v_tax = v_tax + ls_final-tax_val.

ENDLOOP.
ls_item2-hsn = ls_final-hsn.
ls_final-tax_val = v_tax.
ENDLOOP........but its not working.

can any one suggest the code for this ..........please its very urgent.

1 ACCEPTED SOLUTION
Read only

rajkumarnarasimman
Active Contributor
1,643

Use COLLECT statement.

hiii,

i need to print the total amount , cgst,igst,sgst, for multiple number of same hsn odes.

for example

hsn------------- amount----- cgst---- igs----t sgst

4016 ----------- 240 ---------10- -- 0------ 10

565------------ -450-------------- 6------ 0------- 6

4016------------478------------- 10----- 0------ 10

in this i have to add the total amount for same hsn i.e., 4016 = 240+478

565 = 450.

i written code as


LOOP AT gt_item INTO ls_item.
ls_item2-hsn = ls_item-hsn.
ls_item2-tax_val = ls_item-tax_val.
APPEND ls_item2 TO lt_item2.
clear ls_item2.
ENDLOOP.
move lt_item2 to t_final.
DELETE ADJACENT DUPLICATES FROM lt_item2 COMPARING hsn .


LOOP AT lt_item2 INTO ls_item2.
LOOP AT t_final INTO ls_final WHERE hsn = ls_item2-hsn .


v_tax = v_tax + ls_final-tax_val.

ENDLOOP.
ls_item2-hsn = ls_final-hsn.
ls_final-tax_val = v_tax.
ENDLOOP........but its not working.

can any one suggest the code for this ..........please its very urgent.

7 REPLIES 7
Read only

rajkumarnarasimman
Active Contributor
1,644

Use COLLECT statement.

Read only

0 Likes
1,643

could u plz xplain me clearly

Read only

0 Likes
1,643

Hi Karuna,

Use collect statement as shown below which summaries the internal table value based on HSN CODE. Check link here for reference.

LOOP AT gt_item INTO ls_item.
ls_item2-hsn = ls_item-hsn.
ls_item2-tax_val = ls_item-tax_val. "amount
ls_item2-CGST = ls_item-CGST. "CGST amount
ls_item2-IGST = ls_item-IGST. "IGST amount
ls_item2-SGST = ls_item-SGST. "SGST amount
COLLECT ls_item2 INTO lt_item2.
clear ls_item2.
ENDLOOP.
Read only

0 Likes
1,643

thank you so much yaaar...

i need one more help.........

here i have to list the hsn code details with corresponding total CGST SGST IGST in HSN summary at the footer of the main window in smartforms .

but here , i am getting the the last hsn code details only ...but i want to list all the hsn codes incuded in it. how to overcome this..

thanks & regards..

Read only

0 Likes
1,643

iHi Karuna

"but here , i am getting the the last hsn code details only ...but i want to list all the hsn codes incuded in it. how to overcome this..

While mentioning the issue, show the problematic code also, which help to suggest somehow better.

"here i have to list the hsn code details with corresponding total CGST SGST IGST in HSN summary at the footer of the main window in smartforms 

If Total required in footer, did you try to add the value inside the loop like below.

LOOP AT gt_item INTO ls_item.
.... l_sgst_tot = l_sgst_tot + ls_item-SGST. "SGST Total amount l_cgst_tot = l_cgst_tot + ls_item-CGST. "CGST Total amount l_igst_tot = l_igst_tot + ls_item-IGST. "IGST Total amount
ENDLOOP.
Read only

0 Likes
1,643

hi sir,

here i want to display the totals for each hsn code

example : in footer window i want to display like below:

HSN-SUMMARY

hsn------------- amount----- cgst---- igs----t sgst

4016 ----------- 718 ---------20- -- 0------ 20

565------------ -450-------------- 6------ 0------- 6

:

:

:

if there is increase in line items i have to show them tooo in the footer window

Read only

Sukumaran_1416
Newcomer
0 Likes
1,435

Hi,

can you tell me which table you have used fetch the cgst ,sgst,igst values