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

give me solution

Former Member
0 Likes
529

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.

2 REPLIES 2
Read only

Former Member
0 Likes
508

if there is more than one enty use collect statement to add them...

regds

Read only

Former Member
0 Likes
508

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)