Regarding SUBMIT statement - to process a program in background

Hi All,
I have issue of submitting a program in background and also i need to process the no of records come from program by splitting them by 1000(n).
First of all i have program whose code is like following:
<b>REPORT  z_update_material_master.</b>
TYPES: BEGIN OF t_marc,
          matnr LIKE marc-matnr,   "Material Number
          werks LIKE marc-werks,   "Plant
          beskz LIKE marc-beskz,   "Procurement Type
          sobsl LIKE marc-sobsl,   "Special procurement type
          fhori LIKE marc-fhori,   "Scheduling Margin Key for Floats
          dzeit LIKE marc-dzeit,   "In-house production time
          plifz LIKE marc-plifz,   "Planned delivery time in days
          webaz LIKE marc-webaz,   "Goods rcpt processing time
          pwwrk LIKE t460a-wrk02,  "Production plant in planned order
          erhor LIKE t436a-erhor,  "Opening periodr
          zlt   TYPE p DECIMALS 3, "Total replenishment lead time
          ztlt  TYPE p DECIMALS 3, "Total replenishment lead time
          wzeit TYPE p DECIMALS 3, "Total replenishment lead time
          upd(1) TYPE c,            "UPDATE INDICATER
          ind    TYPE c,
     END OF t_marc.
DATA: i_marc  TYPE SORTED TABLE OF t_marc INITIAL SIZE 0
               WITH HEADER LINE
               WITH NON-UNIQUE KEY matnr werks,
      i_marc_rpt LIKE i_marc OCCURS 0 WITH HEADER LINE.
DATA: l_plantdata  LIKE bapi_marc,
      l_headdata   LIKE bapimathead,
      l_plantdatax LIKE bapi_marcx,
      l_tabix      LIKE sy-tabix.
CONSTANTS: c_s TYPE c VALUE 'S',
           c_x TYPE c VALUE 'X'.
DATA i_temp_bapi_return LIKE bapi_matreturn2
                        OCCURS 0 WITH HEADER LINE.
DATA BEGIN OF i_temp_zppe0091_01 OCCURS 0.
        INCLUDE STRUCTURE zppe0091_01.
DATA: END OF i_temp_zppe0091_01.
DATA: l_tab_nam LIKE rstable-tabname VALUE 'ZPPE0091_01'.
SELECT * FROM zppe0091_01
         INTO CORRESPONDING FIELDS OF TABLE i_temp_zppe0091_01.
IF sy-subrc EQ 0.
  LOOP AT i_temp_zppe0091_01 WHERE upd = c_x.
    l_tabix = sy-tabix.
    l_headdata-material     = i_temp_zppe0091_01-matnr.
    l_plantdata-plant       = i_temp_zppe0091_01-werks.
    l_plantdata-replentime  = i_temp_zppe0091_01-wzeit.
    l_plantdatax-replentime = c_x.
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
      EXPORTING
        headdata       = l_headdata
        plantdata      = l_plantdata
        plantdatax     = l_plantdatax
      TABLES
        returnmessages = i_temp_bapi_return.
    IF NOT i_temp_bapi_return[] IS INITIAL.
      READ TABLE i_temp_bapi_return WITH KEY type = c_s.
      IF sy-subrc EQ 0.
        i_marc_rpt-matnr = i_temp_zppe0091_01-matnr.
        i_marc_rpt-werks = i_temp_zppe0091_01-werks.
        APPEND i_marc_rpt. CLEAR i_marc_rpt.
      ELSE.
        i_temp_zppe0091_01-upd = space.
        MODIFY i_temp_zppe0091_01 INDEX l_tabix TRANSPORTING upd.
      ENDIF.
    ENDIF.
  ENDLOOP.
ENDIF.
Now i want to call this program from another program that is already exists by using <b>SUBMIT</b>
statement in background and i need to process this program by dividing records by <b>1000</b> into seperate session.
how can i do it. Can any body tell me the solution with syntax.
I might get lot of records from above program so i want to split them into diffrent sessions based on number of records(1000).
can any body give me the solution.
Thanks in advance.
Thanks & Regards,
Rayeez.

Try implementing the following code. Use the code accordingly...
  MOVE 100 TO c_recs_b4_split.
  IF num_src_trans > c_recs_b4_split.
    target_break = num_src_trans / p_thread.
  ELSE.
    target_break = num_src_trans + 1.
  ENDIF.
  wa_subbch  = 1.
  last_index = 1.
