<?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: Selection Screen within Function Group &amp;gt; Background Processing in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-screen-within-function-group-gt-background-processing/m-p/3159407#M751612</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you run this program, it will automatically create a background job.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: w_count like TBTCJOB-JOBCOUNT,
      w_class like TBTCJOB-JOBCLASS.
data: w_uname like TBTCJOB-AUTHCKNAM.

parameters:  w_name  like TBTCJOB-JOBNAME.
* the selection parameters which you need to pass to FM
parameters: fld1 type char10.

start-of-selection.

  w_name  = 'ZTEST_NP'.
  w_class = 'A'.

  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
*     DELANFREP              = ' '
      JOBGROUP               = 'TEST'
      JOBNAME                = w_name
*     SDLSTRTDT              = NO_DATE  " &amp;lt; required start date
*     SDLSTRTTM              = NO_TIME
*      JOBCLASS               = w_class
    IMPORTING
      JOBCOUNT               = w_count
*   CHANGING
*     RET                    =
*   EXCEPTIONS
*     CANT_CREATE_JOB        = 1
*     INVALID_JOB_DATA       = 2
*     JOBNAME_MISSING        = 3
*     OTHERS                 = 4
            .
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


  SUBMIT ztest_np1 with p_char = fld1  " &amp;lt;&amp;lt; your program name with the parameters
                   VIA JOB w_name NUMBER w_count
                    AND RETURn.


  CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
*     AT_OPMODE                         = ' '
*     AT_OPMODE_PERIODIC                = ' '
*     CALENDAR_ID                       = ' '
*     EVENT_ID                          = ' '
*     EVENT_PARAM                       = ' '
*     EVENT_PERIODIC                    = ' '
      JOBCOUNT                          = w_count
      JOBNAME                           = w_name
*     LASTSTRTDT                        = NO_DATE
*     LASTSTRTTM                        = NO_TIME
*     PRDDAYS                           = 0
*     PRDHOURS                          = 0
*     PRDMINS                           = 0
*     PRDMONTHS                         = 0
*     PRDWEEKS                          = 0
*     PREDJOB_CHECKSTAT                 = ' '
*     PRED_JOBCOUNT                     = ' '
*     PRED_JOBNAME                      = ' '
*     SDLSTRTDT                         = NO_DATE
*     SDLSTRTTM                         = NO_TIME
*     STARTDATE_RESTRICTION             = BTC_PROCESS_ALWAYS
      STRTIMMED                         = 'X'
