cancel
Showing results for 
Search instead for 
Did you mean: 

From BUDAT to Posting Date

erdem_sephanelioglu
Participant
0 Kudos

Dear all,

I have an issue regarding converting BUDAT to FISCPER via ABAP code

Field Routine is as below

data: lv_string(7), lv_month(2), lv_year(4), lv_fper(7).

lv_month
= SOURCE_FIELDS-BUDAT+4(2).
lv_year
= SOURCE_FIELDS-BUDAT+0(4).

concatenate lv_month lv_year into lv_fper SEPARATED BY '.'.

concatenate '0' lv_fper into lv_string.
result
= lv_string.

As attachment you can see a test reult of the specific code.

I wonder why the output is bringing irrelevant data.

Thanks.


Accepted Solutions (0)

Answers (8)

Answers (8)

anshu_lilhori
Active Contributor
0 Kudos

Hi Eddy,

Can you please close the thread,if you think that your issue is resolved and query has been answered.

Regards,

AL

snitwipro
Active Participant
0 Kudos

Hi,

  Please use the function module DATE_TO_PERIOD_CONVERT and use I_PERIV = K4. Concatenate E_GJAHR and E_BUPER without any dot. Store the output to a local variable of type numc 7.

  If the result field is of type 0FISCPER, then system will convert the data and display with dot.

If you store RESULT = 2013001, then it will be displayed as 001.2013 automatically if you use info object 0FISCPER.

Hope this helps.

Regards

Sourav

Former Member
0 Kudos

Hi Eddy,

FISCPER field is of length 7 without any period operators. It stores in YYYYPPP format. Also you can just use the FM suggested by Martin, Kamal or with the code given by Anshu.

Thanks,

Karan Lokesh.

KamalMehta
Advisor
Advisor
0 Kudos

Hi Eddy ,

You can use available formula   : DATE_FISCPER(0CALDAY,'variant') with input as "BUDAT" and also Fiscal year variant.

Also Check if you can use Function Module

DATE_TO_PERIOD_CONVERT with input as "BUDAT" and also Fiscal year variant.

Thanks

RamanKorrapati
Active Contributor
0 Kudos

Hi Eddy,

At BW side FISCPER stored 7 digit value without any signs.

BUDAT = 11.09.2013 now your FISCPER will be 0092013. remove that signs.

Thanks

Former Member
0 Kudos

Hi Eddy,

Use the FM Martin suggested, or bear in mind that fiscper is stored as yyyyppp (2013009) in BW.

So no dots, and year first.

Regards,

Sjoerd

anshu_lilhori
Active Contributor
0 Kudos

Hi,

Just remove separated by . because if you are using standard infoobject for fiscper then the output length will automatically will be taken care.

Regards,

AL

anshu_lilhori
Active Contributor
0 Kudos

Hi,

Changed the code accordingly

data: lv_month(2) type n,

        lv_year(4) type n,

        lv_fper(7) type n.

lv_month = SOURCE_FIELDS-calday+4(2).

lv_year = SOURCE_FIELDS-calday+0(4).

concatenate lv_year '0' lv_month into lv_fper.

result = lv_fper.

Tested on my system.

Regards,

AL

MGrob
Active Contributor
0 Kudos

Hi

You need to bring the budat into the format yyyyppp no dots required.

You might just want to use the FM UMC_CALDAY_TO_FISCPER to convert it into fiscalyear period

hope it helps

Martin