Running in background

In my report I am displaying some 30 fields in alv.When I run it in background and see the spool request only 5 fields are displaying.What may the problem?Plz help me...........

Hi,
You can refer to below sample program for sending multiple attachments in E-mail.
PARAMETERS: p_mail TYPE ad_smtpadr OBLIGATORY.
DATA: i_mara TYPE STANDARD TABLE OF mara,  " MARA Entries
      i_marc TYPE STANDARD TABLE OF marc.  " MARC Entries
DATA: l_text TYPE char255.  " Text
DATA: l_lines TYPE i,
      l_size            TYPE           sood-objlen.
" Size of Attachment
* Mail related
DATA: i_content         TYPE   soli_tab, " Mail content
      i_attach          TYPE   soli_tab, " Attachment
      i_attach1         TYPE   soli_tab. " Attachment
DATA: l_send_request    TYPE REF TO    cl_bcs,
                                            " E-Mail Send Request
      l_document        TYPE REF TO    cl_document_bcs,
                                            " E-Mail Attachment
      l_recipient       TYPE REF TO    if_recipient_bcs,
                                            " Distribution List
      l_sender          TYPE REF TO    if_sender_bcs,
                                            " Address of Sender
      l_uname           TYPE           salrtdrcpt,
                                            " Sender Name(SY-UNAME)
      l_bcs_exception   TYPE REF TO    cx_document_bcs,
                                            " BCS Exception
      l_addr_exception  TYPE REF TO    cx_address_bcs,
                                            " Address Exception
      l_send_exception  TYPE REF TO    cx_send_req_bcs.
" E-Mail sending Exception
*Constants------------------------------------------------------------*
CONSTANTS: c_tab(1) TYPE c VALUE
               cl_abap_char_utilities=>horizontal_tab,
                                     " Tab Character
           c_cr(1)  TYPE c VALUE cl_abap_char_utilities=>cr_lf,
                                     " Line Feed for End-Of_line
           c_ext    TYPE soodk-objtp VALUE 'XLS'. " XLS Extension
START-OF-SELECTION.
  SELECT * FROM mara INTO TABLE i_mara UP TO 20 ROWS.
  SELECT * FROM marc INTO TABLE i_marc UP TO 20 ROWS.
* Preparing body of the Mail
  MOVE 'Mail Body' TO l_text.
  APPEND l_text TO i_content.
* Creates persistent send request
  TRY.
      l_send_request = cl_bcs=>create_persistent( ).
* Creating Document
      l_document = cl_document_bcs=>create_document(
                                    i_type  = 'RAW'
                                    i_text  = i_content[]
                                    i_subject = 'Material Details' ).
* Preparing contents of attachment with Change Log
  PERFORM prepare_attachment.
  DESCRIBE TABLE i_mara LINES l_lines.
* Size to multiplied by 2 for UNICODE enabled systems
      l_size = l_lines * 2 * 255.
* Adding Attachment
      CALL METHOD l_document->add_attachment
        EXPORTING
          i_attachment_type    = c_ext
          i_attachment_size    = l_size
          i_attachment_subject = 'Material Details'
          i_att_content_text   = i_attach[].
  DESCRIBE TABLE i_marc LINES l_lines.
* Size to multiplied by 2 for UNICODE enabled systems
      l_size = l_lines * 2 * 255.
* Adding Attachment
      CALL METHOD l_document->add_attachment
        EXPORTING
          i_attachment_type    = c_ext
          i_attachment_size    = l_size
          i_attachment_subject = 'Material Plant Details'
          i_att_content_text   = i_attach1[].
* Add document to send request
      CALL METHOD l_send_request->set_document( l_document ).
* Get Sender Object
      l_uname = sy-uname.
      l_sender = cl_sapuser_bcs=>create( l_uname ).
      CALL METHOD l_send_request->set_sender
        EXPORTING
          i_sender = l_sender.
