I am trying to assign a value to an Import parameter that will be unique every time the eCATT script runs. I have inserted a piece of Inline ABAP code that looks like this:
DATA: BEGIN of wa,
time_stamp TYPE P,
END OF wa.
GET TIME STAMP FIELD wa-time_stamp.
I_DATETIME = wa-time_stamp.
This only assigns a time stamp to I_DATETIME is the parameter is type V. Unfortunately, the script produces an error unless I_DATETIME is type I, however the Inline ABAP produces a syntax error when I_DATETIME is type I.
For example, when I_DATETIME is type V I see in my
LOG I_DATETIME statement that the value 20050518200719 or something similar has been assigned to that parameter. However, in the SAPGUI command interface where I deleted the original number value and replaced it with parameter I_DATETIME it reads: Value = I_DATETIME = '
Why can't I use parameters of type I and V interchangeably in the script and Inline ABAP? Is there an easier way to go about getting a time stamp or unique value for an Import Parameter?
Message was edited by: Ben Weisberg
there are two issues here:
<b>Parameter visibility in inline ABAP</b>
In inline ABAP, <b>only</b> local variables (visibilty V) can be used. The reason for this was to minimize the amount of data that has to be transferred to the target system of the script when the inline ABAP is generated.
<b>Avoiding inline ABAP where possible</b>
You said yourself that you suspect your approach is inefficient. I always tell people that inline ABAP can be fun, using the eCATT script language is better
You can generate yourself a timestamp in eCATT like this:
First, declare a parameter with type C. Since you are going to fill it in the script, there is no need for it to be an importing parameter - local variable (V) will do - let's call it V_TIMESTAMP.
Fill the field using <b>either</b>
V_TIMESTAMP = &DATE & &TIME
V_TIMESTAMP = sy-datum & sy-uzeit
<i>What's the difference?</i>
If you use the eCATT variables &DATE and &TIME, you will always get the date and time of the <b>current target system</b>. If you use the ABAP system fields sy-datum and sy-uzeit, you will always get the date and time of the <b>local eCATT system</b>. Obviously, if you are working locally in a system, these two sets of values will be the same. However, if you start working remotely - possibly against app servers in different time zones - you will have to decide which you want to use.
What is the best method for manipulating strings in eCATT? I have the sy-datum (&DATE) variable in the format 20050622 representing the date June 22nd, 2005 but I would like to convert this string to 06/22/2005 as different fields in SAP require different date formats. There are probably string manipulation methods that I could utilize through Inline ABAP but I would like to find a way using the eCATT scripting language.