cancel
Showing results for 
Search instead for 
Did you mean: 

routine as selection in infopackage

Former Member
0 Kudos

Hello,

In infopackage I need to select current and previous month. What would be better : OLAP variable or ABAP routine?

If ABAP routine please tell how it returns the value.

Accepted Solutions (0)

Answers (2)

Answers (2)

edwin_harpino
Active Contributor
0 Kudos

hi,

for abap routine, try following code :

data: l_idx like sy-tabix,

l_month(6) type c,

l_dtlastmonth like sy-datum.

read table l_t_range with key

fieldname = '[your field month]'.

l_idx = sy-tabix.

*....

DELETE l_t_range

WHERE iobjnm = '[month infoobject name]'

and fieldname = '[your field month]'.

L_t_RANGE-SIGN = 'I'.

L_t_RANGE-OPTION = 'EQ'.

  • current month

concatenate sy-datum3(2) sy-datum0(4) into l_month.

L_t_RANGE-LOW = l_month.

append l_t_range.

  • last month

clear l_month.

l_dtlastmonth = sy-datum - 31.

concatenate l_dtlastmonth4(2) l_dtlastmonth0(4) into l_month.

L_t_RANGE-LOW = l_month.

append l_t_range.

modify l_t_range index l_idx.

p_subrc = 0.

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

endform.

Former Member
0 Kudos

In this code please tell me how can i get data which is for current week and then just the one 10 weeks ago.So just 2 of them.This week and this week - 10.

Please just provide me the modifications as its a bit confusing and the requirement is urgent

data: l_idx like sy-tabix,

l_month(6) type c,

l_dtlastmonth like sy-datum.

read table l_t_range with key

fieldname = '[your field month]'.

l_idx = sy-tabix.

*....

DELETE l_t_range

WHERE iobjnm = '[month infoobject name]'

and fieldname = '[your field month]'.

L_t_RANGE-SIGN = 'I'.

L_t_RANGE-OPTION = 'EQ'.

  • current month

concatenate sy-datum3(2) sy-datum0(4) into l_month.

L_t_RANGE-LOW = l_month.

append l_t_range.

  • last month

clear l_month.

l_dtlastmonth = sy-datum - 31.

concatenate l_dtlastmonth4(2) l_dtlastmonth0(4) into l_month.

L_t_RANGE-LOW = l_month.

append l_t_range.

modify l_t_range index l_idx.

p_subrc = 0.

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

endform.

Thanks

Former Member
0 Kudos

U can create a ABAP Routine of the type 6 (ABAP Routine),The field you are trying to populate is a select-option so you have to define both Sign and Option along with Low and High values.

As u want to load current month, from a system values , u can do it from sy-datum.

data: l_idx like sy-tabix.

read table l_t_range with key

fieldname = ''/BIC/Z_APOSNAP'.

l_idx = sy-tabix.

l_t_range-low =

l_t_range-high =

l_t_range-sign =

l_t_range-option =

modify l_t_range index l_idx.

p_subrc = 0.

Just u can fill Sign as 'I' and Option 'EQ'.

Fill Low and High with values u get from System Data.

Hope this Helps

Regards