on 12-18-2014 9:47 AM
Dear experts,
I am uploading the data from excel file using ALSM_EXCEL_TO_INTERNAL_TABLE function module in one of the report. The function goes well in the backend but
unfortunately, when I run the web, it throws an error: Error during import of clipboard contents,Have you guys ever met this problem? Please show me the the solution, or guide me how to fix this error.
Thanks in advance!!!!
Hi Zhiyu,
ALSM_EXCEL_TO_INTERNAL_TABLE will work only in foreground mode ( and only from SAPGUI ) as it is using front end services ( internally activex) . You can not use it in DPC class as no foreground execution is involved . No donuts
Sreehari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please explain your use case.
As per my understanding, you want to upload some excel sheet with data and data will be extracted from that sheet and processed afterwards. If this is the case, you can not use ALSM_EXCEL_TO_INTERNAL_TABLE to convert the excel into internal table because in the backend you will be getting the XSTRING of xls which can not be converted by this FM. For this scenario, CSV file will be helpful. Check this link
Regards,
Ekansh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Cao,
Can you please explain little more about your scenario ?
You want to upload file through SAP Gateway to Back-End is it? i.e., Excel file ?
If yes then you need to correct your URL and need to pass few Headers and Token Value.
For uploading file ->
1. you need to set your Entity as Media Type and add the necessary properties.
2. implement Create_Stream method in DPC_EXT class and write logic inside it to save the media content in appropriate format.
3. Use Http POST method and send Key value in ' slug ' Header , Mime Type in the Content-Type Header and pass CSRF-Token value.
For detail info Please refer below ->
Regards,
Ashwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
Thank you again for help me.I actually want to upload a excel/txt file through SAP Gateway to an internal table in the backend.So,I need a url to get the file. I read the two references you give to me and I can't find the FM YFILE_UPLOAD in the second reference 'How To Upload and Download Files Using SAP NW Gateway SP06'. and I really don't understand how to Redefine the "CREATE_STREAM".
Regards,
Cao
Hello Cao,
Redefine as below :
Select the method and click on the Icon as shown.
You will not find YFILE_UPLOAD FM as i think it is the custom FM and not a standard one.
Once you redefine you can get the Media Content value and the Mime Type from importing parameter IS_MEDIA_RESOURCE.
You need to write the logic which will take this content value and convert to an appropriate format and store it in the back-end.
OR you can use the already existing logic/FM which will store this.
Once you read the Media Content Value in Create_Stream method may be you can try converting into table as what Ekansh suggested and try saving it.
Regards,
Ashwin
hello,
thanks for helping me so much....I have asked system administor and the url has been successed run.
but it still errors,there is no 'slug' when I add file and click 'post'.
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_key_tab TYPE /iwbep/s_mgw_name_value_pair,
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 ).
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.