Internal handling of unfilled Date and Time Fields

  • Richard Heininger
  • Richard Heininger's Avatar Topic Author
5 years 9 months ago #110 by Richard Heininger
Internal handling of unfilled Date and Time Fields was created by Richard Heininger

we are in the situation that we want to fill a structure, but not all fields of it. And this leads us to a problem with unfilled Date and Time fields:

All Fields that we set by code are fine, but all fields we don't even touch are having values if we send it to sap.
Each Date Field we did not touch has the value 18991230. ( Propably cuz the TDateTime in the background has a value of 0 ).

Is there anything we can do let this fields empty. So no 0 no 1899, or like if you do it in sap by hand '000000000'.

Thanks in advance

Please Log in to join the conversation.

  • Serge Volkov
  • Serge Volkov's Avatar
5 years 7 months ago #143 by Serge Volkov
Replied by Serge Volkov on topic Internal handling of unfilled Date and Time Fields
Hello Mr Heininger

To summarize the solution we discussed by email.

Really, Date/Time fields are represented via TDateTime and the value "1899..." is the default value of this type's instances.
In case of unfilled fields the value should not be sent to SAP.
But on the other side, the type TDateTime itself can not indicate if the value is default/initial (and so should not be sent to SAP) or Programmer just really wants to use the value (and so it should be sent to SAP).

After some checks we have implemented the following approach in the "Connect for SAP" 4.0.7 for handling of the case.
Initially, any Date/Time items have a special value that equivalent to "00.00.0000"/"00:00:00". This value indicates that the default value "0000..." is set on SAP.
Some info about construction of the special value is described here .

We have added some useful functionality for working with the special "Unassigned" value. So you don't need to create this special value manually. See the SAPx class "TSAPxNWDateTimeUtilsGS" in the unit gsSAPxNWCoreUtils.
Using this utility-class you can, for example, set such "Unassigned" values to your fields/parameters to return them back to "0000..." on SAP. Or check if a DateTime field is already Unassigned, or convert to/from string, etc...

Please Log in to join the conversation.

Contact US

  • gs-soft AG

    Delfterstrasse 10

    CH-5000 Aarau


    +41 62 832 20 40
    This email address is being protected from spambots. You need JavaScript enabled to view it.

  • Language