*     TARGETSYSTEM                      = ' '
*     START_ON_WORKDAY_NOT_BEFORE       = SY-DATUM
*     START_ON_WORKDAY_NR               = 0
*     WORKDAY_COUNT_DIRECTION           = 0
*     RECIPIENT_OBJ                     =
*     TARGETSERVER                      = ' '
*     DONT_RELEASE                      = ' '
*     TARGETGROUP                       = ' '
*      DIRECT_START                      = 'X'
*   IMPORTING
*     JOB_WAS_RELEASED                  =
*   CHANGING
*     RET                               =
*   EXCEPTIONS
*     CANT_START_IMMEDIATE              = 1
*     INVALID_STARTDATE                 = 2
*     JOBNAME_MISSING                   = 3
*     JOB_CLOSE_FAILED                  = 4
*     JOB_NOSTEPS                       = 5
*     JOB_NOTEX                         = 6
*     LOCK_FAILED                       = 7
*     INVALID_TARGET                    = 8
*     OTHERS                            = 9
            .
  IF SY-SUBRC = 0.
    WRITE: 'Job is ready'.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Dec 2007 17:09:46 GMT</pubDate>
    <dc:creator>naimesh_patel</dc:creator>
    <dc:date>2007-12-06T17:09:46Z</dc:date>
    <item>
      <title>Selection Screen within Function Group &gt; Background Processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-screen-within-function-group-gt-background-processing/m-p/3159404#M751609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using a function pool to decouple screens from the application model. I created a program (Type: Executable Program). Within "START-OF-SELECTION" I am calling a static "main" method of a local class. Within this method I am calling a function which calls a selection screen. The selection screen is declared in the top include of the function group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is, if doing it that way I am loosing the possibility to start the report in background by choosing "Program &amp;gt; Execute in Background" after filling the selection screen. Any ideas how to solve this problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Daniel Koffler&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;START-OF-SELECTION --------------------------------------------------*&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  lcl_dw_export=&amp;gt;main( ).       &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;main ----------------------------------------------------------------*&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  METHOD main.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Call Selection Screen&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CALL FUNCTION 'Z_DW_EXPORT_SELECTION'&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        e_range_pspid    = range_pspid&lt;/P&gt;&lt;P&gt;        e_range_posid    = range_posid&lt;/P&gt;&lt;P&gt;        e_range_prart    = range_prart&lt;/P&gt;&lt;P&gt;        e_range_wrttp    = range_wrttp&lt;/P&gt;&lt;P&gt;        e_range_versn    = range_versn&lt;/P&gt;&lt;P&gt;        e_range_gjahr    = range_gjahr&lt;/P&gt;&lt;P&gt;        e_range_perbl    = range_perbl&lt;/P&gt;&lt;P&gt;        e_range_soskonti = range_soskonti&lt;/P&gt;&lt;P&gt;        e_range_regio    = range_regio&lt;/P&gt;&lt;P&gt;        e_subrc          = subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION-POOL z_dw_export_screens.          "MESSAGE-ID ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Selection Screen&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA: g_proj TYPE proj,&lt;/P&gt;&lt;P&gt;      g_prps TYPE prps,&lt;/P&gt;&lt;P&gt;      g_cosp TYPE cosp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF SCREEN 100 AS WINDOW TITLE text-002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-003.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS s_pspid FOR g_proj-pspid OBLIGATORY.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS s_posid FOR g_prps-posid.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS s_prart FOR g_prps-prart DEFAULT '10' TO '99'.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS s_konti FOR g_prps-zzsoskonti.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS s_regio FOR g_prps-zzregio.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-004.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS s_wrttp FOR g_cosp-wrttp OBLIGATORY.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS s_gjahr FOR g_cosp-gjahr OBLIGATORY.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS s_perbl FOR g_cosp-perbl DEFAULT 1 TO 12 NO-DISPLAY.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS s_versn FOR g_cosp-versn DEFAULT 0 OBLIGATORY.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF SCREEN 100.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION z_dw_export_selection.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local interface:&lt;/P&gt;&lt;P&gt;*"  EXPORTING&lt;/P&gt;&lt;P&gt;*"     REFERENCE(E_RANGE_PSPID) TYPE  ZRANGE_PSPID&lt;/P&gt;&lt;P&gt;*"     REFERENCE(E_RANGE_POSID) TYPE  ZRANGE_POSID&lt;/P&gt;&lt;P&gt;*"     REFERENCE(E_RANGE_PRART) TYPE  ZRANGE_PRART&lt;/P&gt;&lt;P&gt;*"     REFERENCE(E_RANGE_WRTTP) TYPE  ZRANGE_CO_WRTTP&lt;/P&gt;&lt;P&gt;*"     REFERENCE(E_RANGE_VERSN) TYPE  ZRANGE_PSVERSN&lt;/P&gt;&lt;P&gt;*"     REFERENCE(E_RANGE_GJAHR) TYPE  ZRANGE_GJAHR&lt;/P&gt;&lt;P&gt;*"     REFERENCE(E_RANGE_PERBL) TYPE  ZRANGE_PERBL&lt;/P&gt;&lt;P&gt;*"     REFERENCE(E_RANGE_SOSKONTI) TYPE  ZRANGE_SOSKONTI&lt;/P&gt;&lt;P&gt;*"     REFERENCE(E_RANGE_REGIO) TYPE  ZRANGE_REGIO&lt;/P&gt;&lt;P&gt;*"     REFERENCE(E_SUBRC) TYPE  SYST-SUBRC&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL SELECTION-SCREEN 100.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  e_range_pspid = s_pspid[].&lt;/P&gt;&lt;P&gt;  e_range_posid = s_posid[].&lt;/P&gt;&lt;P&gt;  e_range_prart = s_prart[].&lt;/P&gt;&lt;P&gt;  e_range_wrttp = s_wrttp[].&lt;/P&gt;&lt;P&gt;  e_range_versn = s_versn[].&lt;/P&gt;&lt;P&gt;  e_range_gjahr = s_gjahr[].&lt;/P&gt;&lt;P&gt;  e_range_perbl = s_perbl[].&lt;/P&gt;&lt;P&gt;  e_range_soskonti = s_konti[].&lt;/P&gt;&lt;P&gt;  e_range_regio = s_regio[].&lt;/P&gt;&lt;P&gt;  e_subrc = sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFUNCTION.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2007 16:01:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selection-screen-within-function-group-gt-background-processing/m-p/3159404#M751609</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-06T16:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Selection Screen within Function Group &gt; Background Processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-screen-within-function-group-gt-background-processing/m-p/3159405#M751610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Make one wrapper program which SUBMITs your main program with job options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the FM JOB_OPEN and JOB_CLOSE to create a job.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2007 16:10:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selection-screen-within-function-group-gt-background-processing/m-p/3159405#M751610</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2007-12-06T16:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: Selection Screen within Function Group &gt; Background Processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-screen-within-function-group-gt-background-processing/m-p/3159406#M751611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Naimesh Patel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could you please give me a rough example?&lt;/P&gt;&lt;P&gt;The wrapper program needs it's own selection screen, does it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;Daniel Koffler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2007 16:28:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selection-screen-within-function-group-gt-background-processing/m-p/3159406#M751611</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-06T16:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Selection Screen within Function Group &gt; Background Processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selection-screen-within-function-group-gt-background-processing/m-p/3159407#M751612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you run this program, it will automatically create a background job.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: w_count like TBTCJOB-JOBCOUNT,
      w_class like TBTCJOB-JOBCLASS.
