2007 Aug 21 7:14 PM
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'.
2007 Aug 21 7:35 PM
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.
2007 Aug 21 7:35 PM
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.
2007 Aug 21 7:37 PM
Does it aotomatically selcet all? I would think it would still come back empty
2007 Aug 21 7:42 PM
Hi,
In your case if it is empty then system will select entries that have
DOC_TYPE = 'ZTAM'.
aRs
2007 Aug 21 7:43 PM
2007 Aug 21 7:40 PM
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