06-30-2016 12:16 PM
Hi Team,
Can i know the Function Module that converts Internal Table Binary format to XSTRING in sap abap .
So that I can convert to other Format like PDF .
Regards,
Karthik S
06-30-2016 12:26 PM
Hi Karthik,
You can use the following method for each line in your internal table:
DATA: conv TYPE REF TO cl_abap_conv_in_ce,
l_tmp_string TYPE string.
conv = cl_abap_conv_in_ce=>create(
encoding = 'UTF-8'
endian = 'L' ).
conv->convert(
EXPORTING input = xml_result
IMPORTING data = l_tmp_string ).
APPEND l_tmp_string TO e_tab_xmltab.
Here xml_result will be your binary string and l_tmp_string will give you the converted XML.
Thanks,
Sowbhagya
06-30-2016 12:36 PM
06-30-2016 1:02 PM
Hi Kathik,
You need to convert internal table to string. Then string to xstring, then xstring to binary, then binary to any format such as PDF,XLS, Try this
Regards,
Srinath
06-30-2016 1:46 PM
DATA result TYPE xstring.
CALL TRANSFORMATION ID SOURCE itab = itab
RESULT XML result.
06-30-2016 2:18 PM
Hi Horst,
We need to create a simple transformation if we have to use the CALL TRANSFORMATION statement, right?
Thanks,
Sowbhagya
06-30-2016 2:27 PM
06-30-2016 3:58 PM
Hi All,
Thank you all for the reply .
I have converted the Binary(Table format) to XSTRING and can i know , how to convert from XSTRING to PDF format .
Regards,
KArthik S
06-30-2016 4:27 PM
Hi,
xstring and binary are different way to store the same document content in memory. PDF however is a document format/schema ,not a variable type. So I assume you might uploaded the file and want to do sg. with it or sg. like this. It depends on the document consumer whether you need to convert in further to a different representation so that it can understand your content with type application/pdf.
What would you like to do with it?
Attila
07-01-2016 8:52 AM
Hi Attila,
I have converted the format like below and my final one should be PDF format which has to be displayed in PHP End...
Binary(Table format) to XSTRING.
I want to convert this XSTRING to PDF base 64 , so that PHP team will decode and get the document in PDF
Can u suggest an idea on it .
Regards,
Karthik s
06-30-2016 4:20 PM
Hi,
I'm on way but as far as I remember you can call SCMS_BINARY_TO_XSTRING.
R3gards
Attila
07-01-2016 11:00 AM
convert itab to string and then string to xstring
LOOP AT lt_emp2 INTO ls_emp .
CONCATENATE lv_emp_string
ls_emp-emp_id cl_abap_char_utilities=>horizontal_tab
ls_emp-emp_type cl_abap_char_utilities=>horizontal_tab
ls_emp-first_name cl_abap_char_utilities=>horizontal_tab
ls_emp-midle_name cl_abap_char_utilities=>horizontal_tab
ls_emp-last_name cl_abap_char_utilities=>horizontal_tab
cl_abap_char_utilities=>newline
INTO lv_emp_string.
ENDLOOP.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = lv_emp_string
IMPORTING
buffer = lv_emp_xstring.
or u can use another fm
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = filesize
IMPORTING
buffer = xstring
TABLES
binary_tab = itab
EXCEPTIONS
failed = 1
OTHERS = 2.
07-01-2016 11:07 AM
Hi ,
Use the FM's 'GUI_DOWNLOAD' and 'GUI_UPLOAD' to convert the format of your internal tables to required format. Refer F1 documentation of these two FM's to see how to use them.
Regards,
Junas Pious.
07-01-2016 3:12 PM
Hi,
Thanks for your reply .
(As I am using odata concept, I need to send the data to PHP system in pdf format )
I have converted the format to XSTRING and can i know , how to convert to PDF format to PHP system .
Regards,
Karthik S
07-01-2016 10:48 PM
Hi,
if you access the file in through an OData service implemented by an ABAP system,then you need to implement the get_stream method in your data provider class extension and set the content type application/pdf. If you want to proceed this way,just let me know and I can help you in further. You need to create a project in SEGW transaction,create an entity and redefine some methods to expose the pdf to a client...
Attach_file_TO_RESPONSE above works only in ABAP wd and FPM stateful applications,but nothing to do with OData.
Attila
07-04-2016 8:35 AM
Hi Attila,
Thanks for your valuable reply .
I have implemented my piece of code in GET_STREAM method only .
I have converted the data to RTF format and can u tell me , how to convert to PDF format .
Regards,
KArthik S
07-05-2016 6:07 PM
Hi Karthik,
you might get an idea from above. Where is your RTF coming from? I would convert it to PDF before loading to SAP,and accessing it from the get_stream method if the above not work,I've never tried it. On client side you can install PDF prinrer before upload,or if you load it from the server file system,then you can install a PDF printer on the server and command that printer from ABAP. You just need to register the executable. Such way you can convert on server before reading it.
How do you get the data in SAP and what is the original format?
Regards
Attila
07-05-2016 4:49 PM
Hi,
this FM is perfect for you SCMS_BINARY_TO_XSTRING.
Let me know,
AI