Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function module

Former Member
0 Likes
253

Hi all,

I need a function module that would return me the quater basec on the period key.

I have the period key, as 1q08, or may be 2q07..and the period key may also be in MMYY format....So i want a FM to which passing this value i should get the value 1st quater....2 nd quater....or if its in MMYY format..then January 2008....

I have written a code for this but that doesnt seem to work.



*FOR KEY PERIOD FORMATTING
if keyprd+0(2) ca 'q' or keyprd+0(2) ca 'Q'.
  if keyprd+0(2) eq '1q'. mn = 'March'.    endif.
  if keyprd+0(2) eq '2q'. mn = 'June'.     endif.
  if keyprd+0(2) eq '3q'. mn = 'September'.endif.
  if keyprd+0(2) eq '4q'. mn = 'December'. endif.
else.
select single ltx into mn
from t247
where spras = 'EN'
and mnr = keyprd+0(2).
endif.

Could anybody help me in this.

1 REPLY 1
Read only

Former Member
0 Likes
234

Runal,

Am not sure for this specific purpose we have any FM.

i think you have to modified your code as:

if keyprd+0(2) ca 'q' or keyprd+0(2) ca 'Q'.
  if keyprd+0(2) eq '1q' or if keyprd+0(2) eq '1Q'. mn = 'March'.    endif.
  if keyprd+0(2) eq '2q' or if keyprd+0(2) eq '2Q'. . mn = 'June'.     endif.
  if keyprd+0(2) eq '3q' or if keyprd+0(2) eq '3Q'. . mn = 'September'.endif.
  if keyprd+0(2) eq '4q' or if keyprd+0(2) eq '4Q'. . mn = 'December'. endif.
else.
select single ltx into mn
from t247
where spras = 'EN'
and mnr = keyprd+0(2).
endif.

Now it should work.

Amit.