data: w_uname like TBTCJOB-AUTHCKNAM.

parameters:  w_name  like TBTCJOB-JOBNAME.
* the selection parameters which you need to pass to FM
parameters: fld1 type char10.

start-of-selection.

  w_name  = 'ZTEST_NP'.
  w_class = 'A'.

  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
*     DELANFREP              = ' '
      JOBGROUP               = 'TEST'
      JOBNAME                = w_name
*     SDLSTRTDT              = NO_DATE  " &amp;lt; required start date
*     SDLSTRTTM              = NO_TIME
*      JOBCLASS               = w_class
    IMPORTING
      JOBCOUNT               = w_count
*   CHANGING
*     RET                    =
*   EXCEPTIONS
*     CANT_CREATE_JOB        = 1
*     INVALID_JOB_DATA       = 2
*     JOBNAME_MISSING        = 3
*     OTHERS                 = 4
            .
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


  SUBMIT ztest_np1 with p_char = fld1  " &amp;lt;&amp;lt; your program name with the parameters
                   VIA JOB w_name NUMBER w_count
                    AND RETURn.


  CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
*     AT_OPMODE                         = ' '
*     AT_OPMODE_PERIODIC                = ' '
*     CALENDAR_ID                       = ' '
*     EVENT_ID                          = ' '
*     EVENT_PARAM                       = ' '
*     EVENT_PERIODIC                    = ' '
      JOBCOUNT                          = w_count
      JOBNAME                           = w_name
*     LASTSTRTDT                        = NO_DATE
*     LASTSTRTTM                        = NO_TIME
*     PRDDAYS                           = 0
*     PRDHOURS                          = 0
*     PRDMINS                           = 0
*     PRDMONTHS                         = 0
*     PRDWEEKS                          = 0
*     PREDJOB_CHECKSTAT                 = ' '
*     PRED_JOBCOUNT                     = ' '
*     PRED_JOBNAME                      = ' '
*     SDLSTRTDT                         = NO_DATE
*     SDLSTRTTM                         = NO_TIME
*     STARTDATE_RESTRICTION             = BTC_PROCESS_ALWAYS
      STRTIMMED                         = 'X'
*     TARGETSYSTEM                      = ' '
*     START_ON_WORKDAY_NOT_BEFORE       = SY-DATUM
*     START_ON_WORKDAY_NR               = 0
*     WORKDAY_COUNT_DIRECTION           = 0
*     RECIPIENT_OBJ                     =
*     TARGETSERVER                      = ' '
*     DONT_RELEASE                      = ' '
*     TARGETGROUP                       = ' '
*      DIRECT_START                      = 'X'
*   IMPORTING
*     JOB_WAS_RELEASED                  =
*   CHANGING
*     RET                               =
*   EXCEPTIONS
*     CANT_START_IMMEDIATE              = 1
*     INVALID_STARTDATE                 = 2
*     JOBNAME_MISSING                   = 3
*     JOB_CLOSE_FAILED                  = 4
*     JOB_NOSTEPS                       = 5
*     JOB_NOTEX                         = 6
*     LOCK_FAILED                       = 7
*     INVALID_TARGET                    = 8
*     OTHERS                            = 9
            .
  IF SY-SUBRC = 0.
    WRITE: 'Job is ready'.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2007 17:09:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selection-screen-within-function-group-gt-background-processing/m-p/3159407#M751612</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2007-12-06T17:09:46Z</dc:date>
    </item>
  </channel>
</rss>

