Skip to Content
author's profile photo
Former Member

trouble using my select with fro all entries

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'.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Posted on Aug 21, 2007 at 06: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.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 21, 2007 at 06: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

    Add comment
    10|10000 characters needed characters exceeded