Skip to Content
author's profile photo Former Member
Former Member

FILTER THE INTERNAL TABLE DATA BASED ON THE SELECTION SCREEN VALUES

HI EXPERTS .

COULD YOU PLZ TELL ME HOW TO FILTER THE DATA OF INTERNAL TABLE

BASED ON THE SELECTION SCREEN VALUES.

THE BELOW CODE IS NOT WORKING .

CAN YOU TELL ME WITH READ STATEMENT.

LOOP AT IT_MAIN1.

IF ( IT_MAIN1-TDLNR = S_TDLNR ) AND

(IT_MAIN1-ROUTE = S_ROUTE ).

APPEND IT_MAIN1 TO IT_FINAL.

ENDIF.

ENDLOOP.

THANKS

SURESH

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Posted on Sep 07, 2007 at 11:03 AM

    <b>LOOP AT IT_MAIN1 WHERE TDLNR IN S_TDLNR AND

    ROUTE IN S_ROUTE .</b>

    APPEND IT_MAIN1 TO IT_FINAL.

    ENDIF.

    ENDLOOP.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2007 at 11:05 AM

    Hello,

    Try this

    LOOP AT IT_MAIN1 WHERE TDLNR = S_TDLNR AND ROUTE = S_ROUTE .

    APPEND IT_MAIN1 TO IT_FINAL.

    ENDLOOP.

    Regards,

    LIJO

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2007 at 11:05 AM

    Hello Suresh,

    LOOP AT IT_MAIN1.

    IF ( IT_MAIN1-TDLNR <b>IN</b> S_TDLNR ) AND

    (IT_MAIN1-ROUTE <b>IN</b> S_ROUTE ).

    APPEND IT_MAIN1 TO IT_FINAL.

    ENDIF.

    ENDLOOP.

    Select option is an internal table with for fields: sign, option, low and high.

    you need to check the value in the internal table.

    U can use IT_MAIN1-TDLNR = S_TDLNR-LOW. (If you enter the value in left field of select option.), But it is not suggestable.

    Or else.. U can validate this in loop statement itself.

    LOOP AT IT_MAIN1 where IT_MAIN1-TDLNR <b>IN</b> S_TDLNR AND

    IT_MAIN1-ROUTE <b>IN</b> S_ROUTE .

    APPEND IT_MAIN1 TO IT_FINAL.

    ENDLOOP.

    Reward If Helpful.

    Regards

    --

    Sasidhar Reddy Matli.

    Message was edited by:

    Sasidhar Reddy Matli

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2007 at 11:06 AM

    Hi Sursh ,

    Try following code ,

    LOOP AT IT_MAIN1.

    IF ( IT_MAIN1-TDLNR = S_TDLNR-LOW OR

    IT_MAIN1-TDLNR = S_TDLNR-HIGH )

    AND

    (IT_MAIN1-ROUTE = S_ROUTE-LOW OR

    IT_MAIN1-ROUTE = S_ROUTE-HIGH ).

    APPEND IT_MAIN1 TO IT_FINAL.

    ENDIF.

    ENDLOOP.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 07, 2007 at 11:09 AM

    LOOP AT IT_MAIN1.

    <b>read table s_tdlnr with key tdlnr = it_main1-tdlnr.</b>

    if sy-subrc eq 0.

    <b>read table s_route with key route = it_main1-route.</b>

    if sy-subrc eq 0.

    APPEND IT_MAIN1 TO IT_FINAL.

    ENDIF.

    endif.

    ENDLOOP.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2007 at 11:14 AM

    hi,

    try like this,

    THIS BELOW CODE ONLY WORKS WHEN IT_MAIN1 IS A INTERNAL TABLE WITH HEADER LINE.

    LOOP AT IT_MAIN1 WHERE TDLNR = S_TDLNR AND ROUTE = S_ROUTE .

    IF SY-SUBRC EQ 0.

    APPEND IT_MAIN1 TO IT_FINAL.

    ELSE.

    MESSAGE 'NO RECORDS FOUND' TYPE 'I'.

    ENDIF.

    ENDLOOP.

    IF HELPFUL REWARD SOME POINTS.

    WITH REGARDS,

    SURESH ALURI.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 07, 2007 at 11:24 AM

    Hi Suresh,

    For select-options, you should use IN instead of equal sign.

    Try this.

    LOOP AT IT_MAIN1.

    IF ( IT_MAIN1-TDLNR <b>IN</b> S_TDLNR ) AND

    (IT_MAIN1-ROUTE <b>IN</b> S_ROUTE ).

    APPEND IT_MAIN1 TO IT_FINAL.

    ENDIF.

    ENDLOOP.

    or you can try using below code.

    DELETE IT_MAIN1

    WHERE TDLNR NOT IN S_TDLNR

    OR ROUTE NOT IN S_ROUTE.

    APPEND LINES OF IT_MAIN1 TO IT_FINAL.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.