2012 Jun 12 6:36 AM
Hello everybody,
As a part of my requirement, I am getting the bianry data from the FM 'SO_ATTACHMENT_READ_API1' . This binary data need to be converted to text. I used FMs 'SCMS_BINARY_TO_TEXT', 'SCMS_BINARY_TO_FTEXT'. But, getting junk data into binary data itab. Please, suggest a better approach.
Regards,
Srinivas
What precisely do you mean by "junk into binary data itab"? If the input is junk why proceed to try to convert it to text?
2012 Jun 12 6:42 AM
Hi,
Try using the function module 'SO_ATTACHMENT_READ' to read the attachments. Thank you.
Regards,
kartik
2012 Jun 12 7:07 AM
Hi Karthik,
Small correction to my question. The Binary data is being pulled but, while conerting to text , junk characters are coming. The FM 'SO_ATTACHMENT _READ' do not have necessary parameters/tables to hold the converted data. Thank you for reply.
Regards,
srinivas
2012 Jun 12 7:25 AM
2012 Jun 12 6:49 AM
Hi Srinivasa ,
The Below links will be helpful for you.
http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-+Data+Conversion+from+Char+to+binary
With Regards,
Sudhir S
2012 Jun 12 7:32 AM
Hi Srinivasa
Have you tried using the CL_DOCUMENT_BCS Class at all?
It contains a couple of Methods that deal with Attachment reads.
Hope this helps.
Regards
Vic
2012 Jun 12 1:28 PM
Hi Suresh,
Thank you for the reply. I tried calling the methods. But, for this class instance can not be created out side the class(Private instantiation). The class CL_DOCUMENT_BCS do not suite for this requirement.
I checked the class CL_ABAP_STRING_X_WRITER has two methods 'get_result_string()' and 'write_internal()'. These are also not converting data.
Please, suggest any other approach. Your suggestion would be more helpful.
Regards,
Srinivas
2012 Jun 12 2:03 PM
Hi Srini,
Try to call the method like CL_ABAP_CONV_IN_CE=>CONVERT
Thanks & Regards,
Suresh M
2012 Jun 12 8:02 AM
Hi,
Can try with the CL_ABAP_CONV_IN_CE class.
In this class use the CONVERT_STRUC method can conver the structure data.
And CONVERT method can convert the field data.
Thanks & Regards,
Suresh M
2012 Jun 12 4:37 PM
You can try with:
SCMS_BINARY_TO_TEXT
* Convert binary to text.
CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
EXPORTING
INPUT_LENGTH = 100 "?
* FIRST_LINE = 0
* LAST_LINE = 0
* APPEND_TO_TABLE = ' '
* MIMETYPE = ' '
WRAP_LINES = 'X'
* IMPORTING
* OUTPUT_LENGTH =
TABLES
BINARY_TAB = LT_BINARY
TEXT_TAB = LT_TEXT_OUT
* EXCEPTIONS
* FAILED = 1
* OTHERS = 2
.
you can modify input length...
Ciao
2012 Jun 12 4:42 PM
What precisely do you mean by "junk into binary data itab"? If the input is junk why proceed to try to convert it to text?
2012 Jun 13 7:38 AM
you can insert binary content in lt_binary and the function give you the text content in lt_text_out.
....
TYPES : BEGIN OF TY_TEXT,
TEXT_FIELD(1000) TYPE C,
END OF TY_TEXT.
TYPES : BEGIN OF TY_BINARY,
BINARY_FIELD(1000) TYPE C,
END OF TY_BINARY.
DATA : LT_TEXT type table of TY_TEXT with header line.
DATA : LT_TEXT_OUT type table of TY_TEXT with header line.
DATA : LT_BINARY type table of TY_BINARY with header line.
...
You need to run some tests because I have never used this FM...
Let me know!
Ciao
2012 Jun 13 1:28 PM
Hi Srini,
If you are reading the file from application server
class : CL_RSAN_UT_APPSERV_FILE_READER
in this class static method : APPSERVER_FILE_READ
call this method in your code.
All the data comes into internal table take it as each line as one record.
Thanks & Regards,
Suresh M
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |