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

ALV_Calculations_Multiplying fields

Former Member
0 Likes
935

Hi experts,

Im new to SAP and am having some problems with alv reports. Im trying to multiply these values(ekko-menge & calp-vkpne) in order to get a total value e.g.

1: ekko-menge * calp-vkpne Total

2: ekko-menge * calp-vkpne Total

My main problem i think is that i cant create a join between the two since their is no corresponding field? Any help appreciated.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
898

Hi Mike,

My first doubt is, From where are you getting a value in the field CALP-VKPNE,which table are you referring to get this value, from the Structure or a data base table.

create an internal table with type

types: begin of ty_tab1,

menge type ekko-menge,

vkpne like calp-vkpne,

total type dmbtr,

end of ty_tab1.

populate the internal table by having a SELECT query on your relevant tables

loop at it_tab1 into wa_tab1.
wa_tab1-total = wa_tab1-menge * wa_tab1-vkpne.
modify it_tab1 from wa_tab1 transporting total.
endloop

Revert for further clarification

Thanks

Sri

Hi Mike,

My first doubt is, From where are you getting a value in the field CALP-VKPNE,which table are you referring to get this value, from the Structure or a data base table.

create an internal table with type

types: begin of ty_tab1,

menge type ekko-menge,

vkpne like calp-vkpne,

total type dmbtr,

end of ty_tab1.

populate the internal table by having a SELECT query on your relevant tables

loop at it_tab1 into wa_tab1.
wa_tab1-total = wa_tab1-menge * wa_tab1-vkpne.
modify it_tab1 from wa_tab1 transporting total.
endloop

Revert for further clarification

Thanks

Sri

5 REPLIES 5
Read only

Former Member
0 Likes
898

Hi

You Create an internal table with all your fields what ever is required along with fields menge,calp and total by reffering to their correspond ing data types.After that you fetch all the data related to thier fields into that internal table by using 'for all entreis'.After that you fetch data by reading all the tables with in the internal table loop and also while fetching the data into internal you can also do calculations as total etc.

Thiis is how you can fetch all the required data into an internal table along with calculations and you can display as you like.

Regards,

Adil

Read only

0 Likes
898

Thanks for the help. Is there a possibility you could put up some code examples or links to any tutorials online that wuld help me? Thanks again

Read only

0 Likes
898

Hello Mike!

Let me try help you...

For to create the internal table, you can do as follow:

TYPES: BEGIN OF TYPE ty_zzz,

menge type ekko-menge,

vkpne type calp-vkpne,

END OF ty_zzz.

TYPES: XXXX TYPE TABLE OF ty_zzz.

After that, you do your select´s into xxx table, and use for your propose.

I hope it helps you!

Read only

Former Member
0 Likes
899

Hi Mike,

My first doubt is, From where are you getting a value in the field CALP-VKPNE,which table are you referring to get this value, from the Structure or a data base table.

create an internal table with type

types: begin of ty_tab1,

menge type ekko-menge,

vkpne like calp-vkpne,

total type dmbtr,

end of ty_tab1.

populate the internal table by having a SELECT query on your relevant tables

loop at it_tab1 into wa_tab1.
wa_tab1-total = wa_tab1-menge * wa_tab1-vkpne.
modify it_tab1 from wa_tab1 transporting total.
endloop

Revert for further clarification

Thanks

Sri

Read only

Former Member
0 Likes
898

Thanks guys. I have it working now.Really appreciate the help!