Hi Experts,
I have the following situation: I created a “Save” button which contains the SLA calculation that fills a Date field and at the first click it does not work, only at the second and so on…
At the first time the field has the value: Incorrect data type for operator or @Function: Time/Date expected
In the other click it had: 02/11/2007
What could be the problem?
This is the formula:
@If((Status=“Assigned”) | ((ABAP_Required_old != ABAP_Required) | ((!@IsNewDoc ) & Priority != Priority_old));@Do(
TargetDay:= @DbLookup(“”:“NoCache”;“”;“SLA”;Application+TicketType+Priority+ABAP_Required;2);
TempDay:=@Adjust(DateAssigned;0;0;-1;0;0;0);
@TextToNumber(TargetDay);
@While(TargetDay > 0;
@Do(
TempDay:=@Adjust(TempDay;0;0;1;0;0;0);
TargetDay:=TargetDay - 1;
@If(@Weekday(TempDay) = 7 ; TempDay:=@Adjust(TempDay;0;0;2;0;0;0);“”);
@If(@Weekday(TempDay) = 1; TempDay:=@Adjust(TempDay;0;0;1;0;0;0);“”)
)
);
FIELD TargetDate:=TempDay;
@Set(“TargetDate”;TargetDate));TargetDate:=TargetDate);
FIELD Flag:=“1”;
@Set(“Flag”;Flag);
@If(!@IsValid;@Return(“”);“”);
@PostedCommand([FileSave]);
@If(Status=“Completed”;@DialogBox(“Survey”; [AutoHorzFit] : [AutoVertFit] : [NoCancel]);“”)