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

date format conflict while running BDC

Former Member
1,005

hi techies,

i want to populate sy-datum + 1 to one field tcode vk14.

so what i did is i created variale with length 10 and passing sy-datum + 1 to it.

it is taking sy-datum as raw format and it is changing format w.r.to user.

like '20070511' is converted into '20.07.0511' as user format is 'MM.DD.YYYY'.

so, what exactly i want is to give sy-datum + 1 ( character field with length 10)

by checking user profile automatically.

ex if user profile is 'DD/MM/YYYY' then the variable value should be 05/11/2007.

if user profile is 'YYYY.MM.DD' the the variable value should be 2007.11.05.

please try to find out what to do?

1 ACCEPTED SOLUTION
Read only

varma_narayana
Active Contributor
0 Likes
868

Hi Rama..

this problem arises bcoz the Values to the Screen fields must be supplied in External (User specific) Format.

So u have to convert the Date from internal format (YYYYMMDD) to External format using the FM

CONVERSION_EXIT_PDATE_OUTPUT

Then pass the Date field in BDC.

<b>reward if Helpful.</b>

6 REPLIES 6
Read only

Former Member
0 Likes
868

Hi,

Use the write statement..

It will change the format according to the user settings..

EX..

data: v_char(10).

write: sy-datum to v_char.

Thanks

Naren

Read only

0 Likes
868

hi kumaran.

its okay.

wat my question is how do pass date format 'YYYY/DD/MM' to v_char.

if it is sy-datum it is not taking that format into consideration. only date it is taking into consideration.

Read only

varma_narayana
Active Contributor
0 Likes
869

Hi Rama..

this problem arises bcoz the Values to the Screen fields must be supplied in External (User specific) Format.

So u have to convert the Date from internal format (YYYYMMDD) to External format using the FM

CONVERSION_EXIT_PDATE_OUTPUT

Then pass the Date field in BDC.

<b>reward if Helpful.</b>

Read only

0 Likes
868

thanks varma,

i think it will work.

Read only

Former Member
0 Likes
868

HI,

By using the WRITE statement it will automatically invoke the user settings..

data: v_char(10).

write: sy-datum to v_char..

Then use the variable V_CHAR for populating the BDC for the date field.

Thanks

Naren

Read only

0 Likes
868

Hi,

Select the date format from user settings(Table USR01) and call the below perform..

FORM CONVERT_DATE_FORMAT CHANGING P_DATE.

CONSTANTS: C_DOT(1) VALUE '.',

C_SLASH(1) VALUE '/',

C_DASH(1) VALUE '-',

C_COMMA(1) VALUE ',',

C_DATE1 LIKE USR01-DATFM VALUE '1',

C_DATE2 LIKE USR01-DATFM VALUE '2',

C_DATE3 LIKE USR01-DATFM VALUE '3',

C_DATE4 LIKE USR01-DATFM VALUE '4',

C_DATE5 LIKE USR01-DATFM VALUE '5',

C_DATE6 LIKE USR01-DATFM VALUE '6'.

CASE V_DATFM.

WHEN C_DATE1. "DD.MM.YYYY

CONCATENATE: P_DATE+6(2)

P_DATE+4(2)

P_DATE(4)

INTO P_DATE

SEPARATED BY C_DOT.

WHEN C_DATE2. "MM/DD/YYYY

CONCATENATE: P_DATE+4(2)

P_DATE+6(2)

P_DATE(4)

INTO P_DATE

SEPARATED BY C_SLASH.

WHEN C_DATE3. "MM-DD-YYYY

CONCATENATE: P_DATE+4(2)

P_DATE+6(2)

P_DATE(4)

INTO P_DATE

SEPARATED BY C_DASH.

WHEN C_DATE4. "YYYY.MM.DD

CONCATENATE: P_DATE(4)

P_DATE+4(2)

P_DATE+6(2)

INTO P_DATE

SEPARATED BY C_DOT.

WHEN C_DATE5. "YYYY/MM/DD

CONCATENATE: P_DATE(4)

P_DATE+4(2)

P_DATE+6(2)

INTO P_DATE

SEPARATED BY C_SLASH.

WHEN C_DATE6. "YYYY-MM-DD

CONCATENATE: P_DATE(4)

P_DATE+4(2)

P_DATE+6(2)

INTO P_DATE

SEPARATED BY C_DASH.

WHEN OTHERS.

ENDCASE.

ENDFORM. " CONVERT_DATE_FORMAT

Thanks...