* E-Mail
      TRANSLATE p_mail TO LOWER CASE.
    l_recipient = cl_cam_address_bcs=>create_internet_address( p_mail )
      CALL METHOD l_send_request->add_recipient
        EXPORTING
          i_recipient  = l_recipient
          i_express    = 'U'
          i_copy       = ' '
          i_blind_copy = ' '
          i_no_forward = ' '.
*Trigger E-Mail immediately
      l_send_request->set_send_immediately( 'X' ).
      CALL METHOD l_send_request->send( ).
      COMMIT WORK.
    CATCH cx_document_bcs INTO l_bcs_exception.
    CATCH cx_send_req_bcs INTO l_send_exception.
    CATCH cx_address_bcs  INTO l_addr_exception.
  ENDTRY.
*&      Form  PREPARE_ATTACHMENT
FORM prepare_attachment.
  FIELD-SYMBOLS: <lfs_table>,    " Internal table structure
                 <lfs_con>.      " Field Content
  DATA: l_text TYPE char1024.     " Text content for mail attachment
  DATA: l_con(50) TYPE c.        " Field Content in character format
* Columns to be tab delimeted
  LOOP AT i_mara ASSIGNING <lfs_table>.
    DO.
      ASSIGN COMPONENT sy-index OF STRUCTURE <lfs_table>
             TO <lfs_con>.
      IF sy-subrc NE 0.
        CONCATENATE c_cr l_text INTO l_text.
        APPEND l_text TO i_attach.
        EXIT.
      ELSE.
        CLEAR: l_con.
        MOVE <lfs_con> TO l_con.
        CONDENSE l_con.
        IF sy-index = 1.
          CLEAR: l_text.
          MOVE l_con TO l_text.
        ELSE.
          CONCATENATE l_text l_con INTO l_text
             SEPARATED BY c_tab.
        ENDIF.
      ENDIF.
    ENDDO.
  ENDLOOP.
  LOOP AT i_marc ASSIGNING <lfs_table>.
    DO.
      ASSIGN COMPONENT sy-index OF STRUCTURE <lfs_table>
             TO <lfs_con>.
      IF sy-subrc NE 0.
        CONCATENATE c_cr l_text INTO l_text.
        APPEND l_text TO i_attach1.
        EXIT.
      ELSE.
        CLEAR: l_con.
        MOVE <lfs_con> TO l_con.
        CONDENSE l_con.
        IF sy-index = 1.
          CLEAR: l_text.
          MOVE l_con TO l_text.
        ELSE.
          CONCATENATE l_text l_con INTO l_text
             SEPARATED BY c_tab.
        ENDIF.
      ENDIF.
    ENDDO.
  ENDLOOP.
ENDFORM.                    " PREPARE_ATTACHMENT
Please treat above code just as reference...
Kind Regards
Balaji

