on 2019 Oct 08 9:00 PM
Hello Experts,
I am building an offline approval solution via workflow for PPM checklist items for my client. For each approval request mail is being shot via cl_bcs class to user's email inbox. One of the requirements is to attach all the uploaded files to a particular PPM decision point for the user the refer to.
After lots of research, I am able to get the file content using SCMS_DOC_READ by accessing the physical ID of the files. Data is returned in a raw 1022 binary table. after further headache, I converted the binary content to XSTRING using SCMS_BINARY_TO_XSTRING and then XSTRING to STRING and then STRING to SOLIX for XLSX with codepage 4103. XLSX attachments seem to be working fine.
For DOCX I used same technique but codepage 1100/1160. The file comes fine but the image inside is corrupted. Interestingly, only part of the image is corrupted. This tells me there is some conversion error or data loss at some point. If someone can help out with this or point me in the right direction, I would be eternally indebted.
Below is a code snippet:
IF file2 EQ 'DOC'.DESCRIBE TABLE lt_bin LINES lv_lines.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'EXPORTING
input_length = ls_act-comp_size
FIRST_LINE = 1
LAST_LINE = 9IMPORTINGBUFFER = fi_xstringtables
binary_tab = lt_bin[]* EXCEPTIONS* FAILED = 1* OTHERS = 2.IF sy-subrc <> 0.* Implement suitable error handling hereENDIF.
cl_bcs_convert=>xstring_to_string(EXPORTING
iv_xstr = fi_xstring
iv_cp = '1160'
RECEIVING
rv_string = fi_string ).
cl_bcs_convert=>string_to_solix(EXPORTING
iv_string = fi_string
iv_codepage = '1160'IMPORTING
et_solix = lt_xls_out
ev_size = size ).
CONCATENATE file1 '.docx' INTO lv_file.CONCATENATE '&SO_FILENAME=' lv_file INTO att_line.APPEND att_line to att_head.
document->add_attachment(EXPORTING i_attachment_type = 'TXT'
i_attachment_subject = lv_sub
i_attachment_size = size
i_att_content_hex = lt_xls_out
i_attachment_header = att_head ).
Request clarification before answering.
Hello,
We have resolved the problem by borrowing some code from PPM FPM portal code. Will share the detailed solution soon in case someones else gets stuck with same problem.
Best Regards,
Soumyajit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Soumyajit,
That would be excellent to circle back and share your solution! And please close the question too, of course.
Thanks,
Sue
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.