on 2016 Mar 11 4:25 AM
Hi BI/Abap gurus,
I am trying to add 8 hours based on the source fields mapped.
I have google around and the FM seems promising.
sample source fields-crm_due_dt: 20141120163000
And I have tested in SE37, seems to be fine.
but loading data causes error below:-
Error |
---|
The function call of TIMESTAMP_DURATION_ADD failed; a field may have been assigned to the parameter TIMESTAMP_IN whose type is not c |
Any advice please?
CALL FUNCTION 'TIMESTAMP_DURATION_ADD'
EXPORTING
timestamp_in = SOURCE_FIELDS-crm_due_dt
timezone = 'UTC'
duration = '8'
unit = 'H'
IMPORTING
timestamp_out = RESULT.
Many thanks.
Request clarification before answering.
Hi Vincent
It seems to be just a data type conflict .
Define two temporary variables to pass and collect right format .
DATA: temp1 TYPE TZNTSTMPS,
temp2 TYPE TIMESTAMP .
Move source_fields-crm_due_dt to temp1 .
CALL FUNCTION 'TIMESTAMP_DURATION_ADD'
EXPORTING
timestamp_in = temp1
timezone = 'UTC'
duration = '8'
unit = 'H'
IMPORTING
timestamp_out = temp2.
Move temp2 to RESULT.
Clear temp1, temp2 .
Regards
Anindya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would put a DTP filter to only take those values in crm_due_dt which are not getting converted.
Put a break point in the field routine and run the DTP in debug mode.
You can also put a sy-subrc check before moving the value to "Result"
Write
if sy-subrc = 0.
move temp2 to result .
else.
move source_fields-crm_due_dt to result.
endif.
Above statement would not work as a solution but can point out possible problem.
Another important point, you need to perform Initial check before calling this function module.
If source_fields-crm_due_dt is not initial.
rest of the code
..........................
--------------------
endif .
If you pass '00000000000000' to this FM, it would take current time in UTC and add 8 hours to it.
That would be wrong calculation for you . See this portion of source code of this FM
Regards
Anindya
User | Count |
---|---|
31 | |
10 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.