No batch split required if total recrods less than 100
  IF num_src_trans < c_recs_b4_split.
    CLEAR  : range_btch.
    REFRESH: range_btch.
    IF wa_subbch = p_thread.
      target_break = num_src_trans.
    ENDIF.
    MOVE 'S_SRCTRN' TO range_wa-selname.
    MOVE 'S'        TO range_wa-kind   .
    MOVE 'I'        TO range_wa-sign   .
    MOVE 'EQ'       TO range_wa-option .
    LOOP AT itab_src_trans INTO st_src_trans.
      MOVE st_src_trans-src_tran_id TO range_wa-low.
      APPEND range_wa TO range_btch.
    ENDLOOP.
Step 3 Submit the batch.
    v_job_no = v_job_no + 1.
    PERFORM submit_tp_jobs.
  ELSE.
    DO.
Step 1 Collect data for the target count
      CLEAR  : range_btch.
      REFRESH: range_btch.
     IF wa_subbch = p_thread.
       target_break = num_src_trans.
     ENDIF.
      MOVE 'S_SRCTRN' TO range_wa-selname.
      MOVE 'S'        TO range_wa-kind   .
      MOVE 'I'        TO range_wa-sign   .
      MOVE 'EQ'       TO range_wa-option .
      IF wa_subbch = p_thread.
        target_break = num_src_trans - v_cnt .
      ENDIF.
      LOOP AT itab_src_trans INTO st_src_trans FROM last_index.
        last_index = sy-tabix.
        batch_total = batch_total + 1.
        IF batch_total <= target_break.
          MOVE st_src_trans-src_tran_id TO range_wa-low.
          APPEND range_wa TO range_btch.
        ELSE.
          EXIT.
        ENDIF.
        v_cnt = v_cnt + 1.
      ENDLOOP.
      CLEAR batch_total.
Step 2 Submit the batch.
      v_job_no = v_job_no + 1.
      PERFORM submit_tp_jobs.
      ADD 1 TO wa_subbch.
      IF wa_subbch > p_thread.
        EXIT.
      ENDIF.
    ENDDO.
  ENDIF.
FORM submit_tp_jobs .
  DATA : l_jobcount LIKE tbtcjob-jobcount,
         l_jobrelease LIKE btch0000-char1,
         w_job_flag VALUE 'X',
         w_process_mode,
         w_user_print_params  LIKE pri_params.
  l_jobname = p_batch.
  CONCATENATE 'TP_'  l_jobname '_' v_job_no INTO l_jobname.
  CONDENSE l_jobname NO-GAPS.
  w_process_mode = ' '.
  IF NOT range_btch[] IS INITIAL.
    PERFORM create_post_ctrl.
    CALL FUNCTION 'JOB_OPEN'
      EXPORTING
        jobname  = l_jobname
      IMPORTING
        jobcount = l_jobcount.
    SUBMIT zfi_pc_tran_proc
      AND RETURN
           WITH p_batch  = p_batch
           WITH p_jobid  = p_jobid
           WITH p_mode   = w_process_mode
           WITH p_subbch = wa_subbch
           WITH p_jobq   = p_jobid
           WITH p_cntlmt = p_cntlmt
           WITH p_tpiop  = p_iop
           WITH SELECTION-TABLE range_btch
           USER sy-uname
           VIA JOB l_jobname NUMBER l_jobcount
           TO SAP-SPOOL
           SPOOL PARAMETERS w_user_print_params
           WITHOUT SPOOL DYNPRO.
    CALL FUNCTION 'JOB_CLOSE'
      EXPORTING
        jobcount             = l_jobcount
        jobname              = l_jobname
        strtimmed            = 'X'
      IMPORTING
        job_was_released     = l_jobrelease
      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.
  ENDIF.
ENDFORM.                    " submit_tp_jobs
Pl. add the points....

