Update table form local file as background Job

Hi Expert,
     I have a requirement to update a database table through Text file in a background. I am trying to do through OPEN Database to upload the file to Application server and then triggerind a event for background job. please provide method to update the table in background job.
Regards,
Kapil.

hi,
if i have understood you can try this:
1) create a custom event with transaction SM62.
2) schedule the update job ( with the update program in its step )  trigging the event set in (1) .
3) execute the program that upload the local file from presentation server to application server  .  The last istruction of this program has to be the call ot the custom event using BP_event raise fn module in the uplaoad is ok..
4) if the event has been raised, the background job has been executed.
Regards, luigi.

Similar Messages

  • Submitting a updates in a prog to a background job

    Hello everyone,
    I am generating a alv report with production orders.In the toolbar i created a button for updating data.When i select some production orders in the alv list and select the button then transaction co02 is called and some updates are done.I done that the updating by using bdc recording and the updates are working fine.
    But my problem is
    1. when the user selects the updates button in the toolbar these updates should take place via. a background job.
    2. Before submitting the background job the program needs to check if a version of a prog is running,the check should look for the prog name and the triggering user, if a match is found the user should receive a error message.
    3. If a match is not found then the background job should be scheduled immediately and should be created with a name of prog name and the triggering user.
    I need to these steps,can anyone please give me a sample code for this.
    Thank you.
    dp.

    The approach I would probably take for this would be:
    1. Write the records that need processing to a "Z" table from the ALV, and delete these back out (or mark as "done") once processed by the batch job.
    2. It is possible to check for a batch job name and its status, but I've usually found an easier and more reliable way is to use a lock object to check this e.g. you could use and existing object such as ESRDIRE with a dummy lock argument such as 'CO02_IS_LOCKED' .  The batch job should contain code to set the enqueue... if this enqueue fails it means another job / program is already processing the requests so this instance can stop, otherwise the batch program can continue the CO02 processing.  In other words, you are creating a doorway through which only one instance of the job can pass at a time.
    3. A couple of easy ways to do this are (a) event triggered jobs, wherein you define the job and have it fire up when an event is raised (e.g. by calling function BP_EVENT_RAISE) or (b) use the SIMPLE_BATCH_JOB_SUBMIT (which calls the JOB_OPEN, JOB_SUBMIT, JOB_CLOSE functions for you).
    Jonathan

  • Submitting a update in a porg to a background job?

    Hello everyone,
    I am generating a alv report with production orders.In the toolbar i created a button for updating data.When i select some production orders in the alv list and select the button then transaction co02 is called and some updates are done.I done that the updating by using bdc recording and the updates are working fine.
    But my problem is
    1. when the user selects the updates button in the toolbar these updates should take place via. a background job.
    2. Before submitting the background job the program needs to check if a version of a prog is running,the check should look for the prog name and the triggering user, if a match is found the user should receive a error message.
    3. If a match is not found then the background job should be scheduled immediately and should be created with a name of prog name and the triggering user.
    I need to these steps,can anyone please give me a sample code for this.
    Thank you.
    dp.

    The approach I would probably take for this would be:
    1. Write the records that need processing to a "Z" table from the ALV, and delete these back out (or mark as "done") once processed by the batch job.
    2. It is possible to check for a batch job name and its status, but I've usually found an easier and more reliable way is to use a lock object to check this e.g. you could use and existing object such as ESRDIRE with a dummy lock argument such as 'CO02_IS_LOCKED' .  The batch job should contain code to set the enqueue... if this enqueue fails it means another job / program is already processing the requests so this instance can stop, otherwise the batch program can continue the CO02 processing.  In other words, you are creating a doorway through which only one instance of the job can pass at a time.
    3. A couple of easy ways to do this are (a) event triggered jobs, wherein you define the job and have it fire up when an event is raised (e.g. by calling function BP_EVENT_RAISE) or (b) use the SIMPLE_BATCH_JOB_SUBMIT (which calls the JOB_OPEN, JOB_SUBMIT, JOB_CLOSE functions for you).
    Jonathan

  • Ctrl-c in bash kill openbox started from rc file as background job

    Hi,
    Ctrl-c in bash kill openbox started from rc file as background job.
    strange, isn't it ?

    I want to have openbox in the job list of a bash. as if my xinitrc was "exec xterm" and I manualy enter the "openbox &" commande in the xterm window. I suppose this is a common wish : telling bash to read from file then from keyboard, but that not exactly what bashrc do.
    "ps j" for openbox started in bashrc
    PPID   PID     PGID  SID   TTY       TPGID STAT UID    TIME COMMAND
    1769  1773  1773   845 pts/0     1752 S     1000   0:00 xterm -e bash  --rcfile ~/bin/xsession.sh
           1  1780  1773   845 pts/0     1752 S     1000   0:00 /usr/bin/dbus-launch --sh-syntax --exit-with-session
    1773  1783  1783  1783 pts/2     1805 Ss    1000   0:00 bash --rcfile ~/bin/xsession.sh
    1783  1795  1783  1783 pts/2     1805 S     1000   0:00 /usr/bin/openbox --startup /usr/lib/openbox/openbox-autostart OPENBOX
    1783  1805  1805  1783 pts/2     1805 R+    1000   0:00 ps j
    "ps j" for openbox started by keyboard or PROMPT_COMMAND
    1718  1722  1722   845 pts/0     1701 S     1000   0:00 xterm -title Login -e bash  --rcfile ~/bin/xsession.sh
           1  1729  1722   845 pts/0     1701 S     1000   0:00 /usr/bin/dbus-launch --sh-syntax --exit-with-session
    1722  1732  1732  1732 pts/2     1747 Ss    1000   0:00 bash --rcfile ~/bin/xsession.sh
    1732  1744  1744  1732 pts/2     1747 S     1000   0:00 openbox
    1732  1747  1747  1732 pts/2     1747 R+    1000   0:00 ps j
    ps have PGID equal to the bash TPGID, so it is foreground. openbox from PROMPT_COMMAND have his own PGID, so it is background. openbox from bashrc share PGID wish bash ... so if bash do not consume Ctrl-c signal openbox receive it ? I assume it is some things like this, but why ? INVOCATION and JOB CONTROL sections in bash manpage do not seems describe this, so that's a strange behaviour.

  • Is it possible to save a report to a file in background job?

    Hi,
    I want to save a report as a file every day, is it possible to do it by background job?
    Thanks.

    thanks all of you,
    I don't went to save the file manually.
    I only want to a function just like archiving function which can save file in background job.
    I can develop a program to save a report as file in background job,but I have to develop a program for every report,I want to know is there any standard function for it, just like throwing  the report to spool.

  • Read local file in background

    hi everyone,
    i need to read local file in background,
    wich function do i need to use?
    thanks,
    dana.

    if you are reading in background file needs to be on application server.
    you can use following function modules.
    CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
    OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE
                          MESSAGE MSG_TXT.
    IF SY-SUBRC NE 0.
      WRITE: 'Err', MSG_TXT.
      EXIT.
    ENDIF.
    LOOP AT INT_TAB
    *your code
    ENDLOOP.
    Closing the File
    CLOSE DATASET FILENAME.

  • Local file in background mode

    Hi experts,
    Is it possible to upload data from local drive(presentation server) to sap in background mode.
    As I know ,in the background mode we can upload files from application server only.
    but here my functional consultant saying they did  upload data from local drive to sap in background mode.
    please suggest.
    thanks in advance.
    sastry.

    hey,
    Yes it can be made possible,
    The only way to access files in a background job is to have them on the application server and opened via OPEN DATASET or similar.
    *--Local Variables
    DATA : l_file TYPE string,
    l_line TYPE string,
    l_index TYPE sy-tabix.
    *--Clear
    CLEAR : l_file.
    l_file = p_ipfile.
    *--Read the data from application server file.
    OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc NE 0.
    *--Error in opening file
    MESSAGE i368(00) WITH text-005.
    ENDIF.
    *--Get all the records from the specified location.
    DO.
    READ DATASET l_file INTO l_line.
    IF sy-subrc NE 0.
    EXIT.
    ELSE.
    SPLIT l_line AT cl_abap_char_utilities=>horizontal_tab
    INTO st_ipfile-vbeln
    st_ipfile-posnr
    st_ipfile-edatu
    st_ipfile-wmeng.
    APPEND st_ipfile TO it_ipfile.
    ENDIF.
    ENDDO.
    Regards,
    Midhun Abraham
    Edited by: Midhun Abraham on Oct 8, 2008 4:36 AM

  • Export of report/query to a file for background job runs

    I have a requirement to automate the export of a report or query to a file  so when a background job runs a  new file is generated to the drive. 
    This cannot be a customized solution for 1 report, it must be able to adapt to other reports or queries as well.
    Any help will be highly appreciated.
    Thank you,
    Thamina

    Hi,
    SAP have created a standard program RSTXPDFT4 to convert your Sapscripts spools into a PDF format.
    Specify the spool number and you will be able to download the sapscripts spool into your local harddisk.
    It look exactly like what you see during a spool display.
    Please note that it is not restricted to sapsciprts spool only.  Any reports in the spool can be converted using the program 'RSTXPDFT4'.
    Regards,
    Pavan

  • Error while opening the file in Background job in Virsa.

    We are using Virsa 5.2
    I click on the result tab to view the job results.(informer->Background job) I am getting this message.
    Mar 3, 2008 1:49:15 PM com.virsa.cc.comp.GenericRAReportView wdDoModifyView
    WARNING: .\virsa\bgJobSpool\16.i (The system cannot find the file specified)java.io.FileNotFoundException: .\virsa\bgJobSpool\16.i (The system cannot find the file specified)
    Can you please let me know?
    Nothing has been changed including my user profile.
    From,
    PT.

    Hi,
    Here are number of notes that I have listed out to sort some issues on SAP GRC 5.2 .
    There is a note for background daemon issue as well
    Installation
    Note 1009509 - VIRSANH 5.2 Support Packages for BASIS 700
    Note 1022187 - Compliance Calibrator 5.2 Support Pack
    Post Installation
    Note 1022187 - Compliance Calibrator 5.2 Support Pack
    Note 1008500 - VIRSA 4.0 Support Packages for Basis 700
    Note 1060673 - Configuration of SAP Adapter in CC 5.2
    Note 709140 - Recommended JDK and VM Settings for the WebAS630/640/7.0
    Note 1044173 - Recomended Netweaver Setting for Access Control 5.x
    Note 1044174 - Recommendation for CC 5.x running on Oracle 10G Database
    Note 1121978 - Recommended settings to improve peformance in CC 5x analysis
    Note 978536 - Language Configuration for Virsa Compliance Calibrator 5.2
    Issues
    Note 1008500 - VIRSA 4.0 Support Packages for Basis 700
    Note 999785 - CC Background Daemon will not Start
    Note 987386 - Graphics Rendering Issue in SAP Compliance Calibrator
    Note 1009267 - System ID is not available in drop down menu-CC5.1
    Note 1052455 - Error-No relevant language message available in database
    Note 1062037 - java.lang.NullPointerException error in Adapter activation
    Note 1088378 - CC 5.2 - Undeployment of ccappcomp from SDM fails
    Thanks,
    Uday

  • Download content of internal table to local file

    Hello SDN
    I have got a BSP application using pages with flow logic. What I want to do is downloading the content of an internal table to a local file, when a user triggers a certain event. In the event-handler "OnInputProcessing" I tried to use "CALL METHOD cl_gui_frontend_services=>gui_download" but this causes an error in the browser.
    Can anybody help me?
    Regards
    Markus
    Message was edited by: Markus Tschiderer

    hello markus,
    cl_gui_frontend_services can only be used in sapgui-applications.
    what you could do is to create a bsp-page that doesn't generate html, but only a list of data, separated by tabs and line-breaks. on the top of the bsp, you would have to set the mime-type to text/plain, so the browser will offer so save the file or open it in notepad.
    regards,
    norbert

  • Download ALV result list as excel-file in background job

    Dear Experts,
    I am looking for a possibily to download the result of an ALV based report as excel-file in a background job. Surely there is a standard function which can be used or at least some hints how to implement this. I searched the forum but couldn't find a thread which was covering this problem exactly.
    Thanks in advance
    Benjamin

    Dear Mr. Krapf,
    it is possible to output an ALV list to an Excel file in the background but there are some limitations.
    Please consider the following notes:
    #7925  Graphics, Upload, Download do not work in backgrnd
    #65050 Data types and file formats in files (DATASET) 
    #145073 - FAQ Report Writer: Excel download 
    #569537 - Incorrect data during import into Excel
    #590126  Sending CSV documents up to Release 4.6
    Please be aware that they are all Basis notes. So for more information you might ask in the Basis SDN Forum.
    Best regards, Christin Angus

  • Merge Excel cells when creating file for Background job

    Hi Experts
    I need to create an Excel document and within the excel sheet merge some cells, I can get that done via OLE.
    My problem though comes in with... the Report needs to be scheduled as a background job and therefore OLE does not work!!!
    Does any of you have another solution to merge cells while running in background??
    Your thoughts are greatly appreciated.
    Vic

    Hi Vic,
    You can use the xml transformations for formatting excel. For my case I needed multiple sheets including glossary sheet to be mailed in a particular format , which was achieved by using transformations.
           CALL TRANSFORMATION z_xls_xxx
                SOURCE table = i_tmp_b[]
                RESULT XML wa_xmlstr.
            TRY.
                cl_bcs_convert=>string_to_solix(
                   EXPORTING
                     iv_string   = wa_xmlstr
                   iv_codepage = '4103'  "suitable for MS Excel, leave empty
                     iv_add_bom  = 'X'     "for other doc types
                   IMPORTING
                     et_solix  = l_bin
                     ev_size   = l_size ).
              CATCH cx_bcs.
                MESSAGE e445(so).
            ENDTRY.

  • Exporting Local File in background

    Hi,
      I want to export a flat file in background mode. I am currently using WS_DOWNLOAD but this doesn't work in background. What I think is that I will save it in UNIX directory. Can you please give some sample codes for this? or if there's still a way using WS_DOWNLOAD to do this in background?
    I appreciate your response.
    Thanks!

    Use the transaction CG3Z to upload your file into application server.
    Then you can use
    open dataset.
    transfer dataset.
    close dataset.
    commands to access that file from application server.

  • Extract table form pdf file

    Is is possible by code to extract table from pdf file to reuse it for other purpose. If yes please let me know the code. thanks

    No, because there is no such thing as a "table" in a PDF.  That may be how you as the viewer interprets the data, but in the PDF specification there is nothing defining a "table".  You would need to design your own logic to determine what parts of the PDF content you want to consider a "table" and then based on that, extract the data you want.

  • How to convert spool object to XLS file in background job? (please..urgent)

    Hello all.
    My requirment is to convert a spool object to an XLS file in the background (and send it via mail).
    Is it possible?
    If so, please help!
    please attach a code sample if you have one...
    Thanks allot.
    Barak.

    hi ,
    this might healp you ought
    TABLES: TBTCP, T024D.
    *PARAMETERS TEST(5).
    DATA: TJOBNAME LIKE TBTCP-JOBNAME VALUE 'REJ_COMP_MAIL_TO_MRP',
          SPOOLID LIKE TSP01-RQIDENT,
         V_LGORT LIKE MSEG-LGORT,
          V_DISPO LIKE T024D-DISPO,
          V_REPORT TYPE RSVAR-REPORT,
          V_VARIANT TYPE RSVAR-VARIANT.
    DATA: BEGIN OF VVALUES OCCURS 0.
            INCLUDE STRUCTURE RSPARAMS.
    DATA END OF VVALUES.
    DATA : BEGIN OF T_RECEIVERS OCCURS 0.
            INCLUDE STRUCTURE SOMLRECI1.
    DATA END OF T_RECEIVERS.
    DATA: BEGIN OF T_TBTCP,
         jobname like tbtcp-jobname,
         jobcount like tbtcp-jobcount,
          LISTIDENT LIKE TBTCP-LISTIDENT,
          SDLDATE LIKE TBTCP-SDLDATE,
          SDLTIME LIKE TBTCP-SDLTIME,
          VARIANT LIKE TBTCP-VARIANT,
          END OF T_TBTCP,
          ITAB_SPOOL LIKE STANDARD TABLE OF T_TBTCP,
          WA_SPOOL LIKE T_TBTCP.
    DATA: PLIST LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
    DATA: DOCUMENT_DATA LIKE SODOCCHGI1.
    DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    DATA: SO_ALI LIKE SOLI OCCURS 100 WITH HEADER LINE,
          REAL_TYPE LIKE SOODK-OBJTP,
          SP_LANG LIKE TST01-DLANG, LINE_SIZE TYPE I VALUE 255,
          V_NAME LIKE SOEXTRECI1-RECEIVER.
    DATA: GD_EVENTID LIKE TBTCM-EVENTID,
          GD_EVENTPARM LIKE TBTCM-EVENTPARM,
          GD_EXTERNAL_PROGRAM_ACTIVE LIKE TBTCM-XPGACTIVE,
          GD_JOBCOUNT LIKE TBTCM-JOBCOUNT,
          GD_JOBNAME LIKE TBTCM-JOBNAME,
          GD_STEPCOUNT LIKE TBTCM-STEPCOUNT,
          GD_ERROR    TYPE SY-SUBRC,
          GD_RECIEVER TYPE SY-SUBRC.
    START-OF-SELECTION.
      PERFORM GET_SPOOL_REQNUMBER USING TJOBNAME. " CHANGING SPOOLID.
      PERFORM SEND_MAIL.
    PERFORM REMOVE_BLANK_SPOOLS.
    *&      Form  GET_SPOOL_REQNUMBER
          text
         -->P_0111   text                                                *
         <--P_UU  text                                                   *
    FORM GET_SPOOL_REQNUMBER USING P_0111.
      SELECT ALISTIDENT BSTRTDATE BSTRTTIME AVARIANT
       FROM TBTCP AS A INNER JOIN TBTCO AS B
            ON AJOBNAME EQ BJOBNAME AND
               AJOBCOUNT EQ BJOBCOUNT AND
               ASTEPCOUNT EQ BSTEPCOUNT
       INTO TABLE ITAB_SPOOL
          WHERE AJOBNAME = P_0111 AND BSTRTDATE EQ SY-DATUM.
    ENDFORM.                    " GET_SPOOL_REQNUMBER
    *&      Form  send_mail
          text
    -->  p1        text
    <--  p2        text
    FORM SEND_MAIL .
    Get the spool data.
      LOOP AT ITAB_SPOOL INTO WA_SPOOL.
        REFRESH : SO_ALI, PLIST, T_RECEIVERS.
        CLEAR : SO_ALI, PLIST, V_NAME, DOCUMENT_DATA, T_RECEIVERS, SPOOLID,
                V_REPORT, V_VARIANT, V_DISPO.
        IF WA_SPOOL-LISTIDENT <> '0'.
          MOVE WA_SPOOL-LISTIDENT TO SPOOLID.
          CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
            EXPORTING
              RQIDENT              = SPOOLID
              FIRST_LINE           = 1
              LAST_LINE            = 0
              DESIRED_TYPE         = ' '
            IMPORTING
              REAL_TYPE            = REAL_TYPE
              SP_LANG              = SP_LANG
            TABLES
              BUFFER               = SO_ALI
            EXCEPTIONS
              NO_SUCH_JOB          = 1
              JOB_CONTAINS_NO_DATA = 2
              SELECTION_EMPTY      = 3
              NO_PERMISSION        = 4
              CAN_NOT_ACCESS       = 5
              READ_ERROR           = 6
              TYPE_NO_MATCH        = 7
              OTHERS               = 8.
    Check the return code.
          IF SY-SUBRC <> 0.
            MESSAGE S208(00) WITH 'Error'.
            LEAVE LIST-PROCESSING.
          ENDIF.
    DATA : DATE LIKE SY-DATUM,
           DATE1(10) TYPE C.
    Prepare the data.
    CLEAR OBJTXT.
    REFRESH OBJTXT.
    DATE = SY-DATUM - 1.
    CONCATENATE DATE6(2) '-' DATE4(2) '-' DATE+0(4) INTO DATE1.
    CONCATENATE 'PLEASE CHECK THE LIST OF REJECTED MATERIALS POSTED ON :' DATE1 INTO OBJTXT.
    APPEND OBJTXT.
    SELECT SINGLE DSNAM FROM T024D INTO T024D-DSNAM WHERE WERKS = '1000' AND DISPO = WA_SPOOL-VARIANT.
    CONCATENATE 'MRP CONTROLLER :' WA_SPOOL-VARIANT '-' T024D-DSNAM INTO OBJTXT.
    APPEND OBJTXT.
    OBJTXT = ''.
    APPEND OBJTXT.
    CLEAR PLIST.
    REFRESH PLIST.
    PLIST-TRANSF_BIN = SPACE.
    PLIST-HEAD_START = 1.
    PLIST-HEAD_NUM = 0.
    PLIST-BODY_START = 1.
    DESCRIBE TABLE OBJTXT LINES PLIST-BODY_NUM.
    PLIST-DOC_TYPE = 'RAW'.
    APPEND PLIST.
    CLEAR PLIST.
         PLIST-TRANSF_BIN = 'X'.
         PLIST-HEAD_START = 0.
         PLIST-HEAD_NUM = 0.
         PLIST-BODY_START = 0.
         PLIST-BODY_NUM = 0.
         PLIST-DOC_TYPE = 'RAW'.
          PLIST-OBJ_DESCR = WA_SPOOL-VARIANT.
         APPEND PLIST.
          PLIST-TRANSF_BIN = 'X'.
          PLIST-HEAD_START = 0.
          PLIST-HEAD_NUM = 0.
          PLIST-BODY_START = 1.
          DESCRIBE TABLE SO_ALI LINES PLIST-BODY_NUM.
          PLIST-DOC_TYPE = REAL_TYPE.
    Get the size.
          READ TABLE SO_ALI INDEX PLIST-BODY_NUM.
          PLIST-DOC_SIZE = ( PLIST-BODY_NUM - 1 ) * LINE_SIZE + STRLEN( SO_ALI ).
          APPEND PLIST.
    ***get the values of the variant
          MOVE : WA_SPOOL-VARIANT TO V_VARIANT.
          SELECT * FROM TBTCP WHERE JOBNAME EQ TJOBNAME ORDER BY SDLDATE.
            MOVE TBTCP-PROGNAME TO V_REPORT.
          ENDSELECT.
          CALL FUNCTION 'RS_VARIANT_VALUES_TECH_DATA'
            EXPORTING
              REPORT                     = V_REPORT
              VARIANT                    = V_VARIANT
            SEL_TEXT                   = ' '
            MOVE_OR_WRITE              = 'W'
            SORTED                     = ' '
            EXECUTE_DIRECT             =
          IMPORTING
            TECHN_DATA                 =
            TABLES
              VARIANT_VALUES             = VVALUES
           EXCEPTIONS
             VARIANT_NON_EXISTENT       = 1
             VARIANT_OBSOLETE           = 2
             OTHERS                     = 3.
          LOOP AT VVALUES.
            CASE VVALUES-SELNAME.
              WHEN 'S_DISPO'.
               MOVE VVALUES-LOW TO V_LGORT.
                MOVE VVALUES-LOW TO V_DISPO.
            ENDCASE.
          ENDLOOP.
          SELECT SINGLE USRKEY FROM T024D INTO T024D-USRKEY WHERE WERKS EQ '1000' AND DISPO EQ V_DISPO.
          IF SY-SUBRC EQ 0.
            T_RECEIVERS-RECEIVER = T024D-USRKEY.
            T_RECEIVERS-REC_TYPE = 'U'.
            APPEND T_RECEIVERS.
          IF V_DISPO = '3'   OR V_DISPO = '5'   OR
             V_DISPO = '21'  OR V_DISPO = '48'  OR
             V_DISPO = '51'  OR V_DISPO = '231' OR
             V_DISPO = '512' OR V_DISPO = '921'.
            T_RECEIVERS-RECEIVER = 
            T_RECEIVERS-REC_TYPE = 'U'.
            T_RECEIVERS-COPY = 'X'.
            APPEND T_RECEIVERS.
          ENDIF.
          IF V_DISPO = '14'  OR V_DISPO = '86'  OR
             V_DISPO = '515' OR V_DISPO = '704' OR
             V_DISPO = '711' OR V_DISPO = '712' OR
             V_DISPO = '713'.
            T_RECEIVERS-RECEIVER =
            T_RECEIVERS-REC_TYPE = 'U'.
            T_RECEIVERS-COPY = 'X'.
            APPEND T_RECEIVERS.
          ENDIF.
           T_RECEIVERS-RECEIVER = *        T_RECEIVERS-REC_TYPE = 'U'.
           T_RECEIVERS-COPY = 'X'.
           APPEND T_RECEIVERS.
           T_RECEIVERS-RECEIVER = *        T_RECEIVERS-REC_TYPE = 'U'.
           T_RECEIVERS-BLIND_COPY = 'X'.
           APPEND T_RECEIVERS.
          ENDIF.
          IF NOT SP_LANG IS INITIAL.
            DOCUMENT_DATA-OBJ_LANGU = SP_LANG.
          ELSE.
            DOCUMENT_DATA-OBJ_LANGU = SY-LANGU.
          ENDIF.
          V_NAME = SY-UNAME.
    Subject.
    CONCATENATE 'List of Rejected Materials, MRP Controller:' WA_SPOOL-VARIANT
                INTO DOCUMENT_DATA-OBJ_DESCR.
    Send the email.
          CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
            EXPORTING
              DOCUMENT_DATA              = DOCUMENT_DATA
              SENDER_ADDRESS             = V_NAME
              SENDER_ADDRESS_TYPE        = 'B'
            TABLES
              PACKING_LIST               = PLIST
              CONTENTS_BIN               = SO_ALI
              CONTENTS_TXT               = OBJTXT
              RECEIVERS                  = T_RECEIVERS
            EXCEPTIONS
              TOO_MANY_RECEIVERS         = 1
              DOCUMENT_NOT_SENT          = 2
              DOCUMENT_TYPE_NOT_EXIST    = 3
              OPERATION_NO_AUTHORIZATION = 4
              PARAMETER_ERROR            = 5
              X_ERROR                    = 6
              ENQUEUE_ERROR              = 7
              OTHERS                     = 8.
          IF SY-SUBRC <> 0.
            MESSAGE E208(00) WITH 'Error in sending email'.
          ENDIF.
          COMMIT WORK.
    Send the email immediately.
          SUBMIT RSCONN01
          WITH MODE = 'INT'
          AND RETURN.
          IF SY-SUBRC EQ 0.
            WRITE 'To get the spool no'.
            CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
              IMPORTING
                EVENTID                 = GD_EVENTID
                EVENTPARM               = GD_EVENTPARM
                EXTERNAL_PROGRAM_ACTIVE = GD_EXTERNAL_PROGRAM_ACTIVE
                JOBCOUNT                = GD_JOBCOUNT
                JOBNAME                 = GD_JOBNAME
                STEPCOUNT               = GD_STEPCOUNT
              EXCEPTIONS
                NO_RUNTIME_INFO         = 1
                OTHERS                  = 2.
            IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            ENDIF.
            WRITE : / 'Spool id of the job that is sent', SPOOLID,
                     GD_EVENTID,
                     GD_EVENTPARM,
                     GD_EXTERNAL_PROGRAM_ACTIVE,
                     GD_JOBCOUNT,
                     GD_JOBNAME,
                     GD_STEPCOUNT.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " send_mail
    *&      Form  remove_blank_spools
          text
    -->  p1        text
    <--  p2        text
    *FORM REMOVE_BLANK_SPOOLS .
    LOOP AT ITAB_SPOOL INTO WA_SPOOL.
       MOVE WA_SPOOL-LISTIDENT TO SPOOLID.
       CALL FUNCTION 'RSPO_ISELECT_TSP01'
         EXPORTING
           RFCSYSTEM        = SY-SYSID
           RQIDENT          = SPOOLID
      FORUPDATE        = ' '
        IMPORTING
          TSP01_ELEM       = W_INFO
        EXCEPTIONS
          ERROR            = 1
          OTHERS           = 2.
       CALL FUNCTION 'RSPO_IRETURN_RAW_DATA'
         EXPORTING
           RQ                 = W_INFO
         TABLES
          LINE_BUFFER        = W_DATA
       PAGE_INDEX         = W_PAGES
          LINE_BUFFER2       =
        EXCEPTIONS
          ERROR              = 1
          OTHERS             = 2.
       IF W_INFO-RQDOCTYPE = 'LIST'.
         CALL FUNCTION 'RSPO_R_GET_TOC_SPOOLREQ'
           EXPORTING
             RQIDENT = SPOOLID
           TABLES
             TOCDESC = W_TODESC
           EXCEPTIONS
             ERROR   = 1
             OTHERS  = 2.
         CALL FUNCTION 'RSPO_SPOOLDATA_WRITE_INIT'.
         READ TABLE W_DATA WITH KEY DATA_LINE = 'List contains no data'.
         LOOP AT W_DATA.
           IF W_DATA-DATA_LINE CP 'List contains no data'.
           ENDIF.
         ENDLOOP.
       ENDIF.
    ENDLOOP.
    *ENDFORM.                    " remove_blank_spools

Maybe you are looking for

  • Can i use my apple g4 cinema display as a television monitor?

    i have an old apple g4 display that i never use anymore. can i connect it to my cable box somehow?

  • Garritan Personal Orchestra with Logic?

    Is anyone here using the Garritan Personal Orchestra with Logic? How stable is this within Logic, any troubles? Also, how do the solo string instruments sound, realistic or synthy?

  • Problem with the adobe flash player, its falling down, what to do?

    Its always falling down almost immediately when i hear music. I have tried to update Adobe Flash player and so on. But it still not working, its strange but i have been thinking if Mozilla doesn't ''allow'' the adobe flash player. Do I need maybe cha

  • Blackberry Bridge failure

    Got a brand new UK PlayBook yesterday. I ran through the setup, installed Blackberry Bridge on the Bold 9700, paired and everything worked. This morning, the PlayBook resolutely refuses to connect to the 9700 ("Unable to connect BlackBerry Bridge wit

  • Linking Zip folders for download

    Hi, I want to make my albums available for download with all the MP3s in compressed zip folders... I am able to add individual MP3's for download or stream by linking the direct file, however when I compress multiple MP3s into one Zip folder the link