Application Development 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: 

Select statement

Former Member
0 Kudos
72

Hi Gurus,

I am fetching the Records from GLPCA TABLE according to selection-criteria as well as

for all entries in it_mara internal table(code given below).

but data base table having 18 records(as per selection criteria) my internal table having 14 records, the remaining four records are duplicate records in data base table.

there are four records with all field values are equal. but only one record is coming into internal table. remaining three are not coming

and there are two records with all field values are equal but only one record is coming into internal table. remaining one is not coming

but I awant that duplicate records also.

if any body know please give me the answer.

Regards,

Shashikumar.G

SELECT a~matnr

b~maktx

INTO TABLE it_mara

FROM mara AS a

INNER JOIN makt AS b

ON bmatnr = amatnr

AND b~spras = sy-langu

WHERE mtart = 'RAW'

AND matkl IN ('101', '102','103','104','105','106').

IF it_mara IS NOT INITIAL.

SORT: it_mara BY matnr.

SELECT rrcty

matnr

stagr

ksl

msl

INTO TABLE it_glpca

FROM glpca AS a

FOR ALL ENTRIES IN it_mara

WHERE matnr = it_mara-matnr

AND kokrs = p_kokrs

AND rbukrs = p_bukrs

AND gsber = p_gsber

AND rprctr = p_prctr

AND poper = p_period.

endif.

1 ACCEPTED SOLUTION

varma_narayana
Active Contributor
0 Kudos
45

Hi..Shasikumar..

<b>You have to fetch the Keyfield GL_SIRID of the Table GLPCA.</b>

So add this field in your Itab also...

Then it will give all those records .. otherwise it will return the distinct records.

IF it_mara IS NOT INITIAL.

SORT: it_mara BY matnr.

<b>SELECT

GL_SIRID </b>

rrcty

matnr

stagr

ksl

msl

INTO TABLE it_glpca

FROM glpca AS a

FOR ALL ENTRIES IN it_mara

WHERE matnr = it_mara-matnr

AND kokrs = p_kokrs

AND rbukrs = p_bukrs

AND gsber = p_gsber

AND rprctr = p_prctr

AND poper = p_period.

endif.

<b>reward if Helpful.</b>

2 REPLIES 2

varma_narayana
Active Contributor
0 Kudos
46

Hi..Shasikumar..

<b>You have to fetch the Keyfield GL_SIRID of the Table GLPCA.</b>

So add this field in your Itab also...

Then it will give all those records .. otherwise it will return the distinct records.

IF it_mara IS NOT INITIAL.

SORT: it_mara BY matnr.

<b>SELECT

GL_SIRID </b>

rrcty

matnr

stagr

ksl

msl

INTO TABLE it_glpca

FROM glpca AS a

FOR ALL ENTRIES IN it_mara

WHERE matnr = it_mara-matnr

AND kokrs = p_kokrs

AND rbukrs = p_bukrs

AND gsber = p_gsber

AND rprctr = p_prctr

AND poper = p_period.

endif.

<b>reward if Helpful.</b>

0 Kudos
45

Hi Varma,

My problem was solved with ur answer.

Thanks and Regards,

Shashikumar.G