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

how to derive a date from a numeric value?!

Former Member
0 Likes
1,760

Hello SAP-Experts,

I have created a generic data source containing the field: “Period”  which is defined as a numeric value (MM.YYYY).

In order to fill the InfoObjects “0CALMONTH” and “0CALYEAR” we have developed a formula with the formula editor.

This formula does not work because if you want to use the LEFT, RIGHT and CONCATENATE functions of the formula editor it is necessary that the value in with the date is provided is a string value.

Does anybody know how to convert a numeric value into a string value?

Or does anybody know an alternative to the RIGHT, LEFT and CONCATENATE functions

RIGHT( 4, 'SPBUP' )

CONCATENATE( RIGHT( 4, 'SPBUP' ), LEFT( 2, 'SPBUP' ) )

Thank you for your help!

Holger

Hello SAP-Experts,

I have created a generic data source containing the field: “Period”  which is defined as a numeric value (MM.YYYY).

In order to fill the InfoObjects “0CALMONTH” and “0CALYEAR” we have developed a formula with the formula editor.

This formula does not work because if you want to use the LEFT, RIGHT and CONCATENATE functions of the formula editor it is necessary that the value in with the date is provided is a string value.

Does anybody know how to convert a numeric value into a string value?

Or does anybody know an alternative to the RIGHT, LEFT and CONCATENATE functions

RIGHT( 4, 'SPBUP' )

CONCATENATE( RIGHT( 4, 'SPBUP' ), LEFT( 2, 'SPBUP' ) )

Thank you for your help!

Holger

8 REPLIES 8
Read only

Former Member
0 Likes
1,425

hello,

try using FM "CONVERT_DATE_TO_EXTERNAL"

best regards,

swanand

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,425

Hi,

String accepts any kind of value, no matter it is of type c or type N

data:date(5) type n.

data:begin of wa,

     dd(2) type n,

     yy(4) type n,

     end of wa.

data:lv_str type string.

concatenate '01' '.' '2013' into date.

wa = date.  

lv_str = date.

If this did not answer your question, could you provide more details, I am not sure about the formula editor ( is it related to Bex Analyzer  functions ? )which is mentioned, but before entering the formula editor the value can be passed to string as above.

Read only

0 Likes
1,425

hi

one question for you. why my thread is deleted. I am aware of my question is very basic. but why? because you have the authority??!

peng tang

Read only

0 Likes
1,425

Hi peng tang,

Some of us here are provided with some rights to keep the forum clean, please read the ROE before posting a question

Read only

Former Member
0 Likes
1,425

Hi Holger,

                Try passing the numeric value to a string variable as below  .

data : lv_num TYPE n LENGTH VALUE '201301',

        lv_char TYPE c LENGTH 8.

lv_char = lv_num.

lv_char+6(2) = '01'.

Regards,

Vikram

Read only

Venkat_Sesha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,425

Hi Holger,

Check the below mentioned Function Modules list.

All are related to date and time calculations. That would help you.

http://wiki.sdn.sap.com/wiki/display/ABAP/Function+Module+related+on+Date+calculations

Hope this helps.

Read only

Former Member
0 Likes
1,425

Hi Holger,

You can simply create a new variable like :

data : l_char_date tyep char8

and do the casting operation , as;

l_char_date = numeric date

This will convert the numeric date to character

I hope this will work fine !

regards,

nitin

Read only

sahai
Contributor
0 Likes
1,425

Hi,

Try having a char type instead of numeric.

Let me know if this is mandatory for you to not have the char values.

Regards,

Shitanshu Sahai