Similar Messages

  • Report program when run in background job getting cancelled immediately

    Hi
    When i run a program in foreground i am able to see the output. But when run in background not able to run the job successfully. The job is getting cancelled immediately.
    I am using the below function module for output display. Should i need to pass any parameters in the below function module so that i can run the program in background  successfully.
      CALL METHOD DETAIL_GRID->SET_TABLE_FOR_FIRST_DISPLAY     
          EXPORTING                                            
            IS_LAYOUT         = IS_LAYOUT                    
            I_SAVE            = 'A'                        
            IS_VARIANT        = GS_VARIANT                   
          CHANGING                                           
            IT_FIELDCATALOG   = IT_FIELDCATALOG               
            IT_OUTTAB         = BLOCKED_STOCK_TAB_ALV[].     
    Please suggest.
    Thanks and regards
    Rajani Yeluri

    Hi Rajani.
      ALV require the DRYPOR(screen) for display but incase you run in back ground which have to write to spool but in spool we can only write in format of LIST REPORT not inter-active report like ALV. That why
    system cancelled your process immediately.
    Hope it helps.
    Sayan.

  • When MRP run through background process in MDBT open PR and PO not comming?

    Hi,
    When MRP run through backgroung process in MDBT open PR and PO not coming in MDBT result.
    Pls advise accordingaly.
    Regards
    rk

    Ram,
    Either I am totally misunderstanding your statements, or your business people are misinformed.  
    The output of MD01 (MRP total run in foreground) and the output of MDBT (MRP total Run in Background) ARE IDENTICAL, provided you have selected the same parameters.  
    Neither output contains a discrete listing of open Purchase orders and Purchase requisitions.
    Standard output of both MD01 and MDBT are:
    1.  List of materials processed, with exception messages
    2.  Statistics
    In addition, both of these programs also write MRP records to the MRP databases, provided that the "Display Material List" parameter is set.  In this case, both of these programs will produce data that can be further reviewed and managed in MD05 and MD06. MD06 is the tool that most planners use to process the MRP database info.
    If you wish to see a listing of the entire MRP results (either MD01 or MDBT), then execute transaction MDLD.  This will produce either a spoolfile or a printed document.
    For the PO or PR listings, review my earlier suggestions.
    Rgds,
    DB49

  • GUI_GET_DESKTOP_INFO is not worked when run in background

    Dear all,
    I want to retrieve the computer name using this function module. It is working fine in foreground but it returns no result when I run in background. Is there any other method to get the computer name in background? Thanks in advance.

    Problem solved using the following method:
      DATA: BEGIN OF usr_tabl OCCURS 10.
              INCLUDE STRUCTURE uinfo.
      DATA: END OF usr_tabl.
      DATA  th_opcode(1)                    TYPE x.
      data: size type i.
      CONSTANTS: opcode_list LIKE th_opcode VALUE 2.
      CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_list
        ID 'TAB' FIELD usr_tabl-sys.
      describe table usr_tabl lines size.
      read table usr_tabl index size.
      write usr_tabl-term.
    while usr_tabl-term is the computer name. It works in background as well.
    Edited by: Chiew Ngee Ho on Mar 12, 2009 9:36 AM

  • Error when OO ALV report run in background

    Hello all,
    We recently applied stack 12 for a 7.0 system.  My custom ALV report using CL_GUI_CUSTOM_CONTAINER coding now returns an error when run in Background.  It works fine in dialog.
    The error occurred in program CL_GUI_CUSTOM_CONTAINER=======CP.  The log message was "Control Framework: Fatal error - GUI cannot be reached".
    Is there a solution for OO ALV reports run in the background?  I would not like to re-write my ALV reports using the function call.  Any advice is appreciated.  Thanks!!

    Yes, you need to code it a little differently, but you can still use CL_GUI_ALV_GRID.  Here is an example. 
    REPORT ZRICH_0006 .
    DATA: ITAB TYPE TABLE OF MARA.
    DATA: R_GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA: R_CONTROL TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: G_DOCK TYPE REF TO CL_GUI_DOCKING_CONTAINER.
    DATA: OKCODE type sy-ucomm.
    START-OF-SELECTION.
      SELECT * FROM MARA INTO TABLE ITAB  up to 100 rows.
      CALL SCREEN 100.
    *& Module STATUS_0100 OUTPUT
    * text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS '0100'.
      SET TITLEBAR '0100'.
      IF R_CONTROL IS INITIAL.
    * Check whether the program is run in batch or foreground
        IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
    * Run in foreground
          CREATE OBJECT R_CONTROL EXPORTING CONTAINER_NAME = 'CONTAINER_1'.
          CREATE OBJECT R_GRID EXPORTING I_PARENT = R_CONTROL.
        ELSE.
    * Run in background
          CREATE OBJECT R_GRID EXPORTING I_PARENT = G_DOCK.
        ENDIF.
        CALL METHOD R_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
        I_STRUCTURE_NAME = 'MARA'
        CHANGING
        IT_OUTTAB = ITAB.
      ENDIF.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0100 INPUT
    * text
    MODULE USER_COMMAND_0100 INPUT.
      CASE OKCODE.
        WHEN 'BACK'.
          leave program.
      ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    Regards,
    Rich Heilman

  • How to download file to local system when report is run in background?

    Hello all,
    Can anybody tell me how can we donwload file into local machin when the program is running in background?
    thanks

    Hi,
    We can't communicate with presentation server while processing in background.
    if needed we can do this by creating RFC destination and doing some setting in Desktop system.
    [Reference document|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2]
    Regards,
    Amal

  • File generated when program run in background

    Hi,
    I have program that generates a report & all the data in the report output is down loaded to a file .please somebody make it clear:
    if I run the report in background will the file still be generated.
    thanks,
    reddy.

    Hi,
    If the program has logic to transfer the data to appliacation layer, then it works. Other wise it is not possible to download the data into your desktop by running in Background.
    Regards,
    Ashok

  • System is showing time out when run in background

    Dear all,
    We have two systems: One R/3 and EBP. We have made one report where the remote function module will be called from R/3 to EBP. There are 4 lakhs data in SAP. We are sending 10000 data as package in internal table and getting the corresponding output. But the system is showing time out when the report has run in background. Can you please suggest how the process can be improved so that the timeout can be avoided.
    Thanks and regards,
    Atanu

    Hi,
    Try to fetch records in smaller chunks and process them.  For example, if you are trying to fetch records for one year, instead of single query, try to fetch in 12 sets for each month.  Fetch first month and process the records and put them in the output internal table.  Then go for next month and so on.  Anyway your program is running in background.  There will not be any user complaint also.  The solution might sound bit funny.  But it works.
    Regards,
    Hema

  • RMMR1MRS-When run in background cause update failure errors looking

    hi,
          RMMR1MRS report when run in background cause update failure errors .
    There are few  below reason for the error log.
    1.  for the PO invoice already generated -  (its right if already invoice generated. should not happen again)
    2.  In  MIGO,  entire  quantity has been reversed  and also invoice generated with zero value - ( its right , should not happen invoice again )
    3. Particular PO line item deleted -  (its right if the PO line item deleted. ERS settlement not require)
    For the all above reason, the update error occurs.  But the mean time  the program  "RMMR1MRS"  should not through the update error log. 
    Note: The job was not terminated due to this update error and also no harm because of the error log
    can you please help on this update failure why it occurs.

    Have you found a solution already? If so, please, share it with the community and close this thread.

  • Amount field getting rounded up when run in background

    Hello All,
      when i run a report in foreground the amount value(KBETR) is displaying properly with the value 12.78.But when the same report is run in background it is displaying 13.what should be done?
    Thanks,
    Rakesh.

    Hi,
    Try to fetch records in smaller chunks and process them.  For example, if you are trying to fetch records for one year, instead of single query, try to fetch in 12 sets for each month.  Fetch first month and process the records and put them in the output internal table.  Then go for next month and so on.  Anyway your program is running in background.  There will not be any user complaint also.  The solution might sound bit funny.  But it works.
    Regards,
    Hema

  • Download Excel when program is run in background

    Hi all,
    I need help urgently in downloading my report into an excel file automatically when my report is has completed its run in background.
    Appreciate if help can be provided.
    Many thanks in advance.

    Check out the sample program of the provided link ..
    http://www.sap-img.com/abap/download-in-background-in-excel-format.htm

  • Getting the variant name when the report program is run in background

    Hi All,
    How to get the variant name for the report program when run in background? My requirement is to create an email attachement with the name 'variant.XLS', where variant = selection screen variant, when the report program is run in background. The system field SY-SLSET holds the variant name only when run online.
    Any pointers to this will be highly appreciated.
    Thanks and regards,
    Nilesh.

    Hello Nilesh,
    Please find the algo:
    1. Call the FM: GET_JOB_RUNTIME_INFO to get the background job details.
    2. Select data from TBTCP using these details:
    DATA:
    FP_EVENTID   TYPE BTCEVENTID
    FP_EVTPARM   TYPE BTCEVTPARM
    FP_ACTIVE    TYPE BTCXPGFLAG
    FP_JOBCNT    TYPE BTCJOBCNT
    FP_JOBNM     TYPE BTCJOB
    FP_STEPCNT   TYPE BTCSTEPCNT.
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
        IMPORTING
          EVENTID                 = FP_EVENTID
          EVENTPARM               = FP_EVTPARM
          EXTERNAL_PROGRAM_ACTIVE = FP_ACTIVE
          JOBCOUNT                = FP_JOBCNT
          JOBNAME                 = FP_JOBNM
          STEPCOUNT               = FP_STEPCNT
        EXCEPTIONS
          NO_RUNTIME_INFO         = 1
          OTHERS                  = 2.
      IF SY-SUBRC <> 0.
    *   Error calling FM: GET_JOB_RUNTIME_INFO
      ENDIF.
    DATA: FP_VARIANT TYPE BTCVARIANT.
      SELECT JOBNAME JOBCOUNT STEPCOUNT VARIANT
      FROM   TBTCP
      INTO TABLE L_IT_TBTCP
      WHERE  JOBNAME   = FP_JOBNM
      AND    JOBCOUNT  = FP_JOBCNT
      AND    STEPCOUNT = FP_STEPCNT.
      IF SY-SUBRC = 0.
        SORT L_IT_TBTCP BY JOBNM JOBCNT STEPCNT.
        READ TABLE L_IT_TBTCP INTO L_WA_TBTCP INDEX 1.
        IF SY-SUBRC = 0.
          FP_VARIANT = L_WA_TBTCP-VARIANT.
        ENDIF.
      ENDIF.
    Hope this helps.
    BR,
    Suhas

  • ALV report run In background gives 2 spool numbers

    Hi ,
    The ALV report which I am running in Background gives me 2 spool numbers after the Job is created in sm37.
    I am just executing my ALV report by running it in backgroung procressing, but I get 2 spool one has all the correct data of the ALV and 1 blank spool is created.
    I have Passed the followin parameter to my ALV FM.
      lwa_print-no_change_print_params = 'X'.
      lwa_print-no_print_listinfos = 'X'.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
         i_callback_program       = sy-repid
         i_callback_pf_status_set = 'SET_PF_STATUS'
         i_callback_user_command  = 'USER_COMMAND'
         i_default                = space
         is_layout                = t_layout
         is_print                 = lwa_print
         it_fieldcat              = t_fieldcat
       TABLES
         t_outtab                 = t_final
       EXCEPTIONS
         program_error            = 1
         OTHERS                   = 2.
    Unable to find the reason why I get 2 spool created for it?
    Thanks
    Ritesh

    Hi venkatesh,
    Thanks for the reply.
    I tried that also but issue was due to a SKIP statement called in the program and due to which a new spool which was blank was called.
    The issue is resolved.
    Thanks
    Solanki Ritesh

  • Ability to schedule a report to run in background but No access to transact

    Hi,
    I want to give users ability to schedule a report to run in background but No access to transaction Sm37.
    What can be the process/steps to work and morever if we do this is there any disadvantages that users
    can face later...
    <removed_by_moderator>
    Thanks,
    Barada
    Edited by: Julius Bussche on Jan 28, 2009 1:12 PM

    Sorry, I misread your question - thinking that the report should only be run in the background.
    I agree with the others (also about SMX and SMXX to display their own jobs, but not change them afterwards), but which report (tree) is this?
    You can still give the user an ability to maintain a variant via transaction VARCH though (no execute possibility) . It will check S_PROGRAM p_action VARIANT or look for a user specific protection flag.
    But then the user can submit it online as well from other transactions. That is why I thought you were looking for a way to run it as low priority in the background only.
    Cheers,
    Julius

  • Office intergration - run as background job

    Hi,
      I have a word template merged with data using "Desktop Office Integration".
      Currently word template will be opened before data merging is done.
      Is it possible to run as background job, which word template can merge with data in backend? If possible, how should i work on it?
    Kindly advise.
    Thanks,
    Ginnie

    Hi,
      Thanks for your prompt reply.
      Is there any other methods which i can pull my data from table and merge to a word document?
      Or is it possible to generate PDF in this case?
      I need it to be a backend job.
      Any suggestion? Kindly advise.
    thanks,
    ginnie

  • Can ABAP proxy to consume WSDL file be run as background job for every10min

    Hi all,
    I have a requirement where I need to build an interface which gatheru2019s the purchase order details and send to external third party software in their required format (as an XML file).
    So I should be the first point of contact and should trigger the interface each time a purchase order is generated.
    So I am thinking that I should develop a background job for every 10 minutes which will look for new purchase orders and gathers the information of the purchase orders and send them to external third party software in their required format.
    I have gone through all the SAP forums and e-Learning but still I have confusion in regards to how is it possible technically? Can some one guide me with some information on the same.
    I have a little bit of confusion and want to know few things.
    1)     Should I create a web service or should I consume a web service?
    2)     If I need to consume a web service, then can I write an ABAP proxy to be run in background fro evry 10 minutes? I mean can we run ABAP proxy as a batch job in the background?
    3)     Is there a difference between consuming an XML file and WSDL File?
    Any Help will be highly appreciated.
    Regards,
    Jessica.

    There are two options (as I know) to generate XML file.
    1. Use XML TRANSFORMATION to get the XML string based your TRANSFORMATION. You can input your data and get back the XML string. Download this string to a file
    Test XML generation program is:
    types: begin of ty_data,
           num   type i,
           end   of ty_data.
    DATA: itab TYPE standard table of ty_Data,
          la_data like line of itab,
          xmlstr TYPE string.
    DO 3 TIMES.
      la_data-num = sy-index.
      APPEND la_data TO itab.
    ENDDO.
    CALL TRANSFORMATION ztest_np1
      SOURCE table = itab
      RESULT XML xmlstr.
    CALL FUNCTION 'DISPLAY_XML_STRING'
      EXPORTING xml_string = xmlstr.
    My ZTEST_NP1 transformation. To create a transformation, click on the transformation in the "CALL TRANSFORMATION ztest_np1" statement. Select Simple transformation type.
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="table"/>
      <tt:template>
        <table>
          <tt:loop ref=".table">
            <item>
              <tt:value ref="NUM"/>
            </item>
          </tt:loop>
        </table>
      </tt:template>
    </tt:transform>
    XML string is like:
      <?xml version="1.0" encoding="utf-8" ?>
      <table>
      <item>1</item>
      <item>2</item>
      <item>3</item>
      </table>
    To use this option, you have to create a transformation and than use it to generate the XML string.
    Check this SAP Help
    http://help.sap.com/saphelp_nw04s/helpdata/en/e3/7d4719ca581441b6841f1054ff1326/frameset.htm
    2. You can concatenate and create an XML string and download that string into a file.
    Regards,
    Naimesh Patel

