‎2006 Nov 17 4:13 PM
I have very limited ABAP experience, and need to convert
a date variable to an 8-character CHAR variable.
Is there a quick easy way to do this?
‎2006 Nov 17 4:15 PM
hi,
do this way ..
data : v_date like sy-datum,
v_char(8) type c.
v_char = v_date.Regards,
Santosh
‎2006 Nov 17 4:15 PM
hi,
do this way ..
data : v_date like sy-datum,
v_char(8) type c.
v_char = v_date.Regards,
Santosh
‎2006 Nov 17 4:16 PM
DATA: l_date TYPE dats,
l_date_c(8).
MOVE l_date TO l_date_c.
‎2006 Nov 17 4:19 PM
‎2006 Nov 17 4:27 PM
DATA: v_date1 TYPE string.
v_date1 = sy-datum.
WRITE / v_date1.
Regards
Kathirvel
‎2006 Nov 17 5:03 PM
Thanks for the responses. Let me expand the problem a bit:
1. I am trying to pass a date field into an existing(non-modifiable) function.
2. The function wants the field as something like DDATE in an 8-character
format.
3. When I try the date to C conversion, I still get the same error:
"The function module interface allows you to specify only fields
of a particular type under "DDATE". The field (my_field) has a different
field type.
How do I determine what field type it wants and what field type I am passing?
‎2006 Nov 17 5:04 PM
‎2006 Nov 17 5:05 PM
‎2006 Nov 17 5:15 PM
Hi
Declare your variable as
<b>
DATA: date type datum.</b>
pass your date to this field
date = yourdate.
pass this variable date to the function module#
This is because the Function Module type ddate is of the data element datum.
This should solve your problem<b></b>
‎2006 Nov 17 5:49 PM
I tried the datum declaration as follows:
DATA: ddate TYPE datum.
The remote function I am trying to call (a custom function, not SAP standard).
Here is what I am using to call the remote custom function:
call function 'Z_MY_PR_FUNCTION'
exporting
zekko = xekko
zekpo = xekpo
ddate = my_structure-delivery_date
importing
document_no = l_pr
tables
return = return
exceptions
others = 1.
My delivery_date variable(my_structure-delivery_date) is in the form of a date,
my ddate variable is of the type DATUM.
Here is some of the header information from the remote function(which will
eventually create a Purch. Requisition):
FUNCTION Z_MY_REMOTE_PR_FUNCTION.
*"----
""Local interface:
*" IMPORTING
*" REFERENCE(ZEKKO) LIKE EKKO STRUCTURE EKKO
*" REFERENCE(ZEKPO) LIKE EKPO STRUCTURE EKPO
*" REFERENCE(DDATE) TYPE CHAR8
*" EXPORTING
*" REFERENCE(DOCUMENT_NO) LIKE EBAN-BANFN
*" TABLES
*" RETURN STRUCTURE BAPIRET2
In this function, my DDATE variable gets assign to a bapiebanc-deliv_date variable.
‎2006 Nov 17 6:36 PM
Hi
Then the issue might be that the bapiebanc-deliv_date does not match the ddate that you have in your custom function module.
why dont you change the custom function module so that ddate is the same data element as bapiebanc-deliv_date.
then this should solve your problem
‎2006 Nov 17 7:59 PM
Thanks for all the reponses. I still have not resolved the problem.
After trying several of the suggestions here, I still end up with the
same problem. Even though I pass a character field which has been
assigned a date value, it gets passed as a date to the function, so
apparently ABAP does not have an implicit date-to-char conversion.
Here is a part of the output from the dump:
Name of formal parameter.......: "DDATE".
Name of actual paramter "DDATE".
Type of actual parameter "D".
Lenght of actual parameter 8.
Type of formal parameter "C".
Length of formal parameter 8.
Any suggestions? I'll try anything....