<?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: Coding examples for calling VF31 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/coding-examples-for-calling-vf31/m-p/8103208#M1616628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sylvain,&lt;/P&gt;&lt;P&gt;Have you tried to run this report (SD70AV3A) in background mode? I've tried it and it prints all the selected invoices, and there's no list to be shown and there's also no need to click the checkboxes for the invoices you'd like to print.&lt;/P&gt;&lt;P&gt;So some coding could be:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: name LIKE tbtcjob-jobname.
DATA: number LIKE tbtcjob-jobcount.
DATA: print_parameters TYPE pri_params.

name = 'INVOICE_PRINTING'.

RANGES: range FOR nase-kschl.

CLEAR: range.
REFRESH: range.
range-sign = 'I'.
range-option = 'EQ'.
range-low = 'first_output_type'.
CLEAR: range-high.
APPEND range.

range-sign = 'I'.
range-option = 'EQ'.
range-low = 'second_output_type'.
CLEAR: range-high.
APPEND range.

CALL FUNCTION 'JOB_OPEN'
  EXPORTING
    jobname          = name
  IMPORTING
    jobcount         = number
  EXCEPTIONS
    cant_create_job  = 1
    invalid_job_data = 2
    jobname_missing  = 3
    OTHERS           = 4.
IF sy-subrc = 0.
  SUBMIT sd70av3a WITH rg_kschl IN range
                  TO SAP-SPOOL
                  SPOOL PARAMETERS print_parameters
                  WITHOUT SPOOL DYNPRO
                  VIA JOB name NUMBER number
                  AND RETURN.
  IF sy-subrc = 0.
    CALL FUNCTION 'JOB_CLOSE'
      EXPORTING
        jobcount             = number
        jobname              = name
        strtimmed            = 'X'
      EXCEPTIONS
        cant_start_immediate = 1
        invalid_startdate    = 2
        jobname_missing      = 3
        job_close_failed     = 4
        job_nosteps          = 5
        job_notex            = 6
        lock_failed          = 7
        OTHERS               = 8.
    IF sy-subrc &amp;lt;&amp;gt; 0.
      ...
    ENDIF.
  ENDIF.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps. Kind regards,&lt;/P&gt;&lt;P&gt;Alvaro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Jul 2011 15:51:24 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-07-27T15:51:24Z</dc:date>
    <item>
      <title>Coding examples for calling VF31</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/coding-examples-for-calling-vf31/m-p/8103207#M1616627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi to all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to use transaction VF31 to reprint invoices in a program. I would like to loop at my internal table and calling VF31 for every record and for two different Output types. I would like to use command CALL TRANSACTION and avoid using a recording from SHDB to populate the different screen fields. I am struggling in populating the parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have read a bunch of old threads referring to VF31 but I cannot find one with some coding examples. Can anyone send me some coding blocks or refer me to any old threads?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sylvain&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2011 14:46:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/coding-examples-for-calling-vf31/m-p/8103207#M1616627</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-07-27T14:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Coding examples for calling VF31</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/coding-examples-for-calling-vf31/m-p/8103208#M1616628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sylvain,&lt;/P&gt;&lt;P&gt;Have you tried to run this report (SD70AV3A) in background mode? I've tried it and it prints all the selected invoices, and there's no list to be shown and there's also no need to click the checkboxes for the invoices you'd like to print.&lt;/P&gt;&lt;P&gt;So some coding could be:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: name LIKE tbtcjob-jobname.
DATA: number LIKE tbtcjob-jobcount.
DATA: print_parameters TYPE pri_params.

name = 'INVOICE_PRINTING'.

RANGES: range FOR nase-kschl.

CLEAR: range.
REFRESH: range.
range-sign = 'I'.
range-option = 'EQ'.
range-low = 'first_output_type'.
CLEAR: range-high.
APPEND range.

range-sign = 'I'.
range-option = 'EQ'.
range-low = 'second_output_type'.
CLEAR: range-high.
APPEND range.

CALL FUNCTION 'JOB_OPEN'
  EXPORTING
    jobname          = name
  IMPORTING
    jobcount         = number
  EXCEPTIONS
    cant_create_job  = 1
    invalid_job_data = 2
    jobname_missing  = 3
    OTHERS           = 4.
IF sy-subrc = 0.
  SUBMIT sd70av3a WITH rg_kschl IN range
                  TO SAP-SPOOL
                  SPOOL PARAMETERS print_parameters
                  WITHOUT SPOOL DYNPRO
                  VIA JOB name NUMBER number
                  AND RETURN.
  IF sy-subrc = 0.
    CALL FUNCTION 'JOB_CLOSE'
      EXPORTING
        jobcount             = number
        jobname              = name
        strtimmed            = 'X'
      EXCEPTIONS
        cant_start_immediate = 1
        invalid_startdate    = 2
        jobname_missing      = 3
        job_close_failed     = 4
        job_nosteps          = 5
        job_notex            = 6
        lock_failed          = 7
        OTHERS               = 8.
    IF sy-subrc &amp;lt;&amp;gt; 0.
      ...
    ENDIF.
  ENDIF.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps. Kind regards,&lt;/P&gt;&lt;P&gt;Alvaro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2011 15:51:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/coding-examples-for-calling-vf31/m-p/8103208#M1616628</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-07-27T15:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Coding examples for calling VF31</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/coding-examples-for-calling-vf31/m-p/8103209#M1616629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alvaro,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your answer. It was really helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sylvain&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2011 08:38:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/coding-examples-for-calling-vf31/m-p/8103209#M1616629</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-08T08:38:48Z</dc:date>
    </item>
  </channel>
</rss>

