Application Development 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: 

date format issues in BDC session.

former_member192818
Active Participant
0 Kudos

Hi,

I wrote a BDC program. I programmed it for the date format mm/dd/yyyy. This works fine when I run the BDC session on my R/3 client.

When the support group runs the same BDC session, they get an error message "Enter date in mm.dd.yyyy".

Question:

Why is there a difference when I run the program, or, when a person from the support group runs the program on a different client of the same server.

Could we both be having different settings for date entry for the R/3 client?

If so where can I change the settings for a client from the mm.dd.yyyy format to mm/dd/yyyy format or vice versa?

The code I am using to create the mm/dd/yyyy date from Sy-datum is:

move sy-datum to adjdat.
CONCATENATE adjdat-mm '/' adjdat-dd '/' adjdat-yyyy INTO formatted_date.

Is there any generic code I can write so the date adjusts to the current user settings?

Thank you for your help.

Sumit.

1 ACCEPTED SOLUTION

LucianoBentiveg
Active Contributor
0 Kudos

Use a single WRITE:

WRITE sy-datum to formatted_date.

From this way, system take the date user format.

Regards.

12 REPLIES 12

LucianoBentiveg
Active Contributor
0 Kudos

Use a single WRITE:

WRITE sy-datum to formatted_date.

From this way, system take the date user format.

Regards.

0 Kudos

Thanks Peluka.

Best Wishes, Sumit.

Former Member
0 Kudos

Hi,

the date fomate will be different from user to user. you can change the format using the path

From the SAP easy access screen

System-> user profile-> own data->defaults

sudheer.A

Message was edited by: sudheer Addepalli

Message was edited by: sudheer Addepalli

0 Kudos

Sudheer,

Thanks a lot.

Best Wishes.

Sumit.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, please do the conversion using the function module below. It will take into account the user specific settings.




data: datum(10) type c.


call function 'CONVERT_DATE_TO_EXTERNAL'
  EXPORTING
    DATE_INTERNAL                  = SY-DATUM
  IMPORTING
    DATE_EXTERNAL                  = datum.

Regards,

Rich Heilman

0 Kudos

Rich, Thanks for the quick response. Much appreciated.

Best Wishes Sumit.

Former Member
0 Kudos

define a variable of length of 10 char and use write statement. Using write statement fill the date into this variable. This variable is filled with the required format.

data : v_date(10) type c.

write sy-datum to v_date.

hope this helps.

thanks,

vamshi

0 Kudos

Vamshi,

Thanks for the quick response.

Sumit.

Former Member
0 Kudos

If you simply:

WRITE sy-datum to formatted_date.

It should work. Make sure that formatted_date is declared as 10 characters.

Rob

0 Kudos

Hey Rob,

Thanks for the quick answer.

Sumit.

0 Kudos

Not sure which solution you went with, but please mark the answer which has solved your problem with "Solved". This shows that your question has been answered and gives more visibility when others are searching for answer to a simular question.

Regards,

Rich Heilman

0 Kudos

No matter what, if you are creating BDC sessions to be processed later by either RSBDCSUB program or SM35, the user who ran the program that created the sessions and the user who is processing the sessions should be using the same date format. So let us say you wrote program ZTEST which creates BDC sessions for VA01. User X runs your program and creates the sessions. User Y then goes to SM35 to process those sessions. Both X an Y should be using the same date format in their profile for the session to work properly. That is the theory behind this. Instead, in your ZTEST program, if you do a submit of RSBDCSUB, then you will not run into this issue because the same user will be involved in both creating and processing the sessions.