cancel
Showing results for 
Search instead for 
Did you mean: 

Function import does not convert Edm.DateTime parameters

Former Member
0 Kudos

Hello,

in my Gateway service, I have a function import CheckLeaveRequest which, among others, has the input parameter StartDate of type Edm.DateTime:

The service was generated when we were still on GW 2.0 SP6. Back then, everything worked fine when calling the function import


...CheckLeaveRequest?StartDate=datetime%272014-07-31T00%3A00%3A00.000%27&...

Later, we updated to SP7. By then, the function import was still working correctly as long as the service was no regenerated!

However, if the service is generated now, the function import does not work anymore, because the date and time input parameters are not getting converted! The input of method EXECUTE_ACTION now looks like this:

Before, in line 2 the value was already in internal ABAP format: 20140731.

Things I already tried that didn't help:

  • Update to GW 2.0 SP8
  • Use data element TIMESTAMP instead of BEGDA
  • Use Edm.Date instead of Edm.DateTime - that gave a syntax error in the model class (I guess because Edm.Date isn't supported anymore)

What is the trick to make the Gateway Framework convert my request parameters again?

Thanks,

Björn

Accepted Solutions (0)

Answers (3)

Answers (3)

AshwinDutt
Active Contributor

Hello,

To get Date in ' YYYYMMDD ' format in the DPC class , please do the following.

1.Make date property Nullable as shown in screen shot.

2.Go to the ABAP Type Editor as shown in the screen shot and use Internal Type as DATE.

3.Do not change the EDM Core type which is Edm.DateTime. Let it be the same.

4.Regenerate RunTime Objects.

5.Clear /iwfnd/cache_cleanup , /iwbep/cache_cleanup & smicm cache.

With this u will get Date as expected YYYYMMDD format in DPC.

Regards,

Ashwin

Former Member
0 Kudos

Hello Ashwin,

thanks for your elaborate post: I tried the suggestions, but it didn't help.

I would also like to point out that the StartDate does get properly converted in case of POST/PUT (or Create/Update Entity). The problem only lies in the function import.

Best regards,

Björn

Former Member
0 Kudos

Very strange:

If I look into the coding generated by SP6, it says


lo_parameter = lo_action->create_input_parameter( iv_parameter_name = 'StartDate'    iv_abap_fieldname = 'StartDate' ).
lo_parameter->bind_data_element( 'BEGDA' ).


Code generated by SP8:


lo_parameter = lo_action->create_input_parameter( iv_parameter_name = 'StartDate'    iv_abap_fieldname = 'StartDate' ). "#EC NOTEXT
lo_parameter->/iwbep/if_mgw_odata_property~set_type_edm_datetime( ).


If I manually add the line

lo_parameter->bind_data_element( 'BEGDA' ).

to the generated code, the input value does get converted!



Update:

I have found the corresponding SAP Note, which introduced this behaviour: 1818545

It says for program /IWBEP/I_SBMC_MPC_GEN_NEW

Delete block

@if new_actions-params-abaptype
@notinitial lo_parameter->bind_data_element( '$new_actions-params-abaptype$' )."#EC NOTEXT
@else


Unfortunately, I haven't found any followup note where this "correction" has been reverted". I guess I have to create a new OSS message.

former_member184867
Active Contributor
0 Kudos

Do not access the IT_PARAMETER directly.

Try using IO_TECH_REQUEST_CONTEXT->GET_PARAMETERS( ).

Former Member
0 Kudos

Hi Atanu,

that method returns exactly the same table as in my second screenshot above.

B.