‎2007 May 29 12:15 PM
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
‎2007 May 29 12:26 PM
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
‎2007 May 29 12:26 PM
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
‎2007 May 29 12:49 PM
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
‎2007 May 29 1:27 PM
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