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

Retrieve data ?

Former Member
0 Likes
869

When i use this select statement , it retrieves only one SHNUMBER.

SELECT SHNUMBER

FROM OIGSVMQ INTO CORRESPONDING FIELDS OF TABLE i_tab

WHERE XXXXXXXXX .

then i taking values from YMA_OUTTURN for that SHNUMBER.

YMA_OUTTURN has 2 records for relevant SHNUMBER.

but after i loop i_tab_ou , it shows only one record.

SELECT OUTTURN REMARKS FROM YMA_OUTTURN

INTO TABLE i_tab_out FOR ALL ENTRIES IN i_tab WHERE REMARKS = i_tab-SHNUMBER .

LOOP AT i_tab_out.

WRITE :90 i_tab_out-OUTTURN .

ENDLOOP.

why it shows only one record

5 REPLIES 5
Read only

Former Member
0 Likes
774

Hi,

What are the clauses in where in first select query ?

May be that where condition itself restricts it to pick just one shnumber in the first place !!

Regards,

Salil.

Read only

0 Likes
774

Yes.thats true.

first select qry gives only one SHNUMBER.

but in second select qry, it has two record in YMA_OUTTURN table for that SHNUMBER.

in my second select qry , those values taken in to a internal table called i_tab_out .

when i loop i_tab_out , i shows only one record.

any prob with my second select qry ?

Read only

0 Likes
774

Hello,

Make sure you are selecting all key fields in your second select query. You should always select all key fields from the table when you are using for all entries in the where clause.

Include all key fields from table YMA_OUTRUN in your second select query, if not selected.

Regards,

Sachin

Read only

Former Member
0 Likes
774

hi,

For all entry also deleted the duplicate entries ....

regards

Gaurav

Read only

Former Member
0 Likes
774

Hi ,

if not i_tab[] is initial.

SELECT OUTTURN REMARKS FROM YMA_OUTTURN

INTO TABLE i_tab_out FOR ALL ENTRIES IN i_tab WHERE REMARKS = i_tab-SHNUMBER .

endif.

The 2 entries in YMA_OUTTURN are read as 1 record since u are using for all entries . In the where condition just enable any more key if u have a link to fetch 2 entries.

WHERE REMARKS = i_tab-SHNUMBER and key 2 = i_tab-?" something like this

Br,

Vijay.