Convert-Exception with Timefields and "24:00:00"

  • Ulrich
  • Ulrich's Avatar Topic Author
3 years 8 months ago #93 by Ulrich
Hello!

Sometimes when I execute a BAPI-function via netweaver (sapx 4.0.3) I got a convert exception in time-fields. The reason for that are values like "24:00:00" (correct value from SAP-database - but not correct for delphi-Tdatetime).

With RFC the functions executes sucecssfull but the access to timefields with these special values leads into the convert exception. Thats OK for me. With NW the execution of functions with such result values leads to the convert exception.

Naturally i dont want to convert "24:00" to delphi-TDatetime. The nw-components should ignore that values.

Any ideas to get a fast workaround for that problem?

Ulrich

Please Log in to join the conversation.

  • Serge Volkov
  • Serge Volkov's Avatar
3 years 8 months ago #94 by Serge Volkov
Replied by Serge Volkov on topic Convert-Exception with Timefields and "24:00:00"
Hello Ulrich.

Could you please provide us with a code example of how exactly you try to set the value for the time-field?

The following example should work:
procedure SetTime(AFunction: TSAPxNWClientFunctionGS);
begin
  AFunction.InParameterByName('TimeParameter').AsString := '240000'; // 24:00:00
end;

Please Log in to join the conversation.

  • Ulrich
  • Ulrich's Avatar Topic Author
3 years 7 months ago #95 by Ulrich
Hello Serge,

I don't set that time value. I get the exception while I execute some functions with "ExecFunction" because a field of an outparameter has that value.

;)

Please Log in to join the conversation.

  • Ulrich
  • Ulrich's Avatar Topic Author
3 years 7 months ago #97 by Ulrich
Hello Serge,

the exception raises at "ExecFunction" because a timefield of an outparameter has the value "24:00:00"

;)

Please Log in to join the conversation.

  • Serge Volkov
  • Serge Volkov's Avatar
3 years 7 months ago - 2 years 1 week ago #98 by Serge Volkov
Replied by Serge Volkov on topic Convert-Exception with Timefields and "24:00:00"
Hello Ulrich

To see a solution or a workaround, we need to understand where exactly (in ExecFunction) and why the exception occurs.
For that could you please send us the following information:
1. Please reproduce the error with enabled "SAPx Tracing" (see " how to enable tracing ") and send us the created Trace-file ("SAPxNW<...>.trc")
2. What is the ABAP type of the time-field? ("TIME", ... ?).
2.1. Do you call a "standard" SAP function? If yes - what is it? It would be helpful for reproducing the error on our side.

The nw-components should ignore that values.

Not sure what exactly your case is, but perhaps it could be helpful.
SAPx allows calling of SAP RFCs using a partial set of parameters (only ones you actually want to set/get).
Please check the Client Demo "RfcCall" for an example.
In case you don't need some parameters (e.g. the "time-field") - you can consider to initialize SAPx Function only with actually required parameters.
Last edit: 2 years 1 week ago by gs_mschoch.

Please Log in to join the conversation.

  • Ulrich
  • Ulrich's Avatar Topic Author
3 years 7 months ago #99 by Ulrich
Hello Serge!

thank you for your reaction. Here are my answers:

1. The exception raises in EncodeTime, when aBuffer is "240000":
function SAPxNWParseTime(const ABuffer: string): TDateTime; overload;
var
  iHour, iMin, iSec: Word;
begin
  SAPxNWParseTime(ABuffer, iHour, iMin, iSec);
  Result := EncodeTime(iHour, iMin, iSec, 0);
end;

2. The callstack is:

- TSAPxNWClientFunctionGS.ExecFunction
- Outparameters.RefreshValues (TSAPxNWParameterCollectionGS)
...
- TSAPxNWValueAdapterBaseGS.GetAsTime
- TSAPxNWTransportValueAdapterGS.InternalGetAsTime
- SAPxNWParseTime

The internal Datatype of the field is dtTimeGS.

3. The field (MOVEMNT_ENDTIME) with the exception is part of an outparameter-structure (NEW_MOVEMNT_DATA). I am not sure about the ABAP-Datatype. SAP_GUI describes it as TIMS. (ABAP-Type T with internal length 12).

4. The called function is BAPI_PATCASE_CHANGEINPATADMISS. But the exception should in every function be raised, when there is "240000" in a timefield.

5. When I delete the the outparameter called NEW_MOVEMNT_DATA, there is no problem. I tried also to delete the subfield, but it didn't help.
But erasing can't be the solution, because sometimes I need the value of timefields or other fields from a structure.

6. Do you already need the "SAPx Tracing"? Maybe the information above are enough.

Please Log in to join the conversation.

Contact US

  • gs-soft AG

    Delfterstrasse 10

    CH-5000 Aarau

    Switzerland

    Phone:
    +41 (0)62 832 20 40
    E-Mail:
    This email address is being protected from spambots. You need JavaScript enabled to view it.


  • Language