Similar Messages

  • Regarding SUBMIT Statement

    Hi,
    I am calling a batch job (B) (in back groung) using SUBMIT statement, from a report program (Say A). But I have to Pass some internal tables and few variable to the Batch job (B).
    Can someone tell me how I can pass the Internal tables and variables ? Is it possible to pass through SUBMIT statement only? Is there some other than the use of Import-Export statement?
    Thanks and regards,
    Pankaj Bist.

    Hi pankaj,
      SUBMIT <PROGRAM NAE>   =   ds_name            " Creating batch input session
                      WITH  fl_check  =   fl_check
                      WITH  os_xon    =   os_xon
                      WITH  xnonunic  =   xnonunic
                      WITH  callmode  =   callmode
                      WITH  max_comm  =   max_comm
                      WITH  pa_xprot  =   pa_xprot
                      WITH  anz_mode  =   anz_mode
                      WITH  update    =   update
                      WITH  xpop      =   xpop
                      WITH  xlog      =   xlog
                      WITH  xinf      =   xinf  AND RETURN.
    u can pass the variables like this.
    the variables which i have pass to the program all are the selection screen aprameteers of the program .
    I hope this will work for you.
    Thanks,

  • I have a problem in processing the program in background

    Hi,
    We have cloned the T'code V_V2 and added some additional functionality and when we try to run the program in background the error is blocking the process
    This is because, say example i am tring to process the sales order in production systen through my program ,in that time some one may chage the sales document . in trhis case my program should not blocked it should check the block before processing and then it should proceed.
    is there any FM to find the blocked sales order.
    Regards,
    Vijay

    Try using the FM:
    ENQUE_READ2
    Passing the follwing values:
    GNAME --> VBAK (Sales Order header table)
    GARG   --> The lock argument
                       (This will be a combination of client number anb Sales Order No.
                        Eg: '3001210000054' where the first three digit i,e 300 is the client No
                       and 1210000054 is the sales order no.)
    Regards,
    Firoz.

  • How to pass radiobuttons using a submit statements.

    Hi All,
    Can anyone tell me how to pass radiobuttons using Submit statement.
    My problem is that I am able to pass one select option and one parameter using the statement:
    submit (v_repid) to sap-spool without spool dynpro
                       spool parameters s_print_parms
                       using selection-screen '1000' WITH SELECTION-TABLE t_rspar_tab
                       and return.
    This selection screens got to check selections based on 2 radio buttons available in the selection screen which also i need to pass through SUBMIT.Please let me know how do i pass this to the Submit statement.
    Thankx in advance...
    Helpful answers will be rewarded fully...

    Hi Susanth,
                   Create Variant for the calling program, Give that variant( here in the below program variant for calling program that I created is VAR1) in the calling program in SUBMIT Statement.
    <b>
    CALLING PROGRAM:
    </b>
    data:
      w_variant(5) TYPE c VALUE 'VAR1'.
    SUBMIT YH625_CALLED_PROGRAM USING SELECTION-SET w_variant.
    <b>CALLING PROGRAM:</b>
    TABLES spfli.
    parameters:
          w_radio1 RADIOBUTTON GROUP g1,
          w_radio2 RADIOBUTTON GROUP g1.
    SELECT-OPTIONS s_table FOR spfli-carrid.
    WRITE '*************** This is Called program output **********************'.
    Hope this solves your problem.
    If you any query you are welcome.
    Regards,
    V.Raghavender.

  • Call transaction KB21N processed by a program in background mode

    Hi to all,
    I call transaction KB21N using BDCDATA in a custom program. If I process this program in foreground mode all it's OK, but if I process the program in background mode, I have a runtime error with DUMP: RAISE EXCEPTION with exception condition CNTL_ERROR. This program has to be executed in background so a bapi exist to use instead of call transaction or something else?
    Thank you very much,
    regards
    Antonio

    HI Antonio,
    The transaction you are dealing with is an SAP Enjoy transaction and for such transactions it is not recommended to do a BDC. YOu should search for  a BAPI for the same as you have already identified. Basically the enjoy transactions uses GUI controls which cannot be handled by BDC.
    BAPI_ACC_ACTIVITY_ALLOC_POST may serve your purpose.
    Regards,
    ravi
    Message was edited by:
            Ravi Kanth Talagana

  • Executing the program in Background

    Hi experts i'm trying to Execute the Program in background.
    Given the Input and output file locations and Press F9 for process the program in background from SE38. cause i want to run my program as a batch(Background)
    but its not accepting. can you please help me how to resolve this issue.
    i'm providing the code can you please verify that.
    Many Thanks
    SELECTION-SCREEN                                                     *
    selection-screen begin of block b1 with frame title text-001.
    *.. Filename
    PARAMETERS: f_name TYPE char100,     "Upload filename
                d_name TYPE char100.     " Download filename
    selection-screen end of block b1 .
    SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS: p_serv radiobutton group RAD1,
                p_frnt radiobutton group RAD1 default 'X'.
    SELECTION-SCREEN: END OF BLOCK b2.
    AT SELECTION-SCREEN ON VALUE-REQUEST  FOR f_name.
    *.. Data Declaration
      DATA: lt_file TYPE filetable,
            lv_file TYPE LINE OF filetable,
            rc_i TYPE i,
            cl_gui TYPE REF TO cl_gui_frontend_services,
            w_path  LIKE dxfields-longpath.
    *.. Check if from server or frontend
      IF p_frnt = 'X'.
    *.. Create objects for method
      CREATE OBJECT cl_gui.
    *.. Clear the filename
      CLEAR f_name.
    *.. Call method to search for file
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title = 'Choose Input File'
        CHANGING
          file_table   = lt_file
          rc           = rc_i
        EXCEPTIONS
          OTHERS       = 4.
    *.. Check if file found
      IF sy-subrc EQ 0.
    *.. Check that file path not empty
        CHECK NOT lt_file[] IS INITIAL.
        LOOP AT lt_file INTO lv_file.
    *..   Set parameter to filename
          f_name = lv_file-filename.
        ENDLOOP.
      ENDIF.
    *.. Free object
      FREE cl_gui.
    *.. Upload from Server
      ELSE.
    Retrieve filename
        CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
          EXPORTING
            i_location_flag       = 'A'
            i_server              = ' '
            i_path                = '/sap_ftp/'
            filemask              = '**'
            fileoperation         = 'R'
          IMPORTING
      O_LOCATION_FLAG       =
      O_SERVER              =
            o_path                = w_path
      ABEND_FLAG            =
          EXCEPTIONS
           rfc_error             = 1
           error_with_gui        = 2
           OTHERS                = 3.
    Set file path
        f_name = w_path.
      ENDIF.
    *.. File selection for output file
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR d_name.
    *.. Only allow search for front-end
      IF p_frnt = 'X'.
    *.. Data Declaration
        DATA: lt_file TYPE filetable,
              lv_file TYPE LINE OF filetable,
              rc_i TYPE i,
              cl_gui TYPE REF TO cl_gui_frontend_services.
    *.. Create objects for method
        CREATE OBJECT cl_gui.
    *.. Clear the filename
        CLEAR d_name.
    *.. Call method to search for file
        CALL METHOD cl_gui_frontend_services=>file_open_dialog
          EXPORTING
            window_title = 'Choose Input File'
          CHANGING
            file_table   = lt_file
            rc           = rc_i
          EXCEPTIONS
            OTHERS       = 4.
    *.. Check if file found
        IF sy-subrc EQ 0.
    *.. Check that file path not empty
          CHECK NOT lt_file[] IS INITIAL.
          LOOP AT lt_file INTO lv_file.
    *..   Set parameter to filename
            d_name = lv_file-filename.
          ENDLOOP.
        ENDIF.
    *.. Free object
        FREE cl_gui.
      ENDIF.
    *.. General Checks for Selection screen
    AT SELECTION-SCREEN.
    *.. Check if program run in batch mode and ping directory
      IF sy-batch = 'X'.
    *.. Move filename to file_name
        file_name = d_name.
    *.. Check if path can be reached
        OPEN DATASET file_name FOR INPUT IN TEXT MODE.
        IF sy-subrc NE 0.
          MESSAGE e082(zsomerfield).
        ENDIF.
      ENDIF.
    NITIALIZATION.
    *.. ALV Variables
      variant_save = 'A'.
      w_repid   = sy-repid.
      w_variant_handle = c_handl.
    START-OF-SELECTION                                                   *
    START-OF-SELECTION.
    *.. Check if batch program running in batch mode or not
      IF sy-batch = 'X'.
    *.. Open file on application server for reading
      OPEN DATASET file_name FOR INPUT IN TEXT MODE.
      DO.
    *.. Upload entries
        READ DATASET file_name INTO zpernr.
    *.. IF end of file reached then exit DO statement
        IF sy-subrc = '4'.
          EXIT.
        ELSE.
    *.. IF entry found then add to employee table
          in_file-empnum = zpernr.
    *..     Add entries to table
          APPEND: in_file.
    *..     Clear header lines
          CLEAR: in_file, zpernr.
        ENDIF.
      ENDDO.
    *.. Close dataset
      CLOSE DATASET file_name.
    *.. Get file from frontend and run in foreground
      ELSE.
    *.. Upload from local machine.
    DATA: file_name TYPE string.  "LIKE rlgrap-filename,
    *.. Set filename to filename from screen
      file_name = f_name.
    *.. Upload the information from the file into the table in_file
      CALL FUNCTION 'GUI_UPLOAD'
           EXPORTING
                filename                = file_name
           TABLES
                data_tab                = in_file
           EXCEPTIONS
                file_open_error         = 1
                file_read_error         = 2
                no_batch                = 3
                gui_refuse_filetransfer = 4
                invalid_type            = 5
                no_authority            = 6
                unknown_error           = 7
                bad_data_format         = 8
                header_not_allowed      = 9
                separator_not_allowed   = 10
                header_too_long         = 11
                unknown_dp_error        = 12
                access_denied           = 13
                dp_out_of_memory        = 14
                disk_full               = 15
                dp_timeout              = 16
                OTHERS                  = 17.
    *..   Make sure file uploaded correctly
      IF sy-subrc <> 0.
       MESSAGE E018(ZHR_MESSAGES).
      ELSE.
      MESSAGE i017(ZHR_MESSAGES).
      ENDIF.
      ENDIF.

    Hi Vamsi,
    <b>First Check in the Foreground your program is working for the application server file or not</b>
    When you will Execute your program in Background internal table "ZPERNR" will be populated from the file that is there on the application server.
    After that what you want to do with the internal table.I think you have not sent the whole code.
    In background FM GUI_UPLOAD willl not work.
    If you want to debug your code put wait for 100 seconds at the place where you want to dubug your code.Go to transaction code SM50 your job will be running there.
    Select Your job
    Go to  Menu Bar Program/Mode - > program - > Debugging.
    In this way you can debug your code.
    First Check in the Foreground your program is working for the application server file or not

  • Submit statement in ABAP program

    Hi All,
          I am using two submit statements in my program for two different reports. When i run the program i get the output screens of the two reports at the ouptut. Is there any way i can hide the user seeing the output screens of the two programs and display only the output screen of my program. If you have any clues please post it.
    Thanks & Regards,
    Rahul Rathi

    You can call executable programs from other ABAP programs using the following statement:
    SUBMIT <rep>|(<field>) [AND RETURN] [<options>].
    You can either specify the name of the program you want to call statically by entering the program name in the code of the calling program, or dynamically by specifying the name of a field (in parentheses) containing the name of the program. If the system cannot find the specified executable program when trying to execute the SUBMIT statement, a runtime error occurs.
    If you omit the AND RETURN addition, all data and list levels of the calling program (the entire internal session) are deleted. After the called executable program has finished, control returns to the level from which you started the calling program.
    If you use AND RETURN, the system stores the data of the calling executable program and returns to the calling after processing the called program. The system resumes executing the calling program at the statement following the call.
    The SUBMIT statement has a set of additions <options> for passing data to the called program and specifying various other processing options. Some of them are described in the following sections:
    Have a look at below link. It will help you.
    http://www.sapdevelopment.co.uk/reporting/rep_submit.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9dd035c111d1829f0000e829fbfe/content.htm
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • Problem with Submit statement into print program for delivery

    Hi all,
    i got a problem with the SUBMIT statement that i put into a print program associated to a delivery output message.
    If i print the message by VL02N or VL71, everything works.
    But if i associate the output with RV56ABST, the SUBMIT instruction isn't accepted and i get the message
    "Processor ABAP: POSTING_ILLEGAL_STATEMENT"
    There is any solution to this situation?
    Why i cannot use the SUBMIT statement in this case?

    Hi Simone,
    you could try to do the operation in a separate task (call a function in starting new task). This will decouple your current process from the new task.
    Cheers,
    Stefan.

  • Dout in Submit statement in print program....

    Hi all,
    In my print program, after printing my forms i need to call another print program. For this im using SUBMIT statement.
    I hope my print program goes to an update task. So when it encounters a function module or submit statement it coming out of the print program.
    The same logic is working fine when i click 'PRINT PREVIEW' button in the shop papers list of IW32 Transaction. But the control comes out of the program when i go through the PRINT button in the IW32 transaction.
    Im not sure whether the control is coming out cuz of any update task.
    So please help on this. It's urgent.
    Thanks,
    karthik

    SUBMIT always starts new LUW. Not sure if I understand the rest of your "doubt"... You might want to read a bit more on the LUW concept and also check the ABAP documentation on SUBMIT.
    http://help.sap.com/saphelp_nw70/helpdata/en/41/7af4b9a79e11d1950f0000e82de14a/frameset.htm

  • Regarding for Submit statement

    Hi,
        am Using below statement in my called program .i should use this statement in my called program it's must. if we use this statement am not able to come back to called program.
    how to returm from calling program to called program by using the below statement.
         SUBMIT rqmell10   WITH FREE SELECTIONS
                        it_texpr .

    Hi,
    <li>Your wording seems to be not correct.
    <li>Lets say we have two programs A and B. If we call program B in program A. We call A as Calling program and B as called program.
    <li>Try this way to use SUBMIT statement.
    REPORT zcalling_program.
    DATA: it_rsparams TYPE STANDARD  TABLE OF rsparams,
          wa_rsparams LIKE LINE OF it_rsparams.
    wa_rsparams-selname = 'S_MATNR'. "Screen field name of called program
    wa_rsparams-kind    = 'S'. "S=Select-options P=Parameters
    wa_rsparams-sign    = 'I'.
    wa_rsparams-option  = 'EQ'.
    wa_rsparams-low     = '11010'.
    wa_rsparams-high    = space.
    SUBMIT zcalled_program VIA SELECTION-SCREEN WITH SELECTION-TABLE it_rsparams AND RETURN.
    Thanks
    Venkat.O

  • How to use Submit Statement for mutiple Spools.

    Hi Gurus,
    I have a requirement wherein I need to Submit a Report Program to SAP-SPOOL which generates output for multiple Idocs.
    For each Idoc I need to attach the spool to a particular object_id.
    As of now I am doing this by putting the Submit statement in a loop.
    I want to meet the same functionality without using a loop for different Idocs.
    Ex.
    LOOP AT IDOCS.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    CALL FUNCTION 'JOB_OPEN'
    IF sy-subrc = 0.
      SUBMIT YFAPINV_IDOC_RPTS  TO SAP-SPOOL    "USING SELECTION-SCREEN '1000'
        WITHOUT SPOOL DYNPRO
        SPOOL PARAMETERS print_parameters
        WITH CREDATE IN CREDATE
        WITH CRETIME IN CRETIME
        WITH DOCNUM IN DOCNUM
        WITH VENDOR IN VENDOR
        WITH V_INVOIC IN V_INVOIC
        WITH MESCODE IN MESCODE
        WITH DOCSTAT IN DOCSTAT
        WITH DC_NBR IN DC_NBR
        WITH DOC_TYPE IN DOC_TYPE
        WITH S_BSART IN S_BSART
        WITH ap1_flag eq 'X'
        AND RETURN.
      IF sy-subrc EQ 0.
        CALL FUNCTION 'JOB_CLOSE'
      ENDIF.
    ENDIF.
    SELECT  rqident rqcretime FROM tsp01
    INTO (rqident,rqcretime)
    WHERE rqowner = sy-uname
    ORDER BY rqcretime DESCENDING.
      EXIT.
    ENDSELECT.
    IF rqident IS NOT INITIAL.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
    DATA l_line TYPE docs-lines.
      LOOP AT l_tline.
        CLEAR l_line.
        MOVE l_tline-tdline TO l_line.
        l_docs-lines = l_line.
        APPEND l_docs.
      ENDLOOP.
    ENDIF.

    Hi,
    Each submit will create only one spool. So I dont think this is possible. Yes what you can do though is that submit the program for all the IDocs at once ( provided your program YFAPINV can handle this) and then process the spool and separate the output for each IDoc after you retrieve the data from spool.
    To retrieve the data from the spool, you can use the function 'RSPO_RETURN_ABAP_SPOOLJOB' pass the spool request number and it will return you a internal table with the spool data.
    regards,
    Advait

  • SUBMIT statement doesnt work

    hi
    I want to execute program RIMODGEN ( CFM1 transaction ) with some values filled in MA_MATNR
    But this program is not able to execute the program with SUBMIT statement and return & close the job, please tell me whats the problem with this....
    Points for all helpful answers
    * Job open
      call function 'JOB_OPEN'
           exporting
                delanfrep        = ' '
                jobgroup         = ' '
                jobname          = jobname
                sdlstrtdt        = sy-datum
                sdlstrttm        = sy-uzeit
           importing
                jobcount         = jobcount
           exceptions
                cant_create_job  = 01
                invalid_job_data = 02
                jobname_missing  = 03.
      if sy-subrc ne 0.
                                           "error processing
      endif.
    * Insert process into job
    * CALL TRANSACTION
    SUBMIT cfm1  with MA_MATNR in MA_MATNR
                      WITH I_MODID  = 'TEST_RAJ'
                      WITH I_LOGSYS = 'D41030'
                      with I_APPL   = 'TEST_RAJ'
                      user sy-uname
                      via job jobname
                      number jobcount
                      and RETURN.
      if sy-subrc > 0.
          message e200(zz) with 'RIMODGEN call failed'. "error processing
      endif.
    * Close job
      starttime-sdlstrtdt = sy-datum + 1.
      starttime-sdlstrttm = '220000'.
      call function 'JOB_CLOSE'
           exporting
                event_id             = starttime-eventid
                event_param          = starttime-eventparm
                event_periodic       = starttime-periodic
                jobcount             = jobcount
                jobname              = jobname
                laststrtdt           = starttime-laststrtdt
                laststrttm           = starttime-laststrttm
                prddays              = 1
                prdhours             = 0
                prdmins              = 0
                prdmonths            = 0
                prdweeks             = 0
                sdlstrtdt            = starttime-sdlstrtdt
                sdlstrttm            = starttime-sdlstrttm
                strtimmed            = starttimeimmediate
                targetsystem         = host
           exceptions
                cant_start_immediate = 01
                invalid_startdate    = 02
                jobname_missing      = 03
                job_close_failed     = 04
                job_nosteps          = 05
                job_notex            = 06
                lock_failed          = 07
                others               = 99.
      if sy-subrc eq 0.
         MESSAGE i200(zz) with 'Done !!'.    "error processing
         stop.
      endif.

    Rob and I were pointing out that you have the transaction name in the SUBMIT statement in your code that you posted above, so if you are not currently using the program name in your program, make sure that you are.  Also, you may want to use the extension  "     to sap-spool without spool dynpro"  of the SUBMIT statement, the ouput will then go to the spool.  Here is an example program where I am creating a background job .
    report zrich_0004 .
    data:   sdate type sy-datum,
            stime type sy-uzeit,
            l_valid,
            ls_params like pri_params,
            l_jobcount like tbtcjob-jobcount,
            l_jobname  like tbtcjob-jobname.
    start-of-selection.
    * Get Print Parameters
      call function 'GET_PRINT_PARAMETERS'
           exporting
                no_dialog      = 'X'
           importing
                valid          = l_valid
                out_parameters = ls_params.
    * Open Job
      l_jobname = 'ZRICH_0005'.
      call function 'JOB_OPEN'
           exporting
                jobname  = l_jobname
           importing
                jobcount = l_jobcount.
    * Submit report to job
      submit zrich_0005
           via job     l_jobname
               number  l_jobcount
           to sap-spool without spool dynpro
               spool parameters ls_params
                  and return.
    * Kick job off 30 seconds from now.
      sdate = sy-datum.
      stime = sy-uzeit + 30.
    * Schedule and close job.
      call function 'JOB_CLOSE'
           exporting
                jobcount  = l_jobcount
                jobname   = l_jobname
                sdlstrtdt = sdate
                sdlstrttm = stime
    *            strtimmed = 'X'
    Regards,
    Rich Heilman         .

  • How to export to memory using submit statement?

    hi friends,
    There is a standard report RPTQTA10.
    After executing this report using submit statement i want get the result from the QTTRANS itable of RPTQTA10 to our local itab of BSP.
    After this from local itab of BSP i want display some fields of local itba.
    Any solutions plz....
    Regards,
    shankar.

    hi,
    thanks for ur reply.
    but i am getting error like this in IE.
    Note
    The following error text was processed in the system IT3 : Exception condition "CNTL_ERROR" raised.
    The error occurred on the application server itcsvr_IT3_01 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Form: CONSTRUCTOR of program CL_GUI_CUSTOM_CONTAINER=======CP
    Form: PBO of program SAPLSLVC_FULLSCREEN
    Module: PBO of program SAPLSLVC_FULLSCREEN
    Function: REUSE_ALV_GRID_DISPLAY of program SAPLSLVC_FULLSCREEN
    Form: DISPLAY_LIST of program RPTQTA10
    END-OF-SELECTION of program RPTQTA10
    And my BSP code is like this in OnInitialization event.
    SUBMIT rptqta10
             WITH PNPPERNR-LOW = w_pernr
             EXPORTING LIST TO MEMORY AND RETURN.
    data: field(25).
    field-symbols: <fs_tab> type STANDARD table.
    field = '(RPTQTA10)QTTRANS[]'.
    assign (field) to <fs_tab>.
    MOVE <FS_TAB>[] TO it_qttrans[].
    Here it_qttrans is local itab of BSP.
    Regards,
    Shankar.

  • How to skip the alv list when submit a report by SUBMIT statement?

    Dear Experts,
    I  have  to submit a report(RMVKON00) for a special request in my  add-on program,  I use the following statment:
    SUBMIT RMVKON00
    AND RETURN EXPORTING LIST TO MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        LISTOBJECT = ABAPLIST_TAB
      EXCEPTIONS
        NOT_FOUND  = 1
        OTHERS     = 2.
    CALL FUNCTION 'LIST_TO_ASCI'
    * EXPORTING
    *   LIST_INDEX               = -1
    *   WITH_LINE_BREAK          = ' '
      TABLES
        LISTASCI                 = LISTASCI_TAB[]
       LISTOBJECT                = ABAPLIST_TAB
    EXCEPTIONS
       EMPTY_LIST               = 1
       LIST_INDEX_INVALID       = 2
       OTHERS                   = 3
    But  it still display the alv list , and I must click  button 'BACK' ,then it return my add on program.
    I hope to skip the alv list  (does not display the alv list ) .
    Would you like to help me?
    Thanks and Best Regards,
    Colin.
    Edited by: Colin on Jan 8, 2010 10:09 AM

    Hi Colin,
    I dont think you would be able to skip the ALV output using SUBMIT. However try changing the value of sy-lsind after the submit statement.
    SUBMIT RMVKON00
    AND RETURN EXPORTING LIST TO MEMORY.
    sy-lsind = sy-lsind - 1.
    If that doesnt work then try using JOB_START JOB_SUBMIT, JOB_CLOSE...
    Thanks,
    Best regards,
    Prashant

  • Reg:Submit statement Return Internal Table

    Hi Team,
    I have a query to return the internal table from the called program via SUBMIT statement to the calling statement ??
    Example : Thing is that consider reports A and B , Report B is getting called from report A where in B we have one internal table full of data that i need to pull to report A and there i need to process it.
    How can i achieve this?
    Please let me know the possible ways.
    Karthik.S

    Hi karthik,
    SUBMIT .... AND RETURN EXPORTING LIST TO MEMORY.
    Then use FM LIST_FROM_MEMORY.
    Thanks,
    Anil

