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

very urgent function modules

Former Member
0 Likes
455

HI,

This is function module.actually i have retrieved some data in to itab (type

standard table)

They asked me to totaled the data of mseg on material and plant.

issued quantity should be caliculated at meterial and plant level using this logic.

(sum all quantity where movent type is equal to ztab-movement type and z_tab-x = 'X') - (sum of all quantyty (mseg) (where movent type of mseg) = z_tab-bwart and z_tab-x = 'Y')

can anybody send code to this logic.THis should be in function module so ...

Regards

SAISRI

1 ACCEPTED SOLUTION
Read only

former_member582701
Contributor
0 Likes
426

Can you exlain it clearly?

How many tables do u have? What field u need sum with what conditions...

regards

note: you are asking all time about the same. You have to reward always all helpfull answers please

3 REPLIES 3
Read only

former_member582701
Contributor
0 Likes
427

Can you exlain it clearly?

How many tables do u have? What field u need sum with what conditions...

regards

note: you are asking all time about the same. You have to reward always all helpfull answers please

Read only

0 Likes
426

i have retrieved data from mseg and stored in one table where werks in s_werks .

MJAHR

ZEILE

BWART

MATNR

MENGE

MEINS

ztable : contains BWART and indicator field indc.

Now this i_mseg data will be totaled on Material and plant.

Issued qty at material and plant level, will be calculated with following logic,

i. (Sum of all MSEG-MENGE where MSEG-BWRAT=Z_tab-BWRAT and z_tab-indc= “x”) – (Sum of all MSEG-MENGE (where MSEG-BWRAT=z_tab-bwart)and z_indc = “y”)

Regards

SAISRI

Read only

former_member582701
Contributor
0 Likes
426

DATA: BEGIN OF i_result OCCURS 0,

sum TYPE i,

matnr LIKE MARA-MATNR,

werks LIKE MARD-WERKS,

END OF i_result.

SORT i_mseg BY matnr werks.

LOOP AT i_mseg.

AT new werks.

CLEAR i_result.

ENDAT.

READ TABLE z_tab WITH KEY bwrat = i_mseg-bwrat

indc = 'x'.

IF SY-SUBRC EQ 0.

i_result-sum = i_result-sum + i_mseg-menge sum.

ENDIF.

READ TABLE z_tab WITH KEY bwrat= i_mseg-bwrat

indc = 'y'.

IF SY-SUBRC EQ 0.

i_result-sum = i_result-sum - i_mseg-menge sum.

ENDIF.

AT END OF werks.

i_result-matnr = i_mseg-matnr.

i_result-werks = i_mseg-werks.

INSERT TABLE i_result.

ENDAT.

ENDLOOP:

Try this.

Regard and remember reward

manel