cancel
Showing results for 
Search instead for 
Did you mean: 

DTP Routine

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Navesh,

Thanks for your help.

For VALID TO, I coded lik this...

&----


*& Include RSBC_SEL_ROUTINE_TPL

&----


program conversion_routine.

  • Type pools used by conversion program

type-pools: rsarc, rsarr, rssm.

tables: rssdlrange.

  • Global code used by conversion rules

$$ begin of global - insert your declaration only below this line -

  • TABLES: ...

  • DATA: ...

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

  • -------------------------------------------------------------------

  • Fieldname = VALIDTO

  • data type = DATS

  • length = 000008

  • -------------------------------------------------------------------

form compute_VALIDTO

tables l_t_range structure rssdlrange

using i_r_request type ref to IF_RSBK_REQUEST_ADMINTAB_VIEW

i_fieldnm type RSFIELDNM

changing p_subrc like sy-subrc.

  • Insert source code to current selection field

$$ begin of routine - insert your code only below this line -

data: l_idx like sy-tabix.

read table l_t_range with key fieldname = 'VALID TO'.

l_idx = sy-tabix.

l_t_range-iobjnm = '0valid to'.

l_t_range-fieldname = 'validto'.

l_t_range-low = sy-datum.

l_t_range-sign = 'I'.

l_t_range-option = 'LT'.

append l_t_range.

if l_idx <> 0.

modify l_t_range index l_idx.

else.

append l_t_range.

endif.

p_subrc = 0.

$$ end of routine - insert your code only before this line -

endform.

will it work now? Or do I need to un comment anything?

Thanks & regards

Ramesh

Former Member
0 Kudos

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

former_member186445
Active Contributor
0 Kudos

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