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

Problem with date format

Former Member
0 Likes
802

Hi Guys,

I have requirement where i've to upload date in format ddmmyyyy thru a BDC. The date what i get may be in format ddmmyyyy or yyyymmdd . So, i've to change dynamically the date format to ddmmyyyy , no matter what format i receive.

SLS_MISC_GET_USER_DATE_FORMAT or DATE_CHECK_PLAUSIBILITY & a select statement on the table USR01 cannot be used , as the requirement demands dynamic chnage based on the given date. Experts plz suggest me a go.

4 REPLIES 4
Read only

Former Member
0 Likes
646

hi,

you can achieve it using WRITE TO command no matter whatever format of date taht you get..

for eg. WRITE sy-datum TO GD_DATE DD/MM/YYYY.

declare gd_date(10) as a character var...

if helpful, reward

Sathish. R

Read only

Former Member
0 Likes
646

Amber,

parameters: p_date(10) type c.

data: date type datum.

CALL FUNCTION 'DATE_STRING_CONVERT'

EXPORTING

DATE_FORMAT = 'YYYY.MM.DD'

DATE_STRING = p_date

  • START_DATE = SY-DATUM

IMPORTING

RESULT_DATE = date.

Pls. rward if useful

Read only

Former Member
0 Likes
646

hi

good

if you want to convert the date data dynamically before it upload into the table than you have to store the flat file data into a variable than convert it into the respective format using the if loop ,split statement and concatenate statement.

after converting the data into the respective format you save that into a varibale and upload it into the database table.

thanks

mrutyun^

Read only

Former Member
0 Likes
646

Hi Kumar,

while uploading the data declare one variable for date and while looping move date into that variable. after that use write to command like following.

<b>data : v_date(8) type c.

data: v_date1(10) type c.</b>

while Prepare the BDCDATA internal table, before uplaod the screen which have the date value declare these validations.

<b>move itab-date to v_date.

WRITE v_date TO v_date1 DD/MM/YYYY.</b>

Now pass <b>v_date1</b> value to the BDCDATA internal table.

Hope this helps you. Reply for queries.

Regards,

Kumar.