Maybe you are looking for

  • MacBook Pro early2011, running slow and safari crashing

    Hi - I am a newer MAC user, and not a technical pro, but have tried several things from the community suggestions to correct a problem with system slowness and safari crashing when trying to open.  I am out of options that I comfortable with, and so

  • Restrict GR date prior to PO creation date.

    Dear experts, The Present configuration allows GR date prior to PO creation date. The system allows users to post Goods receipt (MIGO), even if the GR date is prior to the PO creation date. How to restrict this? Is there a standard customization in M

  • Help on removing a enhancement implementation

    Hi all, I created an enhancement. The enhancement has no code in it. It was created by error. It is not in any change request. I tried to recreate the enhancement with an empty core, but the system always tells me that it already exists. How can fix

  • The system cannot download information from the SQLSERVER server.

    Hi All, After BPC 7.0 SP6 for MS install we get the following when trying to access the "Manage Application Sets" or any other admin console task, when we try to execute the connection wizard: The system cannot download information from the SQLSERVER

  • $doc root Variable use in obj.conf file of iPlanet6 SP2

    Is there any way I can build expressions in obj.conf file using $docroot variable? I have the following configured in the obj.conf now: <<Object name="default"> NameTrans fn="NSServletNameTrans" name="servlet" NameTrans fn="pfx2dir" from="/servlet" d