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 problem BTCI - VC01

Former Member
0 Likes
1,407

Hi All

I have a BTCI for VC01 to create sales activity. We have a very peculiar issue with only some customers. It is related to the 'start of sales activity' date (Field - KTABG). I pass this from my function in this format DDMMYYYY. This works for majority of customers.

There are a select few customers however which fail, and when debugging in mode A, it tries to enter the date field like this YYYYMMDD. I am unsure as to why this behaviour would change on different customers?

EG. I pass 28082009 and it shows up like this on screen - 09201808

Can anyone relate to this issue or help? The only similarity between the customers it fails on is the Sales Org, Division and Distribution channel. However some of the customers with the same sales org etc work fine?

10 REPLIES 10
Read only

former_member156446
Active Contributor
0 Likes
1,212

Thats bcoz the some user have not maintained there date format and decimal format correct in there default settings.. in Own data..

to over come this.. you need to verify what are there settings.. using

SELECT SINGLE dcpfm  " THIS IS FOR DECIMAL VALIDATION
        FROM usr01
        INTO lv_decf
        WHERE bname = sy-uname.

and if the lv_decf is space or Y do one format else do another date format.

Read only

0 Likes
1,212

I don't think it is the users settings, I checked the users affected and it is set to the same as mine (DDMMYYYY).

Also I can post the exact same sales activity (All values exactly the same apart from customer number) to one customer and it will work fine. If I do the same for one of these customers the date comes through incorrectly.

Read only

0 Likes
1,212

Bump.. Still looking for an answer..

Read only

Former Member
0 Likes
1,212

HI,

This is because of different user settings.

In your program instead of moving the date directly into the date field use WRITE TO statement.

So that the date gets written as per whatever the date settings in the user format is.

Regards,

Ankur Parab

Read only

Former Member
0 Likes
1,212

Bump.. Just in case someone sees this..

Read only

0 Likes
1,212

the cause may be a bad usage of SET COUNTRY abap statement somewhere, which is not reset by a SET COUNTRY space right after it is not needed anymore. You may trace the use of this abap statement by looking at T005X table accesses.

Read only

0 Likes
1,212

Hi Sandra

I tried manually putting in a SET COUNTRY 'NZ' right before the BTCI call with no luck. I did a SQL trace on the call and no where is T005X accessed.

However something very strange happened after activating the trace. One activity went through fine. I then turned the trace off I couldn't get it to work again. I tried turning the trace back on and it still doesn't work. I am quite sure this is a SAP bug. I checked the table T005X and the date format is set as it should be DDMMYYYY. However for these customers it still tries to set to YYYYMMDD.

Read only

0 Likes
1,212

Check also SET LOCALE ... COUNTRY ... (put a break point on statement "SET LOCALE").

If it's still not that, I think you must explore all the possibilities : bug in your custom program which really fills in YYYYMMDD, screen field is not D type and the conversion is done by the report (but not always ), or it is D type but somewhere the date is changed by a DYNP_VALUES_UPDATE function module, etc.

You may also ask sap support because it's a very strange behavior and you have made all the investigations you could.

By the way you mentioned "EG. I pass 28082009 and it shows up like this on screen - 09201808"

I guess it was "EG. I pass 28082009 and it shows up like this on screen - 09202808"

Read only

0 Likes
1,212

I tried using that SET LOCALE but couldn't find my country NZ in the TCP0C table. It does seem to have strange behaviour as it worked once without me changing anything at my end. Also there is nothing else I can code to get this BTCI to behave differently. I have tried changing the date format, I have tried leaving it. Nothing seems to affect it.

That SET COUNTRY thing I think is on the right track though. I will update you when I hear back if you're interested.

Read only

Former Member
0 Likes
1,212

Hi,

Use this FM..

'CONVERT_DATE_TO_INTERNAL'

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
  EXPORTING
    date_external                  = pass ur date field here
*   ACCEPT_INITIAL_DATE            =
 IMPORTING
  DATE_INTERNAL                  = date field
 EXCEPTIONS
   DATE_EXTERNAL_IS_INVALID       = 1
   OTHERS                         = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Regards

Kiran