on 11-06-2014 6:53 AM
Hello Experts,
I have been doing some Odata Operations but i am still not able to Crack this particular CREATE_STREAM for uploading the Images/Media Type Formats from the UI Applications.
These are the steps which I followed for implementing the functionality.
Please Note : I have been using the SEGW to generate the MPC and DPC Classes.
a. Created the Entity with 2 properties.
1. PdfKey ( Key Property - Type Edm.String )
2. PdfStream ( Property - Type Edm.Binary)
b. I have made the entity as Media Type using the Checkbox.
c. I generate the classes, entitysets.
d. Now in the Class DPC_EXT Method : /iwbep/....create_stream i have written minimal coding just for output.
Code snippet:
Here I have to fill the key field hence I am passing the mime_type in to the key field and also the stream value into the stream.
ER_ENTITY is successfully filled and the control now moves into the Framework classes where if I debug I can still see the desired output of the type Entity in a parameter called EV_RESPONSE_DATA which when viewed in the HTML browser shows the correct output.
e. It is after this process that I execute the framework gives a dump saying:
f. I have tried many different approaches and couldn't crack the actual issue/solution.
Also Note: I have done all the coding in the Gateway System.I have even tried using the GET_STREAM method which is working fine.
As I am getting the data in the CREATE_STREAM method I will be able to store the image in my back-end system or wherever needed but I would always need the Successful message(201 Created in this case ) and output type.
Please help me If I have missed any steps here which is causing the issue.
Thanks and Regards,
Kartik Suru
Hello Kartik,
Go to MPC_EXT class and redefine DEFINE method.
Add the below code and activate the method and class.
The code is just a sample for a demo GW Model for ur reference.
Please use ur property names.
Demo GW Model ->
Code -> Go to MPC_EXT class and add the below. Activate.
super->define( ).
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 = 'Customer' ).
IF lo_entity IS BOUND.
lo_property = lo_entity->get_property( iv_property_name = 'CustomerID' ).
lo_property = lo_entity->get_property( iv_property_name = 'mimeType' ).
lo_property = lo_entity->get_property( iv_property_name = 'Title' ).
lo_property = lo_entity->get_property( iv_property_name = 'FirstName' ).
lo_property = lo_entity->get_property( iv_property_name = 'LastName' ).
lo_property = lo_entity->get_property( iv_property_name = 'Gender' ).
lo_property->set_as_content_type( ).
ENDIF.
Clear ur model cache in /iwfnd/cache_cleanup and check again.
Regards,
Ashwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks All,
Only problem I guess was because the Model Cache was not getting cleared instantly.
Roadblock eliminated ....
Cheers,
Kartik Suru
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Zhiyu,
My problem got resolved. I had followed all the steps as given in SAP Create Stream Blogs.
The only step I missed out was the Redefinition of the Define method and set the content type for the Particular mime type property in my media type entity.
I did my changes as Ashwini has mentioned and it did work.I have implemented it many times since then.
Sometimes there may be some Cache related issues, which need to be cleared.
Warm Regards,
Kartik Suru
Hi Suru,
for his u need to redfine define() method in MPC class and set a attribute as content type.Check this :
http://scn.sap.com/docs/DOC-56891
Hope this helps.
Thanks,
Saurabh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.