on 09-29-2015 5:00 AM
Hi,
I have a requirement that user enters some data and attaches his file. I want to store file and other text data at one time.How to achieve it?
Thanks.
I think a batch request can be used here , https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB0QFjAAahUKEw...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Narendra
you can use create_stream method to save(create ) the attachment in sap .
Please follow these steps
1) Redine below mwthod in in zCL_VP_ORDER_DASH_MPC_EXT
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 = 'TWFileAttach' ).
if lo_entity is bound.
lo_property = lo_entity->get_property( iv_property_name = 'Mimetype' ).
lo_property->set_as_content_type( ).
endif.
endmethod.
--------------------------------------------------------------------------------------------------------------------
2)Redifine Create_Stream method in zCL_VP_ORDER_DASH_DPC_EXT
data: mimetype type char100,
filename type char100,
ls_stream type ty_s_media_resource,
filetype type char3,
lo_facade type ref to /iwbep/if_mgw_dp_int_facade,
lt_client_headers type tihttpnvp,
ev_message type bapi_msg,
is_data type "your structure
case iv_entity_name.
when 'Entityname'.
clear :mimetype,filename,content,filetype.
split iv_slug at '/' into filename filetype.
mimetype = is_media_resource-mime_type.
content = is_media_resource-value.
* mimetype = filetype.
is_data-content = content.
is_data-mimetype = mimetype.
is_data-filename = filename.
move all coreresponding fields into your structure.
modify or insert data base table
endcase.
Let me know if you get any problem
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.