cancel
Showing results for 
Search instead for 
Did you mean: 

ERROR:"Invalid or no mapping to system data types found" in Gateway Client

Former Member
0 Kudos

Hello experts:

         I want to use http method 'post' to upload file to internal table,and after I redefine 'create_stream' in my DPC and test it in Client,It shows "Invalid or no mapping to system data types found".



this is my MPC:


lo_entity_type = model->create_entity_type('File').

lo_entity_type->set_is_media( 'X' ).

lo_property = lo_entity_type->create_property( iv_property_name  ='Mandt    iv_abap_fieldname = 'MANDT').

lo_property = lo_entity_type->create_property( iv_property_name  ='Filename'  iv_abap_fieldname = 'FILENAME').

lo_property->set_is_key( ).

lo_property = lo_entity_type->create_property( iv_property_name  ='Sydate' iv_abap_fieldname = 'SYDATE').

lo_property = lo_entity_type->create_property( iv_property_name  ='Sytime' iv_abap_fieldname = 'SYTIME').

lo_property = lo_entity_type->create_property( iv_property_name  ='Value'  iv_abap_fieldname = 'VALUE').

lo_property = lo_entity_type->create_property( iv_property_name  ='Mimetype' iv_abap_fieldname = 'MIMETYPE').

lo_entity_type->bind_structure( 'Z_CL_MODEL_PROVIDER=>FILE' ).

lo_entity_type->create_entity_set( 'FILESET' ).


this is my DPC:

method/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_STREAM.

DATA ls_excel                     TYPE ZEXCELDETAIL.

         ls_excel-mimetype = is_media_resource-mime_type.

         ls_excel-filename = iv_slug.

         ls_excel-value = is_media_resource-value.

         copy_data_to_ref( EXPORTING is_data = ls_excel

                           CHANGING  cr_data = er_entity ).



Is anyone knows how to fix with it?

Thanks!!!!!!!



Regards,

Cao

Accepted Solutions (0)

Answers (3)

Answers (3)

SyambabuAllu
Contributor
0 Kudos

Hi Zhiyu,

Please Cross verify the Ashwin Last reply and verify one more time MPC_EXT code you placed it correctly or not..max this error will come based on MPC coded bounded .

Let me know if you need more info on this.

Thanks,

Syam

AshwinDutt
Active Contributor
0 Kudos

Hello Cao,

Please first clear your model cache in your GW System and check again.

/iwfnd/cache_cleanup.

Please refer this as well and make the necessary chages in MPC_EXT class inside the Define Mehod.->

Regards,

Ashwin

Former Member
0 Kudos

Hello Ashwin

          I read the reference you give to me,and I give chang my MPC_EXT,but it shows like this:

this is my MPC_EXT,is there any errors with my codes?

Former Member
0 Kudos

Hello,

this is my define before redefine:

and after I redefine "define" and write codes above,it will be errors like that(above)......

can you help with the logic? thanks.....

Former Member
0 Kudos

Hi Cao,

Just noticed that in redefine you have mentioned model->set_schema_namespace().

I dont think this is required.

Please comment this line if its not required for any specific purpose and re run the service.

Regards,

Aashika

Former Member
0 Kudos

Hello Aashika,

       I have commented this line and still errors......

Regards,

Zhiyu

Former Member
0 Kudos

Cao,

If I am correct you have created the Odata using SEGW? Can you please share the runtime artifacts which are generated. Want to check if the Model for the service has been created or not.

Regards,

Aashika

Former Member
0 Kudos

hi,

this is my segw:

Former Member
0 Kudos

Also please show runtime artifacts.

It looks like this:

Regards,

Aashika

Former Member
0 Kudos

Hello Aashika,

          this is my runtime artifacts:


AshwinDutt
Active Contributor
0 Kudos

Hello Cao,

After you add code in MPC_EXT class of Define method,

I see that your URL is wrong now.

You are using GET method instead of POST.

You have not attached any attachment to fire the Create Stream method.

You are not specifying the entity set name in the URL.

You are not passing Key in slug parameter.

So its expected that you are bound to get errors.

Pleas check the highlighted as below :

Please check the above points.

Regards,

Ashwin

Former Member
0 Kudos

Hi Zhiyu,

To trigger CREARE_STREAM, the URL should be like:

/sap/opu/odata/sap/ZTEMP_SRV/ET_USERSSet('TEST_USER')/ET_PHOTOSSet

Where ET_PHOTOSSet is the navigation property name. The ET_USERSSet is the principal entity.

SLUG is nothing but the filename that you would like to pass it your backend system if needed.

Regards,

Aashika Agarwal

Former Member
0 Kudos

Hello Aashika,

          Thank you for help me.Can you help me cheak my MPC?I refer to & , I find something different with mine and artical's MPC. It says:

yourclass_MPC_EXT->DEFINE( )

  METHOD define.    

super->define( ).   

DATA:       lo_entity   TYPE REF TO /iwbep/if_mgw_odata_entity_typ,     

             lo_property TYPE REF TO /iwbep/if_mgw_odata_property.   

lo_entity = model->get_entity_type( iv_entity_name = 'UserPhoto' ).   

IF lo_entity IS BOUND.     

lo_property = lo_entity->get_property( iv_property_name = 'Mimetype' ).     

lo_property->set_as_content_type( ).   

ENDIF. 

ENDMETHOD.

But in my MPC as it shows above,I don't know how to fix/add with my MPC.

Thanks!

Regards,

Cao

Former Member
0 Kudos

Hi Cao,

The MPC class code that you have shown above must have been auto generated while creating the project through SEGW.

We need to redefine the DEFINE method of MPC_EXT class and include the piece of code as you noticed in the blog.

Important pointers:

1. Include MIMETYPE field in principal entity.

2. The entity which hold the file content should be marked as media collection as shown in the blog referred by you in last post.

Regards,

Aashika

former_member191161
Participant
0 Kudos

Hi Aashika.

     I'm also facing same issue when create file.

I have written code in create_tream method, but I'm getting this error.

And where do i pass slug value.

here is my create_stream method.

Former Member
0 Kudos

Hi Siva,

Have you created a MIMETYPE attribute in Entity Type ?

If yes have you redefined the DEFINE method in  MPC_EXT and set it as content value ?

If not , you need to do these above steps and it should work.

Thanks

Sri

Former Member
0 Kudos

Hi,

Please redefine the DEFINE method in MPC_EXT Class.

The reference code can be found in

The slug value is passed as shown below:

In the HTTP header the slug is added to give file name.

Click on + sign which is right above the HTTP Request and put the value of slug in pop up that comes.

Regards,

Aashika