Skip to Content

Interactive online Adobe – Editing Date and Time:

This blog is for beginners on interactive online Adobe form and deal with resolving issues which arise with editable date and time.

 When you have Date and time field Editable in interactive online adobe form you need to deal with below issues:

1. Error Free editing of date field.

2. Retrieving the date values entered on the form in webdynpro in correct format.

3. Value help for time field.

First of all if you have declared the date and time field referring to SAP type DATS and TIMS in WebDynpro context then form will not accept any values entered in date field and keep on displaying error “’YYYY-MM-DD’ is not a date”. Check the screen shot below:

Fig 1

 

In this example I have defaulted date and time using SY-DATUM and SY-UZEUT in webdynpro and this error appear as soon as any server event is triggered after form is displayed even if you do not change the default values. Due to this error your ABAP code is not even triggered.

Let’s see a demo on how to rectify first 2 issues related to date field editing:

Below is the structure which will be referred in WebDynpro context:

Fig 2

Please note that the type of date and time field refer to DATS and TIMS respectively.

Now let check the WebDynpro view context for properties created referring to above structure:

Fig 3

 This screen shot shows input helps are available for both date and time field CALENDAR and CLOCK respectively and if you create these field in WebDynpro view search helps will be available there but same is not the case with adobe forms.

Now let’s check the properties of these fields on adobe form when form is created directly from WebDynpro:

Fig 4

Let’s first get rid of this error message which comes for the date field saying error “’YYYY-MM-DD’ is not a date”. Use the below shown setting for date field in patterns to avoid this error message:

Fig 5

With the above setting you will not get error message on server trip and server side code (ABAP) will get triggered. But the issue is not yet fully resolved as you will not get correct value in sy-datum format check the debugger screen shot below: 

Fig 6

So the way out is to declare Date field as CHAR type in WebDynpro context and at adobe form level chose field type as date/Time format. Once this is done you will be able to enter data into fields but you need to set proper data format so that you can receive it in WebDynpro in proper format.

Below is how my changed DDIC structure will look like:

Fig 7

Update the context attribute from changed DDIC structure definition and do the same for view context.

Fig 8

Once these changes are done in WebDynpro application, then now define the binding at form and make date field of type “Date/Time field” at form level with the field layout settings same as shown in figure 5. This will resolve the first two issue related to data entry in date field and you will be able to edit the date field and at backend also you will get the correct value in SY-DATUM format.

Till this point we have rectified the first two issues mentioned about the date field in the beginning of blog and now let’s have a look over the workaround for  3rd issue related value help for time field.

Value help for time field in interactive Adobe form:

As of now interactive adobe does not have capability to show the values help for time field. Though the WebDynpro context field will show value help as TIMER but it will not appear on the adobe form.  The work around is to make actual time field as hidden and create 2/3 (depending on if seconds are required) drop down fields and then write small java script in initialization and exit event to bring the values from backend while loading and updating backend field when drop down values are changes. In SAP WebDynpro you also need to be careful about handling the proper display of initial values. So below is how my layout will look like after making this change:

Fig 9

Here I created two drop down field at form level (these do not exist at backend) one for hours (Named Hour)and another for minutes (Named Mins) and made original time field as invisible on form layout. Let the original binding for TIME field be as it is and the new layout field Hour and Mins do not require any binding.

Now use the below script in initialization event of form field Hour:

APPOINTMENT.DATA.Hour::initialize – (JavaScript, client)

// As this is a form field need to initialize it with backend data to reflect the new values

var lv_time;

lv_time = APPOINTMENT.DATA.Hour.rawValue;

this.rawValue = lv_time.substring(0,2);

// Handle case of Blank from backend when 00 was gone from front end

if ( this.rawValue == “” || this.rawValue == ” ” || this.rawValue == ”  ” )

    {

        this.rawValue = “00”;  

    }

And Below code in exit event of Hour field:

APPOINTMENT.DATA.Hour::exit – (JavaScript, client)

// Build time for back end

TIME.rawValue = APPOINTMENT.DATA.Hour.rawValue + APPOINTMENT.DATA.Mins.rawValue;

Below Java script is required in initialization event of Mins form field.

APPOINTMENT.DATA.Mins::initialize – (JavaScript, client)

// As this is a form field need to initialize it with backend data to reflect the new values

var lv_time;

lv_time = APPOINTMENT.DATA.Mins.rawValue;

if ( lv_time.substring(3,5) == “:”)

{

  this.rawValue = lv_time.substring(4,6);

}

else

{

this.rawValue = lv_time.substring(3,5);

}

// Handle case of Blank from backend when 00 was gone from front end

if ( this.rawValue == “” || this.rawValue == ” ” || this.rawValue == ”  ” )

    {

        this.rawValue = “00”;  

    }

 

Below Java script is required in exit event of Mins form field.

APPOINTMENT.DATA.Mins::exit – (JavaScript, client)

// Build contact time for back end

TIME.rawValue = APPOINTMENT.DATA.Hour.rawValue + APPOINTMENT.DATA.Mins.rawValue;

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Saurabh Chauhan
    Hi Gaurav,

    Thanks for sharing this information to handle one of the very common yet tricky requirement of Adobe forms. This will really be helpful in implmenting the required solutions.

    Regards,

    Saurabh Chauhan.

    (0) 
  2. Ajithkumar Krishnakumar
    The detailed explanation is nice.

    The only other approach is to split up and process the individual date/time digits in the web dynpro code and represent them individually in the form.  But this is not always feasible for all requirements.

    (0) 
    1. Gaurav Bharadwaj Post author
      Thanks for sharing your thoughts.

      Handling this at client side looks much neat to me and in cases where you might have some dependent validations at client side depending on the values entered you will save server trip.

      Regards,
      Gaurav B.

      (0) 

Leave a Reply