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: 

trouble using my select with fro all entries

Former Member
0 Kudos
114

I have the following code and t_ztam-data is empty but it keeps pulling in all the records from /BIC/AZOS_O5900 in my second select. Do you know why it is doing this?

LOOP AT T_ORD_DATA INTO ls_data

WHERE sale_DOC_TYPE = 'ZLZM'.

LS_ZTAM_DATA = LS_DATA.

append ls_data to T_ZTAM_DATA.

ENDLOOP.

SELECT DOC_NUMBER S_ORD_ITEM SCHED_LINE DOC_TYPE REFER_DOC REFER_ITM

REQ_DATE /BIC/ZRELSDQTY /BIC/ZSHIPQTY /BIC/ZAVAILQTY

/BIC/ZTLTVALUE /BIC/ZSHIPNOS

INTO TABLE T_final_DATA

FROM /BIC/AZOS_O5900

FOR ALL ENTRIES IN T_ZTAM_DATA

WHERE

refer_doc = T_ZTAM_DATA-sales_order AND

refer_itm = T_ZTAM_DATA-SALES_ITEM AND

req_date = T_ZTAM_DATA-REQ_DATE AND

DOC_TYPE = 'ZTAM'.

1 ACCEPTED SOLUTION

former_member368216
Participant
0 Kudos
91

Before using for all entries check if the table T_ZTAM_DATA. has any entries.

If any entries then only go for the second select.

if t_ZTAM_DATA[] is not initial.

SELECT DOC_NUMBER S_ORD_ITEM SCHED_LINE DOC_TYPE REFER_DOC REFER_ITM

REQ_DATE /BIC/ZRELSDQTY /BIC/ZSHIPQTY /BIC/ZAVAILQTY......

ENDIF.

5 REPLIES 5

former_member368216
Participant
0 Kudos
92

Before using for all entries check if the table T_ZTAM_DATA. has any entries.

If any entries then only go for the second select.

if t_ZTAM_DATA[] is not initial.

SELECT DOC_NUMBER S_ORD_ITEM SCHED_LINE DOC_TYPE REFER_DOC REFER_ITM

REQ_DATE /BIC/ZRELSDQTY /BIC/ZSHIPQTY /BIC/ZAVAILQTY......

ENDIF.

0 Kudos
91

Does it aotomatically selcet all? I would think it would still come back empty

0 Kudos
91

Hi,

In your case if it is empty then system will select entries that have

DOC_TYPE = 'ZTAM'.

aRs

0 Kudos
91

Thanks that was very helpful!

Former Member
0 Kudos
91

HI ,

When ever you are using for all entries. ensure that you check its not initial before using in a select.. the behavious is if there are some records in this table then the select will get based on these entries. if it empty then it will get all the records from the select statement.

Thanks

Mahesh