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

assign date value to a variable using mask

edgar_almonte
Participant
0 Likes
1,864

hello

i am doing a program that read some file but the name of the file is dynamic base in a config table where i put the path, some prefix and subfix and a date mask

now i want convert any give date to the date format ( date mask ) that i get when i fetch the data form the config table something like this

select single * from config_table wa_something 
where key1 = something

write sy-datum using mask wa_something-datemask to vFinalvar.

but that not work , not sure if i explain right... but i will thanks any help

Thanks in advanced

3 REPLIES 3
Read only

Former Member
0 Likes
908

Hope you used the below syntax and missing 'edit' is a typo. What are the possible values in datemask of the config_table or mention atleast the one which didnt work?


WRITE SY-DATUM TO vFinalvar USING EDIT MASK wa_something-datemask.

Read only

0 Likes
908

Hope you used the below syntax and missing 'edit' is a typo. What are the possible values in datemask of the config_table or mention atleast the one which didnt work?

>

>


> WRITE SY-DATUM TO vFinalvar USING EDIT MASK wa_something-datemask.
> 

i try that too but i only get the mask write in the vFinalvar

( vFinalVar ='YYYYMMDD )

Read only

0 Likes
908

You have mistaken the usage of EDIT MASK. Plese refer to the below link...

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9e3d35c111d1829f0000e829fbfe/content.htm

As of now I can only think of the below solution for your problem.


Case wa_something-datemask.
  When 'DD/MM/YY'.
     WRITE SY-DATUM DD/MM/YYYY TO vFinalvar.
  When 'MM/DD/YY'.
     WRITE SY-DATUM MM/DD/YY TO vFinalvar.
* Similarly below formats....
....DD/MM/YYYY
....MM/DD/YYYY
....DDMMYY
....MMDDYY
....YYMMDD
Endcase.

or you may have to write your own logic to format the date into vFinalvar for the formats which are not supported by standard write.

Edited by: Suman Jagu on Jun 2, 2011 5:08 PM