2007 May 28 7:02 AM
Hi abap gurus,
I have one selection screen fields i:e mblnr and mjahr. mblnr is range. and i have to get mseg-matnr,makt-maktx,mseg-meins,resb-bdmng and mseg-menge. where we have to display single item of matnr of perticular mblnr.if there is more than one matnr with same matnr we have to add menge and display single item.to display bdmng there is mblnr=s_mblnr and resb-rspos=mseg-rspos and resb-rsnum=mseg-rsnum.
plz give solution to this.
thanking you.
Hi abap gurus,
I have one selection screen fields i:e mblnr and mjahr. mblnr is range. and i have to get mseg-matnr,makt-maktx,mseg-meins,resb-bdmng and mseg-menge. where we have to display single item of matnr of perticular mblnr.if there is more than one matnr with same matnr we have to add menge and display single item.to display bdmng there is mblnr=s_mblnr and resb-rspos=mseg-rspos and resb-rsnum=mseg-rsnum.
plz give solution to this.
thanking you.
2007 May 28 7:06 AM
if there is more than one enty use collect statement to add them...
regds
2007 May 28 7:16 AM
hi,
use "<b>COLLECT</b>" statement.
*If you use only COLLECT to fill an internal table, COLLECT makes sure that the internal table does not contain two entries with the same default key fields.
*If, besides its default key fields, the internal table contains number fields (see also ABAP/4 number types ), the contents of these number fields are added together if the internal table already contains an entry with the same key fields.
*If the default key of an internal table processed with COLLECT is blank, all the values are added up in the first table line.
ex-
DATA: BEGIN OF COMPANIES OCCURS 10,
NAME(20),
SALES TYPE I,
END OF COMPANIES.
COMPANIES-NAME = 'Duck'. COMPANIES-SALES = 10.
COLLECT COMPANIES.
COMPANIES-NAME = 'Tiger'. COMPANIES-SALES = 20.
COLLECT COMPANIES.
COMPANIES-NAME = 'Duck'. COMPANIES-SALES = 30.
COLLECT COMPANIES.
for Duck sales value will be 40(10+30)
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |