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

DTP Routine

Hi,

I want to fileter records where VALIDTO < SY-DATUM and VALID FROM > SY-DATUM where VALIDTO and VALID FROM are source fields. How can I write the code in DTP Routine to fileter the data as per the above scenario.

Thanks & regards

Ramesh

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Dec 12, 2011 at 09:02 AM

    found this on the net with a simple search...you could do the same

    DATA: WA_T_RANGE like line of L_T_RANGE.

    ...

    WA_T_RANGE-IOBJNM = '0CALMONTH'.

    WA_T_RANGE-FIELDNAME = 'CALMONTH'.

    WA_T_RANGE-SIGN = 'I'.

    WA_T_RANGE-OPTION = 'BT'.

    WA_T_RANGE-LOW = ZDATE.

    WA_T_RANGE-HIGH = ZDATE.

    APPEND WA_T_RANGE TO L_T_RANGE.

    i think you can use LT and GT instead of BT. LOW should be sy-datum. of course you have to change the names of the object and field

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 12, 2011 at 09:05 AM

    Hi,

    For Validto :-

    read table l_t_range with key fieldname = 'VALIDTO'.

    l_idx = sy-tabix.

    l_t_range-iobjnm = '0validto'.

    l_t_range-fieldnm = 'validto'.

    l_t_range-low = sy-datum.

    l_t_range-sign = 'I'.

    l_t_range-option = 'LT'.

    append l_t_range.

    For Valid from :-

    read table l_t_range with key fieldname = 'VALIDTO'.

    l_idx = sy-tabix.

    l_t_range-iobjnm = '0validfrom'.

    l_t_range-fieldnm = 'validfrom'.

    l_t_range-low = sy-datum.

    l_t_range-sign = 'I'.

    l_t_range-option = 'GT'.

    append l_t_range.

    Navesh

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi ,

      Yes the code seems to be correct but following modification needs to be done.

      Fieldname = 'VALIDTO'.

      There should not be any blank spaces. Field name should be same as given in the attribute list of the routine shown below in the Bold letters :-

      $$ end of global - insert your declaration only before this line -

      *

        • Fieldname = VALIDTO*

      • data type = DATS

      • length = 000008

      • *

        Remove following line just after updation of l_t_range table as this being taken care by the if statement following it :-

        append l_t_range

        Navesh

        Edited by: navsamol on Dec 12, 2011 1:37 PM

    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.