Maybe you are looking for

  • Opening raw NEF in Photoshop CS4

    I need to edit a bunch of photos in Photoshop. So I got the files from the photographer and they're raw NEF files that won't open in Photoshop CS4. I download Adobe Camera Raw plugin and added it but still won't open them.. Any ideas??

  • "Open With"  CS3 not working for JPEG file

    Operating system is XP. I am trying to get CS3 to automatically open all JPEG files when I double click on them in windows explorer. I open windows explorer, right click on the image that I want to open, then click "open with" .... ...at this point C

  • Making a tab default in tabstrip

    Hi,I have an urgent requirement. In a tabstrip of five tabs, how to make 3rd tab default. I mean to say,if i am executing a program having such tabstrip then selection screen should open with fields defined in subscreen of third tab.

  • JUnit3.8.1 Fails Installation Test?

    Can I get JUnit help here or is there a better place to go? The installation test failes with the following: D:\Program Files>java junit.textui.TestRunner junit.samples.AllTests Class not found "junit.samples.AllTests"This class currently is located

  • My GPIB will not control my device.

    I am trying to control a MMR K20 Temperature Controller with my PCI-GPIB+ card, but it keeps giving me an Error-Need Command in the NI-488.2 Communicator, and IBERR=EABO. I have changed the time but I still get this error. But the communicator does w