Skip to Content
author's profile photo
Former Member

selecting from an internal table

Can I select from an internal table? here is my code but it says WA_SCHED_DATA is not defined.

WA_SCHED_DATA[] = T_SCHED_DATA[].

loop at T_SCHED_DATA INTO LS_DATA.

IF LS_DATA-ORDER_QTY = 0.

SELECT VBELN POSNR sched_line DSDEL_DATE req_date ORDER_QTY

INTO TABLE TF_SCHED_DATA

FROM WA_SCHED_DATA

WHERE

VBELN = WA_SCHED_DATA-VBELN

POSNR = WA_SCHED_DATA-POSNR

DSDEL_DATE = WA_SCHED_DATA-REQ_DATE

SCHED_LINE NE WA_SCHED_DATA-SCHED_LINE.

ENDIF.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 06:02 PM

    Hi,

    loop at T_SCHED_DATA INTO LS_DATA.

    IF LS_DATA-ORDER_QTY = 0.

    read table wa_sched_data with key

    VBELN = LS_DATA-VBELN

    POSNR = LS_DATA-POSNR

    DSDEL_DATE = LS_DATA-REQ_DATE

    SCHED_LINE NE LS_DATA-SCHED_LINE.

    ENDIF.

    endloop.

    your wa_sched_data is not a database table from SAP that why it was throughing error that table not found.

    select can be used to select from data base only.

    if you want to read data from internal table you have to use read statements.

    Thanks,

    Deepak.

    Message was edited by:

    KDeepak

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 05:51 PM

    Hi,

    Check wa_sched_data declerations.

    But SELECT statements inside loop is not advisable as it will be performance issue.

    You can use for all entries on internal table t_sched_data.

    Thanks,

    Deepak.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      What you can do is instead of selecting inside loop first select all entries and then do a read inside the loop.This is much better in terms of performance since you reduce the database hits.

      If you need some more help on how to use select for all entries, let me know.

      Thanks

      Amruta

  • author's profile photo
    Former Member
    Posted on Aug 23, 2007 at 08:55 PM

    thanks to all

    Add comment
    10|10000 characters needed characters exceeded