2009 Aug 27 4:43 PM
Hi,
as an output of the spool conversion into PDF I get a table of type "T_LINE":
TDFORMAT TDFORMAT CHAR 2 0 Tag column
TDLINE TDLINE CHAR 132 0 Text Line
To store the data into BDS I need a table of type "BAPICONTEN":
LINE SDOK_SDATX RAW 1022 0 Line for binary document contents, length for
How can I achieve this ?
Thank you !
regards
Paul
2009 Aug 27 11:27 PM
Hi Paul,
I used this one successfully
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
TABLES
content_in = pt_pdf
content_out = lt_contents_bin.
* pt_pdf TYPE tlinetab
* lt_contents_bin TYPE srm_t_solisti1
It works for any kind of table...
Regards,
Clemens
2009 Aug 27 5:29 PM
You mean TLINE. I have searched the forum with TLINE and BAPICONTEN and immediately found an answer. So?
2009 Aug 27 5:52 PM
Hi Sandra,
yes I mean TLINE.
Actually I have searched the whole internet, but can't find a proper solution here.
Which solution do you have in mind ?
kind regards
Paul
2009 Aug 27 6:18 PM
Search "TLINE BAPICONTEN", it's the first answer (transfering CHAR to RAW ?)
2009 Aug 27 8:09 PM
always these kind of anwers I don't like !!!
This is not a solution but guesses, assumptions and all that mess (
2009 Aug 27 8:43 PM
Paul,
If you look into function group SCMS, I think you can use fm 'SCMS_FTEXT_TO_BINARY'
a®
2009 Aug 27 8:59 PM
You know, you have to search. Do you think we are pleased to search in place of people. I think it was rather easy no?
a®s is very nice to give you the name of the function module, it would have just cost you 5 seconds to get it by yourself the way I said above.
2009 Aug 27 11:27 PM
Hi Paul,
I used this one successfully
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
TABLES
content_in = pt_pdf
content_out = lt_contents_bin.
* pt_pdf TYPE tlinetab
* lt_contents_bin TYPE srm_t_solisti1
It works for any kind of table...
Regards,
Clemens
2009 Aug 28 7:07 AM
Dear all
many thanks for your answers.
The real problem is:
1. Searching the SDN side you will see that at least 3 people had to deal with the same problem I am having.
2. All of them got friendly help by receiving hints and proposals (really appreciated)
3. All the hints didn't acutally solve the problem.
Each of the problem keeper tried the hints but it didn't work.
Also Clemens FM of converting tables does only work for non binary tables.
regards
Paul
2009 Aug 28 2:28 PM
You're right I didn't find good answers either. But understand that we first answer people to look at the forum if they don't tell us what investigations they did.
Below I wrote a little routine which corresponds to what you need.
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.
2009 Aug 31 10:28 AM
Hi Paul,
I used SX_TABLE_LINE_WIDTH_CHANGE for PDF which is ASCII as far as I know.
SX_TABLE_LINE_WIDTH_CHANGE has an optional import parameter TRANSFER_BIN which may work for you.
Kind regards,
Clemens
2009 Aug 31 10:47 AM
For parameter CONTENT_OUT, when we use a variable declared like table of bapiconten (structure with one X field of 1022 bytes), whatever we use TRANSFER_BIN or not, we get a dump DATA_UC_STRUCT_NOT_CHAR_LIKE ("Subfield access of structure without character-type initial part", at line "MOVE CONTENT_IN(LINE_WIDTH_SRC) TO CONTENT_OUT+POS_OUT."). As of NetWeaver 7.0 SP 12.
2009 Aug 31 12:26 PM
Hi Sandra,
many thanks !!
It works fine and I could successfully add the PDF document to the BDS.
Only a littel change I have applied to your routine:
instead of:
et_bapiconten type sbdstcontent_
I took:
et_bapiconten type UMB_BDS_CONTENT.
since in the 1st version the table is restricted to one line only.
kind regards
Paul
2009 Aug 31 12:37 PM
That's great! Note that the number behind OCCURS has no meaning since many SAP releases: if you have OCCURS 1 or OCCURS 1000, it just declares an internal table of unlimited size.
2009 Aug 31 1:24 PM
2009 Aug 28 2:33 AM
Hi Paul,
Try this way.
Thanks
Venkat.O CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = g_spool_no
no_dialog = ' '
IMPORTING
pdf_bytecount = l_no_of_bytes
pdf_spoolid = l_pdf_spoolid
btc_jobname = l_jobname
btc_jobcount = l_jobcount
TABLES
pdf = i_pdf
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CASE sy-subrc.
WHEN 0.
WHEN 1.
MESSAGE s000(0k) WITH 'No ABAP Spool Job'.
EXIT.
WHEN 2.
MESSAGE s000(0k) WITH 'Spool Number does not exist'.
EXIT.
WHEN 3.
MESSAGE s000(0k) WITH 'No permission for spool'.
EXIT.
WHEN OTHERS.
MESSAGE s000(0k)
WITH 'Error in Function CONVERT_ABAPSPOOLJOB_2_PDF'.
EXIT.
ENDCASE.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_src = 134
line_width_dst = 255
TABLES
content_in = i_pdf
content_out = l_attachment
EXCEPTIONS
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE s000(0k) WITH 'Conversion Failed'.
EXIT.
ENDIF.