2012 Feb 03 10:34 AM
Hi Experts,
I am trying to convert an image into raw data and then this raw data into string. I wrote the following code line
DATA: lv_obj LIKE toahr-object_id.
DATA: itoahr LIKE toahr OCCURS 0 WITH HEADER LINE.
DATA: n TYPE n.
DATA: lv_inp LIKE sapb-sapadokid.
data: EX_DOCUMENT like TBL1024 OCCURS 0 WITH HEADER LINE.
data:lv_str type string .
IF im_photo = 'X'.
SELECT *
FROM toahr INTO CORRESPONDING FIELDS OF TABLE itoahr
WHERE sap_object = 'PREL'
AND archiv_id = 'A2'
AND ar_object = 'HRICOLFOTO'
AND object_id = pernr.
IF sy-subrc = 0.
DESCRIBE TABLE itoahr LINES n.
READ TABLE itoahr INDEX n.
ENDIF.
lv_inp = itoahr-arc_doc_id.
CALL FUNCTION 'ALINK_RFC_TABLE_GET'
EXPORTING
im_docid = lv_inp
im_crepid = 'A2'
IM_COMPID =
IMPORTING
EX_LENGTH =
EX_MESSAGE =
TABLES
ex_document = EX_DOCUMENT
.
EX_DOCUMENT_P[] = EX_DOCUMENT[].
CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
IM_XSTRING = EX_DOCUMENT_P[]
IM_ENCODING = 'UTF-8'
IMPORTING
EX_STRING = lv_str
.
here the dump is thrown because i am trying to assign multiline "EX_DOCUMENT_P[]" to single line IM_XSTRING .
Is there any alternative to directly achive this raw data conversion directly to String.
Please help me.
Earlier responses would be much appreciated.
Thanks
Uday
Edited by: Uday Kumar Kanike on Feb 3, 2012 11:35 AM
2012 Feb 03 12:17 PM
Hi Uday,
you can try using FM 'SCMS_BINARY_TO_STRING'. it might help.
regards
gaurav
Hi Experts,
I am trying to convert an image into raw data and then this raw data into string. I wrote the following code line
DATA: lv_obj LIKE toahr-object_id.
DATA: itoahr LIKE toahr OCCURS 0 WITH HEADER LINE.
DATA: n TYPE n.
DATA: lv_inp LIKE sapb-sapadokid.
data: EX_DOCUMENT like TBL1024 OCCURS 0 WITH HEADER LINE.
data:lv_str type string .
IF im_photo = 'X'.
SELECT *
FROM toahr INTO CORRESPONDING FIELDS OF TABLE itoahr
WHERE sap_object = 'PREL'
AND archiv_id = 'A2'
AND ar_object = 'HRICOLFOTO'
AND object_id = pernr.
IF sy-subrc = 0.
DESCRIBE TABLE itoahr LINES n.
READ TABLE itoahr INDEX n.
ENDIF.
lv_inp = itoahr-arc_doc_id.
CALL FUNCTION 'ALINK_RFC_TABLE_GET'
EXPORTING
im_docid = lv_inp
im_crepid = 'A2'
IM_COMPID =
IMPORTING
EX_LENGTH =
EX_MESSAGE =
TABLES
ex_document = EX_DOCUMENT
.
EX_DOCUMENT_P[] = EX_DOCUMENT[].
CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
IM_XSTRING = EX_DOCUMENT_P[]
IM_ENCODING = 'UTF-8'
IMPORTING
EX_STRING = lv_str
.
here the dump is thrown because i am trying to assign multiline "EX_DOCUMENT_P[]" to single line IM_XSTRING .
Is there any alternative to directly achive this raw data conversion directly to String.
Please help me.
Earlier responses would be much appreciated.
Thanks
Uday
Edited by: Uday Kumar Kanike on Feb 3, 2012 11:35 AM
2012 Feb 03 12:17 PM
Hi Uday,
you can try using FM 'SCMS_BINARY_TO_STRING'. it might help.
regards
gaurav
2012 Feb 03 12:30 PM
Hi Gaurav,
Thanks for your suggestion, but my requirement cannot be met by your suggested FM. I have also tried with other FMs I have
u2022SCMS_XSTRING_TO_BINARY
u2022SCMS_BINARY_TO_STRING
u2022SCMS_BINARY_TO_XSTRING
u2022SCMS_STRING_TO_XSTRING
In my case the binary code is being captured in a table of multiple lines (154 lines). Now if I want to pass these many lines to other FM, I can't find any suitable FM.
So, Please someone suggest me some way to convert multiple lines of binary code to string.
Thanks
Uday
2012 Feb 03 12:44 PM
Hi Uday,
Using FM by Looping on table with multiple lines can help.
i have never tried it but you can try that.
regards
gaurav
2012 Feb 19 9:25 AM
Hi All,
Thanks for all of your help. I resolved this issue with the help of one of my ABAPer.
we used HR_IMAGE_EXISTS and SCMS_DOC_READ followed by SCMS_BINARY_TO_XSTRING
thanks to everyone.
Regards
uday
2016 Feb 23 1:34 PM
Hi Uday,
I am facing exactly same issue as you had. I am trying to read the pdf attachment from the archive link server with following code.
CALL FUNCTION 'ARCHIV_GET_CONNECTIONS'
EXPORTING
object_id = lv_object_id
TABLES
connections = lt_connections
EXCEPTIONS
nothing_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
RETURN.
ENDIF.
READ TABLE lt_connections ASSIGNING <fs_connections> WITH KEY sap_object = 'BUS2000223'
archiv_id = 'ZI'
reserve = 'PDF'.
IF sy-subrc <> 0 OR <fs_connections> IS NOT ASSIGNED.
RETURN.
ENDIF.
CALL FUNCTION 'SCMS_AO_TABLE_GET'
EXPORTING
arc_id = 'ZI'
doc_id = <fs_connections>-arc_doc_id
TABLES
data = lt_data
EXCEPTIONS
error_http = 1
error_archiv = 2
error_kernel = 3
error_config = 4
OTHERS = 5.
IF sy-subrc <> 0.
RETURN.
ENDIF.Since I want to pass this document to another system, I need this lt_data to be converted to binary. lt_data is of a table type and thus using SCMS_XSTRING_TO_BINARY as I have data of multiple lines. Could anybody advise any other FMs?.
Thanks,
Faisal
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |