2011 Dec 22 9:40 AM
Hi Gurus..
(please see at the end my previous search on SDN on this matter)
Question
I have a problem to convert from table of type TLINE to table of type SOLIX.
My problem/case
I convert a spool to PDF. This PDF I later want to assign to a business object.
The conversion to PDF create a table of type TLINE and the assignment to the business object need a table of type SOLIX.
I am able to do this via downloading the pdf to the frontend - then upload it agan as follows ...(after the upload the table is ready to use for assigning the PDF to my business object)
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = l_spool
NO_DIALOG = 'X'
TABLES
PDF = witab "TYPE TLINE
EXCEPTIONS
>>>>>>>>>>>>>>>>
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
BIN_FILESIZE = LV_SIZE "0
FILENAME = LV_FULLPATH
FILETYPE = 'BIN'
CHANGING
DATA_TAB = witab "TYPE TLINE
EXCEPTIONS
>>>>>>>>>>>>>>>>
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_fullpath "path to PDF-file
filetype = 'BIN'
IMPORTING
filelength = xlength
TABLES
data_tab = lt_doc. "TYPE STANDARD TABLE OF solix with header lineFinally here the table LT_DOC (pdf-document) is directly able to be used to be linked to the business object
I Would really like to do this without do any download/upload just for the conversion..... that is no performance in that..
Search on SDN
...exactly my problem...but with no luck
http://wiki.sdn.sap.com/wiki/display/ABAP/binarysafecopybetweenvariablesofdifferent+types
...yihaa...an entire program just for this... but here my combination from TLINE as a table to SOLIX as a table did not work...
....this one seemed to work my problem...but either I did not understand it fully, or It simply did not apply for my problem.
I did test some other links too, but they all seemed to talk about the same thing but in other ways... So I am still confused. There must be a simple way to to this conversion.
Please help me....
Best reg
Henrik
2011 Dec 22 10:09 AM
Hello Henrik,
You can try this:
1. Get the PDF data in binary format via the exporting param BIN_FILE(type XSTRING) of the FM CONVERT_ABAPSPOOLJOB_2_PDF.
2. Pass the PDF data(from Step1) to the method CL_DOCUMENT_BCS=>XSTRING_TO_SOLIX( ).
BR,
Suhas
PS: You can use the FM SCMS_XSTRING_TO_BINARY as well.
Hi Gurus..
(please see at the end my previous search on SDN on this matter)
Question
I have a problem to convert from table of type TLINE to table of type SOLIX.
My problem/case
I convert a spool to PDF. This PDF I later want to assign to a business object.
The conversion to PDF create a table of type TLINE and the assignment to the business object need a table of type SOLIX.
I am able to do this via downloading the pdf to the frontend - then upload it agan as follows ...(after the upload the table is ready to use for assigning the PDF to my business object)
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = l_spool
NO_DIALOG = 'X'
TABLES
PDF = witab "TYPE TLINE
EXCEPTIONS
>>>>>>>>>>>>>>>>
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
BIN_FILESIZE = LV_SIZE "0
FILENAME = LV_FULLPATH
FILETYPE = 'BIN'
CHANGING
DATA_TAB = witab "TYPE TLINE
EXCEPTIONS
>>>>>>>>>>>>>>>>
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_fullpath "path to PDF-file
filetype = 'BIN'
IMPORTING
filelength = xlength
TABLES
data_tab = lt_doc. "TYPE STANDARD TABLE OF solix with header lineFinally here the table LT_DOC (pdf-document) is directly able to be used to be linked to the business object
I Would really like to do this without do any download/upload just for the conversion..... that is no performance in that..
Search on SDN
...exactly my problem...but with no luck
http://wiki.sdn.sap.com/wiki/display/ABAP/binarysafecopybetweenvariablesofdifferent+types
...yihaa...an entire program just for this... but here my combination from TLINE as a table to SOLIX as a table did not work...
....this one seemed to work my problem...but either I did not understand it fully, or It simply did not apply for my problem.
I did test some other links too, but they all seemed to talk about the same thing but in other ways... So I am still confused. There must be a simple way to to this conversion.
Please help me....
Best reg
Henrik
2011 Dec 22 9:53 AM
2011 Dec 22 10:16 AM
Hi Manu
Well, I get a short dump
Maybe Im not using i correct...
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
* LINE_WIDTH_SRC = '134'
LINE_WIDTH_DST = '255'
* TRANSFER_BIN = ' '
TABLES
content_in = witab "TYPE TLINE
content_out = lt_doc "TYPE STANDARD TABLE OF solix with header line
EXCEPTIONS
ERR_LINE_WIDTH_SRC_TOO_LONG = 1
ERR_LINE_WIDTH_DST_TOO_LONG = 2
ERR_CONV_FAILED = 3
OTHERS = 4
.shortdump
Error analysis
In unicode-compatible programs, subfield accesses are only allowed for
structures with a character-type initial part. This is not the case for
the structure "CONTENT_OUT".
Best regards
Henrik
2011 Dec 22 10:09 AM
Hello Henrik,
You can try this:
1. Get the PDF data in binary format via the exporting param BIN_FILE(type XSTRING) of the FM CONVERT_ABAPSPOOLJOB_2_PDF.
2. Pass the PDF data(from Step1) to the method CL_DOCUMENT_BCS=>XSTRING_TO_SOLIX( ).
BR,
Suhas
PS: You can use the FM SCMS_XSTRING_TO_BINARY as well.
2011 Dec 22 10:27 AM
Hi Suhas
I was so happy when I saw your response, but Im sorry, when looking at the code I did not quite get it how I should do the coding.
Would you mind clarify how the coding should be done.
Thankyou in advance
Henrik
2011 Dec 22 10:49 AM
Hi,
Yep Suhas is right, better use SCMS_XSTRING_TO_BINARY fm...
Full answer is given here: , just change the output to solix format and it will work like a charm...
Kr,
Manu.
2011 Dec 22 12:27 PM
Hi Manu
I've been trying that one before...but I give it another go now
Question: How do I get my hands on the variable I_LENGTH from my table WITAB (TLINE table).
Below...you see the example from your link...and below that my coding....
Im happy for all comments...
type-pools sbdst.
FORM itab_clike_2_raw1022
using
it_any type standard table "of clike
i_length type i
changing
et_bapiconten type sbdst_content. "table of bapiconten
data l_string type string.
DATA l_buffer TYPE xstring.
data l_xstring type xstring.
CONCATENATE LINES OF it_any INTO l_string RESPECTING BLANKS.
EXPORT my_data = l_string(i_length) TO DATA BUFFER l_buffer.
IMPORT my_data TO l_xstring FROM DATA BUFFER l_buffer IN CHAR-TO-HEX MODE.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = l_xstring
TABLES
binary_tab = et_bapiconten.
endform.
I try to re-write it a bit....
data l_string type string.
DATA l_buffer TYPE xstring.
data l_xstring type xstring.
CONCATENATE LINES OF witab INTO l_string RESPECTING BLANKS.
EXPORT my_data = l_string(xlength) TO DATA BUFFER l_buffer.
IMPORT my_data TO l_xstring FROM DATA BUFFER l_buffer IN CHAR-TO-HEX MODE.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = l_xstring
TABLES
binary_tab = lt_doc. "et_bapiconten.
Best regards
Henrik
2011 Dec 22 1:17 PM
Hi,
Well, not even sure that length option is mandatory... but I guess you could simply call the strlen function on l_string..
something like:
CONCATENATE LINES OF it_any INTO l_string RESPECTING BLANKS.
l_len = strlen( l_string ).
EXPORT my_data = l_string(l_len) TO DATA BUFFER l_buffer.
IMPORT my_data TO l_xstring FROM DATA BUFFER l_buffer IN CHAR-TO-HEX MODE.
Hope this helps,
m.
2011 Dec 22 1:55 PM
Hi Manu ...and Suhas!!
Thankyou very much for your support! I am very greatful!!
It works!!!!!
Now Im facing the next problem... I wanna give you both max points for your support.
Manu - I will give you full house since you guided me over the edge
Suhas - You gave the first direction to that FM so you are so so so close behind Manu - but you will get some point to
Thankyou again and MERRY CHRISTMAS
//Henrik
2011 Dec 22 2:24 PM
You're welcome Henrik! Maybe next time we'll need your help...
Merry x-mas!!
Manu.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |