<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Translate using variable via pattern in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247964#M1985828</link>
    <description>&lt;P&gt;I looked at &lt;A href="https://www.sap.com/community/resources/rules-of-engagement.html"&gt;Rules
of Engagement&lt;/A&gt; but did not find any reference how to reward points.&lt;/P&gt;&lt;P&gt;Can you explain in more details  what should I do in order to reward points? In some links I saw that a star should appears next to the answer in order to reward. But I do not see any star&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jul 2020 08:37:08 GMT</pubDate>
    <dc:creator>hagit</dc:creator>
    <dc:date>2020-07-28T08:37:08Z</dc:date>
    <item>
      <title>Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247947#M1985811</link>
      <description>&lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Hello experts&lt;/P&gt;
  &lt;P&gt;I use CONVERT_ABAPSPOOLJOB_2_PDF in order to convert ABAP spool to PDF. After that I Transfer the 132-long strings to 255-long strings with the translate command.&lt;/P&gt;
  &lt;P&gt;When writing:&lt;/P&gt;
  &lt;P&gt; TRANSLATE ls_pdf_output USING ' ~'. &lt;/P&gt;
  &lt;P&gt;Then when opening the pdf Sometimes it is OK but sometimes I receive an error message 'CANNOT EXTRACT THE EMBEDDED FONT…'&lt;/P&gt;
  &lt;P&gt;When writing:&lt;/P&gt;
  &lt;P&gt;DATA: lv_translate_str TYPE string VALUE ' ~'&lt;/P&gt;
  &lt;P&gt;TRANSLATE ls_pdf_output USING lv_translate_str.&lt;/P&gt;
  &lt;P&gt;Then when opening the pdf, until now It was always ok.&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Thanks in advance&lt;/P&gt;
  &lt;P&gt;Hagit&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;FORM convert_spool_to_pdf&lt;BR /&gt;
 USING pv_job_id TYPE tsp01-rqident&lt;BR /&gt;
 CHANGING pt_mess_att TYPE esy_tt_solisti1&lt;BR /&gt;
 .&lt;BR /&gt;
&lt;BR /&gt;
 CONSTANTS: lc_no(1) TYPE c VALUE ' '&lt;BR /&gt;
 ,lc_device(4) TYPE c VALUE 'LOCL'&lt;BR /&gt;
 .&lt;BR /&gt;
&lt;BR /&gt;
 DATA: lt_pdf_output TYPE TABLE OF tline&lt;BR /&gt;
 ,lv_buffer TYPE string&lt;BR /&gt;
 ,ls_mess_att TYPE solisti1 "like line of pt_mess_att&lt;BR /&gt;
 .&lt;BR /&gt;
&lt;BR /&gt;
 CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'&lt;BR /&gt;
 EXPORTING&lt;BR /&gt;
 src_spoolid = pv_job_id&lt;BR /&gt;
 no_dialog = lc_no&lt;BR /&gt;
 dst_device = lc_device&lt;BR /&gt;
* IMPORTING&lt;BR /&gt;
* pdf_bytecount =&lt;BR /&gt;
 TABLES&lt;BR /&gt;
 pdf = lt_pdf_output&lt;BR /&gt;
 EXCEPTIONS&lt;BR /&gt;
 err_no_abap_spooljob = 1&lt;BR /&gt;
 err_no_spooljob = 2&lt;BR /&gt;
 err_no_permission = 3&lt;BR /&gt;
 err_conv_not_possible = 4&lt;BR /&gt;
 err_bad_destdevice = 5&lt;BR /&gt;
 user_cancelled = 6&lt;BR /&gt;
 err_spoolerror = 7&lt;BR /&gt;
 err_temseerror = 8&lt;BR /&gt;
 err_btcjob_open_failed = 9&lt;BR /&gt;
 err_btcjob_submit_failed = 10&lt;BR /&gt;
 err_btcjob_close_failed = 11&lt;BR /&gt;
 OTHERS = 12.&lt;BR /&gt;
 IF sy-subrc &amp;lt;&amp;gt; 0.&lt;BR /&gt;
 RAISE no_conv2pdf.&lt;BR /&gt;
 ELSE.&lt;BR /&gt;
 DATA: lv_translate_str TYPE string VALUE ' ~'&lt;BR /&gt;
 ,lv_translate_back_str TYPE string VALUE '~ '&lt;BR /&gt;
 .&lt;BR /&gt;
&lt;BR /&gt;
* Transfer the 132-long strings to 255-long strings&lt;BR /&gt;
 LOOP AT lt_pdf_output INTO DATA(ls_pdf_output).&lt;BR /&gt;
* TRANSLATE ls_pdf_output USING ' ~'.&lt;BR /&gt;
 TRANSLATE ls_pdf_output USING lv_translate_str.&lt;BR /&gt;
 CONCATENATE lv_buffer ls_pdf_output INTO lv_buffer.&lt;BR /&gt;
 ENDLOOP.&lt;BR /&gt;
&lt;BR /&gt;
* TRANSLATE lv_buffer USING '~ '.&lt;BR /&gt;
 TRANSLATE lv_buffer USING lv_translate_back_str.&lt;BR /&gt;
&lt;BR /&gt;
 DO.&lt;BR /&gt;
 ls_mess_att = lv_buffer.&lt;BR /&gt;
 APPEND ls_mess_att TO pt_mess_att.&lt;BR /&gt;
 SHIFT lv_buffer LEFT BY 255 PLACES.&lt;BR /&gt;
 IF lv_buffer IS INITIAL.&lt;BR /&gt;
 EXIT.&lt;BR /&gt;
 ENDIF.&lt;BR /&gt;
 ENDDO.&lt;BR /&gt;
 ENDIF.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
ENDFORM. "convert_spool_to_pdf&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Jul 2020 09:37:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247947#M1985811</guid>
      <dc:creator>hagit</dc:creator>
      <dc:date>2020-07-19T09:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247948#M1985812</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;DATA lv_translate_back_str TYPE string VALUE '~ '.
TRANSLATE lv_buffer USING lv_translate_back_str.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;is different from&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TRANSLATE lv_buffer USING '~ '.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;because, as explained in the ABAP documentation of &lt;A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abaptranslate.htm"&gt;TRANSLATE&lt;/A&gt;:&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;"&lt;EM&gt;&lt;STRONG&gt;Trailing blanks in data objects text and mask are respected for data objects&lt;/STRONG&gt;&lt;/EM&gt;": in the second case, the trailing blank is there, so all ~ of lv_buffer are replaced with spaces.&lt;/LI&gt;&lt;LI&gt;"&lt;EM&gt;&lt;STRONG&gt;If mask contains an odd number of characters, the last character is ignored&lt;/STRONG&gt;&lt;/EM&gt;": in the DATA statement of the first case, the trailing space of the value '~ ' (which is of type C and length 2, because it's defined using straight/regular quotes) is ignored and the string is finally made of only one character (tilde ~), consequently TRANSLATE will not replace ~ because it's ignored as it's the last character of the mask with an odd number of characters (1).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Solution: to make the two forms equivalent, define the two characters as a STRING of 2 characters, by using back quotes, the trailing space will be kept during the assignment:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA lv_translate_back_str TYPE string VALUE `~ `.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;PS: what I said is not related to PDF, it's intrinsic to ABAP. Concerning &lt;A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapconcatenate.htm"&gt;CONCATENATE&lt;/A&gt;, you may use the addition &lt;STRONG&gt;RESPECTING BLANKS&lt;/STRONG&gt; instead of this TRANSLATE trick to keep blanks which is &lt;STRONG&gt;very dangerous&lt;/STRONG&gt; because the PDF may contain tildes before use of TRANSLATE, and guess what happens...&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 11:50:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247948#M1985812</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-07-19T11:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247949#M1985813</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;sandra.rossi&lt;/SPAN&gt; ,&lt;/P&gt;&lt;P&gt;Thanks for your perfect explanation.&lt;/P&gt;&lt;P&gt;In all the examples which I found in the web, translate was
used.&lt;/P&gt;&lt;P&gt;Is the previous code equivalent to the code below?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;RAISE no_conv2pdf.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;ELSE.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;* DATA: lv_translate_str TYPE string VALUE ' ~'&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;*           ,lv_translate_back_str TYPE string VALUE `~ `&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;** ,lv_translate_back_str TYPE string VALUE '~ ' .
* Transfer the 132-long strings to 255-long strings&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT lt_pdf_output INTO DATA(ls_pdf_output).&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;** TRANSLATE ls_pdf_output USING ' ~'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;* TRANSLATE ls_pdf_output USING lv_translate_str.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;* CONCATENATE lv_buffer ls_pdf_output INTO lv_buffer.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;CONCATENATE lv_buffer ls_pdf_output INTO lv_buffer RESPECTING BLANKS.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;ENDLOOP.
** TRANSLATE lv_buffer USING '~ '.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;* TRANSLATE lv_buffer USING lv_translate_back_str.
DO.
 ls_mess_att = lv_buffer.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;APPEND ls_mess_att TO pt_mess_att.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;SHIFT lv_buffer LEFT BY 255 PLACES.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;IF lv_buffer IS INITIAL.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;EXIT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;ENDDO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Hagit&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 14:12:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247949#M1985813</guid>
      <dc:creator>hagit</dc:creator>
      <dc:date>2020-07-19T14:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247950#M1985814</link>
      <description>&lt;P&gt;Please use button COMMENT. The button ANSWER is for proposing a solution.&lt;/P&gt;&lt;P&gt;Yes, you're correct.&lt;/P&gt;&lt;P&gt;Your code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT lt_pdf_output INTO DATA(ls_pdf_output).
  TRANSLATE ls_pdf_output USING ' ~'.
  CONCATENATE lv_buffer ls_pdf_output INTO lv_buffer.
ENDLOOP.
TRANSLATE lv_buffer USING '~ '.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;is equivalent to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT lt_pdf_output INTO DATA(ls_pdf_output).
  CONCATENATE lv_buffer ls_pdf_output INTO lv_buffer RESPECTING BLANKS.
ENDLOOP.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;and is equivalent to:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CONCATENATE LINES OF lt_pdf_output INTO lv_buffer RESPECTING BLANKS.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;By the way, if I'm not wrong, &lt;STRONG&gt;your final code can be changed to&lt;/STRONG&gt;:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;pt_mess_att = cl_bcs_convert=&amp;gt;string_to_soli( lv_buffer ).&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;PS: &lt;STRONG&gt;LINES OF&lt;/STRONG&gt; and &lt;STRONG&gt;RESPECTING BLANKS&lt;/STRONG&gt; appeared in ABAP 7.0, in 2005.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 14:37:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247950#M1985814</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-07-19T14:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247951#M1985815</link>
      <description>&lt;P&gt;And most importantly, you must absolutely use the parameter &lt;STRONG&gt;pdf_bytecount&lt;/STRONG&gt; to trim the extra bytes.&lt;/P&gt;&lt;P&gt;The problem of your code is that you only deal with characters, you must cast the characters into bytes, then you can trim the extra bytes.&lt;/P&gt;&lt;P&gt;In the end, your code attaches the PDF to "somewhere", and that must be done &lt;STRONG&gt;with bytes&lt;/STRONG&gt;, NOT with characters. If you do it with characters, you will probably have problems.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 15:55:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247951#M1985815</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-07-19T15:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247952#M1985816</link>
      <description>&lt;OL&gt;&lt;LI&gt;Thanks for your answer, which is not just an answer, but also improves the code&lt;/LI&gt;&lt;LI&gt;Is CONCATENATE LINES OF ... faster than a loop?&lt;/LI&gt;&lt;LI&gt;How should I use the returning parameter PDF_BYTECOUNT?&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Sun, 19 Jul 2020 16:15:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247952#M1985816</guid>
      <dc:creator>hagit</dc:creator>
      <dc:date>2020-07-19T16:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247953#M1985817</link>
      <description>&lt;P&gt;2. As a rule-of-thumb, any one-statement is faster than the equivalent ABAP code in several lines&lt;/P&gt;&lt;P&gt;3. Use PDF_BYTECOUNT as I explained. But I can't give additional clues as you don't explain what you do with the PDF (formal parameter pt_mess_att) in the end.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 18:26:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247953#M1985817</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-07-19T18:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247954#M1985818</link>
      <description>&lt;P&gt;3. At the end I send the pdf as an attachment in the mail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FORM send_file_as_email_attachment TABLES it_message&lt;BR /&gt;
 it_attachUSING p_email&lt;BR /&gt;
 pv_mail_subject&lt;BR /&gt;
 p_format&lt;BR /&gt;
 p_filename&lt;BR /&gt;
 p_attdescription&lt;BR /&gt;
 p_sender_address&lt;BR /&gt;
 p_sender_addres_typeCHANGING p_reciever.&lt;BR /&gt;
&lt;BR /&gt;
DATA: ld_mtitle LIKE sodocchgi1-obj_descr,&lt;BR /&gt;
 ld_email LIKE somlreci1-receiver,&lt;BR /&gt;
 ld_format TYPE so_obj_tp,&lt;BR /&gt;
 ld_attdescription TYPE so_obj_nam,&lt;BR /&gt;
 ld_attfilename TYPE so_obj_des,&lt;BR /&gt;
 ld_sender_address LIKE soextreci1-receiver,&lt;BR /&gt;
 ld_sender_address_type LIKE soextreci1-adr_typ,&lt;BR /&gt;
 ld_receiver LIKE sy-subrc.&lt;BR /&gt;
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,&lt;BR /&gt;
 t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,&lt;BR /&gt;
 t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,&lt;BR /&gt;
 t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,&lt;BR /&gt;
 t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,&lt;BR /&gt;
 w_cnt TYPE i,&lt;BR /&gt;
 w_sent_all(1) TYPE c,&lt;BR /&gt;
 w_doc_data LIKE sodocchgi1.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
 ld_email = p_email.&lt;BR /&gt;
 ld_mtitle = pv_mail_subject.&lt;BR /&gt;
 ld_format = p_format.&lt;BR /&gt;
 ld_attdescription = p_attdescription.&lt;BR /&gt;
 ld_attfilename = p_filename.&lt;BR /&gt;
 ld_sender_address = p_sender_address.&lt;BR /&gt;
 ld_sender_address_type = p_sender_addres_type.&lt;BR /&gt;
&lt;BR /&gt;
* Fill the document data.&lt;BR /&gt;
 w_doc_data-doc_size = 1.&lt;BR /&gt;
* Populate the subject/generic message attributes&lt;BR /&gt;
 w_doc_data-obj_langu = sy-langu.&lt;BR /&gt;
 w_doc_data-obj_name = 'SAPRPT'.&lt;BR /&gt;
 w_doc_data-obj_descr = ld_mtitle .&lt;BR /&gt;
 w_doc_data-sensitivty = 'F'.&lt;BR /&gt;
* Fill the document data and get size of attachmentCLEAR w_doc_data.READ TABLE it_attach INDEX w_cnt.&lt;BR /&gt;
 w_doc_data-doc_size =( w_cnt - 1 ) * 255 + strlen( it_attach ).&lt;BR /&gt;
 w_doc_data-obj_langu = sy-langu.&lt;BR /&gt;
 w_doc_data-obj_name = 'SAPRPT'.&lt;BR /&gt;
 w_doc_data-obj_descr = ld_mtitle.&lt;BR /&gt;
 w_doc_data-sensitivty = 'F'.CLEAR t_attachment.REFRESH t_attachment.&lt;BR /&gt;
 t_attachment[] = it_attach[].&lt;BR /&gt;
* Describe the body of the messageCLEAR t_packing_list.REFRESH t_packing_list.&lt;BR /&gt;
 t_packing_list-transf_bin = space.&lt;BR /&gt;
 t_packing_list-head_start = 1.&lt;BR /&gt;
 t_packing_list-head_num = 0.&lt;BR /&gt;
 t_packing_list-body_start = 1.DESCRIBE TABLE it_message LINES t_packing_list-body_num.&lt;BR /&gt;
 t_packing_list-doc_type = 'RAW'.APPEND t_packing_list.&lt;BR /&gt;
* Create attachment notification&lt;BR /&gt;
 t_packing_list-transf_bin = 'X'.&lt;BR /&gt;
 t_packing_list-head_start = 1.&lt;BR /&gt;
 t_packing_list-head_num = 1.&lt;BR /&gt;
 t_packing_list-body_start = 1.&lt;BR /&gt;
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.&lt;BR /&gt;
 t_packing_list-doc_type = ld_format.&lt;BR /&gt;
 t_packing_list-obj_descr = ld_attdescription.&lt;BR /&gt;
 t_packing_list-obj_name = ld_attfilename.&lt;BR /&gt;
 t_packing_list-doc_size = t_packing_list-body_num * 255.APPEND t_packing_list.&lt;BR /&gt;
* Add the recipients email addressCLEAR t_receivers.REFRESH t_receivers.&lt;BR /&gt;
 t_receivers-receiver = ld_email.&lt;BR /&gt;
 t_receivers-rec_type = 'U'.&lt;BR /&gt;
 t_receivers-com_type = 'INT'.&lt;BR /&gt;
 t_receivers-notif_del = 'X'.&lt;BR /&gt;
 t_receivers-notif_ndel = 'X'.APPEND t_receivers.&lt;BR /&gt;
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'EXPORTING&lt;BR /&gt;
 document_data = w_doc_data&lt;BR /&gt;
 put_in_outbox = 'X'&lt;BR /&gt;
 sender_address = ld_sender_address&lt;BR /&gt;
 sender_address_type = ld_sender_address_type&lt;BR /&gt;
 commit_work = 'X'IMPORTING&lt;BR /&gt;
 sent_to_all = w_sent_allTABLES&lt;BR /&gt;
 packing_list = t_packing_list&lt;BR /&gt;
 contents_bin = t_attachment&lt;BR /&gt;
 contents_txt = it_message&lt;BR /&gt;
 receivers = t_receiversEXCEPTIONS&lt;BR /&gt;
 too_many_receivers = 1&lt;BR /&gt;
 document_not_sent = 2&lt;BR /&gt;
 document_type_not_exist = 3&lt;BR /&gt;
 operation_no_authorization = 4&lt;BR /&gt;
 parameter_error = 5&lt;BR /&gt;
 x_error = 6&lt;BR /&gt;
 enqueue_error = 7OTHERS = 8.IF sy-subrc &amp;lt;&amp;gt; 0.RAISE document_send_api1.ENDIF.&lt;BR /&gt;
* Populate zreceiver return codeLOOP AT t_receivers.&lt;BR /&gt;
 ld_receiver = t_receivers-retrn_code.ENDLOOP.ENDFORM. "send_file_as_email_attachment&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;4. I have 3 PDF's file in various size. But the value of lv_pdf_bytecount
parameter is always 79879. Can you explain in more detail how can I use this
parameter?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 06:35:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247954#M1985818</guid>
      <dc:creator>hagit</dc:creator>
      <dc:date>2020-07-20T06:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247955#M1985819</link>
      <description>&lt;P&gt;SO_DOCUMENT_SEND_API1 is obsolete, but as you already use it, and it works most of the time, maybe you prefer just to do this change:&lt;/P&gt;&lt;P&gt;Replace:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;t_packing_list-doc_size = t_packing_list-body_num * 255.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;with:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;t_packing_list-doc_size = pdf_bytecount.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;NB: maybe in your current case it's 79879 bytes, but it can't be always the same size as the PDF contents will vary.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 10:55:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247955#M1985819</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-07-20T10:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247956#M1985820</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. SO_DOCUMENT_SEND_API1 is obsolete- What is new?&lt;/P&gt;&lt;P&gt;2. When looking at job log overview I see different sizes. But in debugging the value is always 79879&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1827592-capture.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 12:12:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247956#M1985820</guid>
      <dc:creator>hagit</dc:creator>
      <dc:date>2020-07-20T12:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247957#M1985821</link>
      <description>&lt;P&gt;1. Use CL_BCS (not very new by the way, must be since 2001)&lt;/P&gt;&lt;P&gt;2. You must have a bug in your program. Are you sure you pass the right spool number to CONVERT_ABAPSPOOLJOB_2_PDF at each loop? Do you store correctly the value of PDF_BYTECOUNT for each spool?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 13:02:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247957#M1985821</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-07-20T13:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247958#M1985822</link>
      <description>&lt;P&gt;2. In debug mode (by jdbg in SM37) the value of pv_job_id is always 2602 and lv_bytecount is always 79879. It is very strange because the PDF files are different, which suggests that spool id is different in every call to  'CONVERT_ABAPSPOOLJOB_2_PDF'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1827737-capture4.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1827738-capture5.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 13:20:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247958#M1985822</guid>
      <dc:creator>hagit</dc:creator>
      <dc:date>2020-07-23T13:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247959#M1985823</link>
      <description>&lt;P&gt;That explains why.&lt;/P&gt;&lt;P&gt;Did you find out why you called convert_spool_to_pdf three times with the same spool ID as argument?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 17:47:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247959#M1985823</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-07-23T17:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247960#M1985824</link>
      <description>&lt;P&gt;It is strange. In the debug it shows the same spool id , but it can not be the same spool id because the 3 PDF files are different.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 19:34:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247960#M1985824</guid>
      <dc:creator>hagit</dc:creator>
      <dc:date>2020-07-23T19:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247961#M1985825</link>
      <description>&lt;P&gt;&lt;A href="https://answers.sap.com/storage/temp/1827755-a.txt"&gt;a.txt&lt;/A&gt;&lt;/P&gt;&lt;P&gt; As you can see in the attached file:&lt;/P&gt;&lt;P&gt;1. The main loop calls c_alv_and_mail_it &lt;/P&gt;&lt;P&gt;2. c_alv_and_mail_it creates the ALV and calls alv2pdf_and_mail_it&lt;/P&gt;&lt;P&gt;3. alv2pdf_and_mail_it calls FUNCTION 'ZALV2PDF_AND_MAIL_IT&lt;/P&gt;&lt;P&gt;4. in FUNCTION 'ZALV2PDF_AND_MAIL_IT - if it is batch&lt;/P&gt;&lt;P&gt;   4.1 Calls get_job_details, which returns jobcount, jobname, stepcount by calling FUNCTION 'GET_JOB_RUNTIME_INFO'&lt;/P&gt;&lt;P&gt;   4.2 Calls get_batch_job_id_in_spool, which returns the spool id by selecting from &lt;/P&gt;&lt;P&gt;tbtcp&lt;/P&gt;&lt;P&gt;   4.3 Calls convert_spool_to_pdf, which calls CONVERT_ABAPSPOOLJOB_2_PDF with the parameter spool id&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 20:18:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247961#M1985825</guid>
      <dc:creator>hagit</dc:creator>
      <dc:date>2020-07-23T20:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247962#M1985826</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi Sandra,&lt;/P&gt;&lt;P&gt;The main issue 'Translate using variable via pattern'
was solved, so I want to reward points. How do I reward?&lt;/P&gt;Hagit</description>
      <pubDate>Tue, 28 Jul 2020 05:37:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247962#M1985826</guid>
      <dc:creator>hagit</dc:creator>
      <dc:date>2020-07-28T05:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247963#M1985827</link>
      <description>&lt;P&gt;Thanks for the feedback. If you want to "reward" me, continue following the &lt;A href="https://www.sap.com/community/resources/rules-of-engagement.html"&gt;Rules of Engagement&lt;/A&gt; of SAP Community. Upvote the answers that help or downvote those which don't help, choose the "Best Answer" (button "Accept", as currently done), close the question with the right reason. Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 05:52:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247963#M1985827</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-07-28T05:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247964#M1985828</link>
      <description>&lt;P&gt;I looked at &lt;A href="https://www.sap.com/community/resources/rules-of-engagement.html"&gt;Rules
of Engagement&lt;/A&gt; but did not find any reference how to reward points.&lt;/P&gt;&lt;P&gt;Can you explain in more details  what should I do in order to reward points? In some links I saw that a star should appears next to the answer in order to reward. But I do not see any star&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 08:37:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247964#M1985828</guid>
      <dc:creator>hagit</dc:creator>
      <dc:date>2020-07-28T08:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Translate using variable via pattern</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247965#M1985829</link>
      <description>&lt;P&gt;What do you mean by "Upvote the answers that help or downvote those which
don't help" Do you mean just click on the arrow (yellow)? The maximum that I can give is 2. Is this what you mean? And after that I just have to close the thread?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1827849-capture6.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 08:47:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/translate-using-variable-via-pattern/m-p/12247965#M1985829</guid>
      <dc:creator>hagit</dc:creator>
      <dc:date>2020-07-28T08:47:17Z</dc:date>
    </item>
  </channel>
</rss>

