BAPI_PO_CREATE1 in background

Hi,
How to suppress the E and A type messages from BAPI_PO_CREATE1 in the background to avoid that messages in Job log?
Ie. I want to avoid those messages which is automatically written to Job log in background mode.
I will process the return table and then will write the relevant messages to the job log.
Can anyone help?
Deepu

What currently happening is i have used this BAPI_PO_CREATE1 in one program.
We can excecute the program either in foreground or background.
In foreground the errors are written to a list.<b>--->good</b>
In backgroung the errors are written to the Job log from the program, but what is actually happening is from BAPI_PO_CREATE1 all the E and A type messages are automatically logged into Job log and I wanted to avoid that.--->u can skip if it is back ground
<b>if sy-batch = 'X'.
dont display errors.
else.
errors.
endif.</b>
I will write the error log depending on my requirement.
now irrespective of my error log some other messages are also comming in the error log from BAPI_PO_CREATE1 in background.
I wanted to avoid those messages populating from the BAPI in the background.
<b>But question is : how to u come to know which records got uploaded into SAP ? how to u recorrect errrors?</b>
Regards
Prabhu

Similar Messages

  • Bapi_po_create1 is giving same system messages  multiple time in the joblog

    Hi Experts,
    Bapi_po_create1 is giving same system messages multiple times in the job log when we ran the program in the background
    can u plz suggest how to prevent these multiple appearances of same messages.
    I am pasting the code below whn i ran this program in backgorund job log is having the messages.
    Date       Time     Message text                                                                 Message class Message no. Message type
    08/06/2009 08:11:53 Job started                                                                       00           516          S
    08/06/2009 08:11:53 Step 001 started (program ZZZTEST, variant &0000000000008, user ID BREDDY)        00           550          S
    08/06/2009 08:11:54 Commitment plan contains no account assignment data                              MECP          020          S
    08/06/2009 08:11:54 Commitment plan contains no account assignment data                              MECP          020          S
    08/06/2009 08:11:54 Status "Initial Block" of material 20111 does not allow external procurement      ME           053          E
    08/06/2009 08:11:54 Status "Initial Block" of material 20111 does not allow external procurement      ME           053          E
    08/06/2009 08:11:54 Source not included in list despite source list requirement                       06           722          E
    08/06/2009 08:11:55 Pricing/euro: Attention: Euro Customizing not maintained                          VH           777          S
    08/06/2009 08:11:55 Pricing/euro: Attention: Euro Customizing not maintained                          VH           777          S
    08/06/2009 08:11:55 Status "Initial Block" of material 20111 does not allow external procurement      ME           053          E
    08/06/2009 08:11:55 Purchase order still contains faulty items                                       MEPO          000          E
    08/06/2009 08:11:55 Job finished                                                                      00           517          S
    Edited by: bhavani prasad kotharu on Aug 6, 2009 3:09 PM

    HERE IS THE CODE OF THE PROGRAM, WE R JUST PASSING SOME PO DATA TO THE BAPI_PO_CREATE1,ON RUNNING THIS PROGRAM IN BACKGROUND SAME SYSTEM MESSAGES ARE APPEARED MULTIPLE TIMES,----
    REPORT zzztest.
    DATA :    lwa_bapimepoheader TYPE bapimepoheader
             ,lwa_bapimepoheaderx TYPE bapimepoheaderx
             ,li_bapimepoitem TYPE STANDARD TABLE OF bapimepoitem
             ,lwa_bapimepoitem TYPE  bapimepoitem
             ,li_bapimepoitemx TYPE STANDARD TABLE OF bapimepoitemx
             ,lwa_bapimepoitemx TYPE bapimepoitemx
             ,li_conditions TYPE STANDARD TABLE OF komv
             ,li_return TYPE STANDARD TABLE OF bapiret2
             , n TYPE c
    PARAMETERS: p1 TYPE c AS CHECKBOX.
    IF p1 = 'X'.
      lwa_bapimepoheader-doc_type = 'NB'.
      lwa_bapimepoheader-purch_org = 'NA00'.
      lwa_bapimepoheader-pur_group = 'C02'.
      lwa_bapimepoheaderx-doc_type = 'X'.
      lwa_bapimepoheaderx-purch_org = 'X'.
      lwa_bapimepoheaderx-pur_group = 'X'.
      lwa_bapimepoitem-po_item = '10'.
      lwa_bapimepoitem-material = '000000000000020111'.
      lwa_bapimepoitem-plant = 'CA01'.
      lwa_bapimepoitem-vend_mat = '1000'.
      lwa_bapimepoitem-quantity = '10'.
      lwa_bapimepoitem-orderpr_un = 'M'.
      lwa_bapimepoitem-no_more_gr = 'K'.
      lwa_bapimepoitem-agreement = '4600000095'.
      lwa_bapimepoitem-agmt_item = '10'.
      lwa_bapimepoitem-pricedate = 'X'.
      lwa_bapimepoitem-price_date = '20071030'.
      lwa_bapimepoitem-no_rounding = 'X'.
      APPEND lwa_bapimepoitem TO li_bapimepoitem.
      lwa_bapimepoitemx-po_item = '10'.
      lwa_bapimepoitemx-po_itemx = 'X'.
      lwa_bapimepoitemx-po_itemx = 'X'.
      lwa_bapimepoitemx-material = 'X'.
      lwa_bapimepoitemx-plant = 'X'.
      lwa_bapimepoitemx-quantity = 'X'.
      lwa_bapimepoitemx-po_unit = 'X'.
      lwa_bapimepoitemx-orderpr_un = 'X'.
      lwa_bapimepoitemx-acctasscat = 'X'.
      lwa_bapimepoitemx-agreement = 'X'.
      lwa_bapimepoitemx-agmt_item = 'X'.
      lwa_bapimepoitemx-pricedate = 'X'.
      lwa_bapimepoitemx-price_date = 'X'.
      lwa_bapimepoitemx-preq_no = 'X'.
      lwa_bapimepoitemx-preq_item = 'X'.
      lwa_bapimepoitemx-no_rounding = 'X'.
      APPEND lwa_bapimepoitemx TO li_bapimepoitemx.
    DATA: lo_msg_handler  TYPE REF TO cl_message_handler_mm.
      CALL METHOD cl_message_handler_mm=>get_handler
        IMPORTING
          ex_handler = lo_msg_handler.
      lo_msg_handler->remove_all( ).
      lo_msg_handler->cleanup( ).
      CALL FUNCTION 'BAPI_PO_CREATE1' "in background task
           EXPORTING
             poheader   = lwa_bapimepoheader
             poheaderx  = lwa_bapimepoheaderx
             testrun    = 'X'
           NO_MESSAGING = c_x
           NO_MESSAGE_REQ = c_x
             no_authority = 'X'
           IMPORTING
             expheader  = lwa_bapimepoheader
           TABLES
             return     = li_return
             poitem     = li_bapimepoitem
             poitemx    = li_bapimepoitemx
             conditions = li_conditions.
    ENDIF.
    Edited by: bhavani prasad kotharu on Aug 6, 2009 3:38 PM

  • BAPI_PO_CREATE1 Error related to Fiscal year variant

    Hi,
    I am working on open PO tranfer program.
    initialy i have created one PO from ME21n tcode, and its worked out fine
    now using same data when i creating PO using BAPI -> BAPI_PO_CREATE1 then i am getting following error
    E No instance of object type PurchaseOrder has been created. External reference:
    E Purchase order still contains faulty items                                   
    W Purchase order date is in the past                                           
    I Order unit ****** cannot be used                                             
    I Date / / period  is not valid                                                
    E For the Z6 fiscal year variant, no period is defined for / /                 
    I Net price for item 00010 adopted from last document     
    Wondering why error  "For the Z6 fiscal year variant, no period is defined for / / " not triggered in ME21n ?
    From excel i am passing below item data:
    1. wa_data-ebelp
    2. wa_data-ematn
    3. wa_data-menge
    4. wa_data-meins
    5. wa_data-netpr
    Please look into below code...
        LOOP AT it_data INTO wa_data WHERE ebeln = wa_header-ebeln.
    *     PO Item data
          wa_poitem-po_item     = wa_data-ebelp.
          wa_poitem-short_text  = wa_data-txz01.
          CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
            EXPORTING
              input              = wa_data-ematn
            IMPORTING
              OUTPUT           = wa_poitem-material
    *       EXCEPTIONS
    *         LENGTH_ERROR       = 1
    *         OTHERS             = 2
          wa_poitem-plant         = 'U001'.
          wa_poitem-stge_loc      = 'M001'.
          wa_poitem-quantity      = wa_data-menge.
          wa_poitem-po_unit       = wa_data-meins. "001
          wa_poitem-net_price     = wa_data-netpr. "001
          wa_poitem-price_unit    = wa_data-peinh. "001
          wa_poitem-prnt_price    = c_x.
          wa_poitem-order_reason  = 'PB'.
          wa_poitem-vend_mat      = wa_data-idnlf. "Vend Mat num
          wa_poitem-period_ind_expiration_date = 'D'.
          APPEND wa_poitem TO it_poitem.
          wa_poitemx-po_item      = wa_data-ebelp.
          wa_poitemx-short_text   = c_x.
          wa_poitemx-material     = c_x.
          wa_poitemx-plant        = c_x.
          wa_poitemx-stge_loc     = c_x.
          wa_poitemx-quantity     = c_x.
          wa_poitemx-po_unit      = c_x. "001
          wa_poitemx-net_price    = c_x. "001
          wa_poitemx-price_unit   = c_x. "001
          wa_poitemx-prnt_price   = c_x.
          wa_poitemx-order_reason = c_x.
          wa_poitemx-vend_mat     = c_x.
          wa_poitemx-period_ind_expiration_date = c_x.
          APPEND wa_poitemx TO it_poitemx.
    *     PO Delivery schedule data
          wa_poschedule-po_item = wa_data-ebelp.
          wa_poschedule-delivery_date = wa_data-eindt.
          APPEND wa_poschedule TO it_poschedule.
          wa_poschedulex-po_item = wa_data-ebelp.
          wa_poschedulex-delivery_date = c_x.
          APPEND wa_poschedulex TO it_poschedulex.
    ENDLOOP.
    Please suggest what went wrong?

    here is the sample code
    this my sample code to create PO with BAPI, 
    DATA : lwa_bapimepoheader TYPE bapimepoheader
    ,lwa_bapimepoheaderx TYPE bapimepoheaderx
    ,li_bapimepoitem TYPE STANDARD TABLE OF bapimepoitem
    ,lwa_bapimepoitem TYPE bapimepoitem
    ,li_bapimepoitemx TYPE STANDARD TABLE OF bapimepoitemx
    ,lwa_bapimepoitemx TYPE bapimepoitemx
    ,li_conditions TYPE STANDARD TABLE OF komv
    ,li_return TYPE STANDARD TABLE OF bapiret2
    , n TYPE c
    PARAMETERS: p1 TYPE c AS CHECKBOX.
    IF p1 = 'X'.
    lwa_bapimepoheader-doc_type = 'NB'.
    lwa_bapimepoheader-purch_org = 'NA00'.
    lwa_bapimepoheader-pur_group = 'C02'.
    lwa_bapimepoheaderx-doc_type = 'X'.
    lwa_bapimepoheaderx-purch_org = 'X'.
    lwa_bapimepoheaderx-pur_group = 'X'.
    lwa_bapimepoitem-po_item = '10'.
    lwa_bapimepoitem-material = '000000000000020111'.
    lwa_bapimepoitem-plant = 'CA01'.
    lwa_bapimepoitem-vend_mat = '1000'.
    lwa_bapimepoitem-quantity = '10'.
    lwa_bapimepoitem-orderpr_un = 'M'.
    lwa_bapimepoitem-no_more_gr = 'K'.
    lwa_bapimepoitem-agreement = '4600000095'.
    lwa_bapimepoitem-agmt_item = '10'.
    lwa_bapimepoitem-pricedate = 'X'.
    lwa_bapimepoitem-price_date = '20071030'.
    lwa_bapimepoitem-no_rounding = 'X'.
    APPEND lwa_bapimepoitem TO li_bapimepoitem.
    lwa_bapimepoitemx-po_item = '10'.
    lwa_bapimepoitemx-po_itemx = 'X'.
    lwa_bapimepoitemx-po_itemx = 'X'.
    lwa_bapimepoitemx-material = 'X'.
    lwa_bapimepoitemx-plant = 'X'.
    lwa_bapimepoitemx-quantity = 'X'.
    lwa_bapimepoitemx-po_unit = 'X'.
    lwa_bapimepoitemx-orderpr_un = 'X'.
    lwa_bapimepoitemx-acctasscat = 'X'.
    lwa_bapimepoitemx-agreement = 'X'.
    lwa_bapimepoitemx-agmt_item = 'X'.
    lwa_bapimepoitemx-pricedate = 'X'.
    lwa_bapimepoitemx-price_date = 'X'.
    lwa_bapimepoitemx-preq_no = 'X'.
    lwa_bapimepoitemx-preq_item = 'X'.
    lwa_bapimepoitemx-no_rounding = 'X'.
    APPEND lwa_bapimepoitemx TO li_bapimepoitemx.
    DATA: lo_msg_handler TYPE REF TO cl_message_handler_mm.
    CALL METHOD cl_message_handler_mm=>get_handler
    IMPORTING
    ex_handler = lo_msg_handler.
    lo_msg_handler->remove_all( ).
    lo_msg_handler->cleanup( ).
    CALL FUNCTION 'BAPI_PO_CREATE1' "in background task
    EXPORTING
    poheader = lwa_bapimepoheader
    poheaderx = lwa_bapimepoheaderx
    testrun = 'X'
    NO_MESSAGING = c_x
    NO_MESSAGE_REQ = c_x
    no_authority = 'X'
    IMPORTING
    expheader = lwa_bapimepoheader
    TABLES
    return = li_return
    poitem = li_bapimepoitem
    poitemx = li_bapimepoitemx
    conditions = li_conditions.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

  • Call external program in background mode

    Hi,
    I am creating a PO using bapi BAPI_PO_CREATE1 in exit USEREXIT_SAVE_DOCUMENT_PREPARE.
    I dont want to write the code in my exit. Instead I want to write the code in a Z program and call it in my exit.
    My Problem.
    How do I call my z program in my exit so that I can pass internal tables from my exit to the z program. Also I want to schedule the call of my external program for background processing.
    I am trying with SUBMIT ZPROG AND RETURN. But not able to pass an internal table.
    I tried PERFORM BAPI_PO_CREATE IN PRGRAM ZPROG, but in this case not able to schedule it in background.
    Please advise.
    Regards,
    Shobhit

    Hi Rich,
    Im setting runtime error:
    My Code in Exit: (xvbfa is the table which i wanna pass)
    concatenate 'SERVICEPO' sy-datum into l_key.
    export xvbfa = xvbfa
                  to shared buffer indx(st) id l_key.
    My Code in the called program ZMM_SERVICE_PO
    Runtime Errors         CONNE_IMPORT_WRONG_OBJECT_TYPE
    Exceptn                CX_SY_IMPORT_MISMATCH_ERROR
    Date and Time          05.12.2005 21:41:54
    ShrtText
         Error when attempting to IMPORT object "XVBFA".
    What happened?
         Error in ABAP application program.
         The current ABAP program "ZMM_SERVICE_PO" had to be terminated because one of
          the
         statements could not be executed.
         This is probably due to an error in the ABAP program.
         When importing the object "XVBFA", the object in the
         dataset had a different type from the target object in the program
         "ZMM_SERVICE_PO" (object types: field, field string/structure, table).
         table).
    Error analysis
         An exception occurred. This exception will be dealt with in more detail
         below. The exception, assigned to the class 'CX_SY_IMPORT_MISMATCH_ERROR', was
          not caught, which
          led to a runtime error. The reason for this exception is:
         The object "XVBFA" has a different object type in the dataset from
         that in the target program "ZMM_SERVICE_PO". (Object types: Field, flat
          structure,
         deep structure, flat table, deep table).
    Missing Handling of System Exception
        Program                                 ZMM_SERVICE_PO
    Trigger Location of Exception
        Program                                 ZMM_SERVICE_PO
        Include                                 ZMM_SERVICE_PO
        Row                                     43
        Module Name                             START-OF-SELECTION
    Source Code Extract
    Line  SourceCde
    REPORT  ZMM_SERVICE_PO.
    DATA: l_poheader      LIKE bapimepoheader.
    DATA: l_poheaderx     LIKE bapimepoheaderx.
    DATA: l_poitem        LIKE bapimepoitem     OCCURS 0 WITH HEADER LINE.
    DATA: l_poitemx       LIKE bapimepoitemx    OCCURS 0 WITH HEADER LINE.
    DATA: l_cond          LIKE BAPIMEPOCOND     OCCURS 0 WITH HEADER LINE.
    DATA: l_condx         LIKE BAPIMEPOCONDX    OCCURS 0 WITH HEADER LINE.
    DATA: l_poschedule    LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE.
    DATA: l_poschedulex   LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE.
    DATA: l_purchaseorder LIKE bapimepoheader-po_number.
    DATA: l_return        TYPE BAPIRET2 OCCURS 0.
    DATA: l_error_found   TYPE c.
    DATA: l_show_messages TYPE c.
    DATA: l_eindt(10)     TYPE c.
    DATA: l_answer        TYPE c.
    DATA: l_VBAK          TYPE STANDARD TABLE OF VBAK WITH HEADER LINE.
    DATA: l_VBFA          TYPE STANDARD TABLE OF VBFA WITH HEADER LINE.
    DATA: xlips           TYPE STANDARD TABLE OF LIPS WITH HEADER LINE.
    *DATA: xvbfa           TYPE STANDARD TABLE OF vbfa WITH HEADER LINE.
    DATA xvbfa like vbfa.
    DATA: l_key(60) type c.
          concatenate 'SERVICEPO' sy-datum into l_key.
    >>>>> import xvbfa = xvbfa
                      from shared buffer indx(st) id l_key.
          delete from shared buffer indx(st) id l_key.
    Could you help.
    Regads,
    Shobhit

  • BAPI_PO_CREATE1 generates double PO Output

    Hi.
    I am dealing with an issue that i cannot findout what's happening.
    We have a Z program that generates a Purchase Order using BAPI_PO_CREATE1. The problem is that it's printing 2 copies of the output message NEU where only one message is configured for the PO.
    If i create the PO manually with the same data, it generates the NEU message with only one copy.
    Has anyone seen this before ?

    For the first answer:
    I tried to put a break point in the print program, but as it's a BAPI, it only executes the print program when BAPI_TRANSACTION_COMMIT is issued and as it's in background mode i cannot check whats happening.
    For the 2nd answer:
    Only one output is generated. If set the message to not print immediately and go to ME9F, only one copy is printed.

  • BAPI_PO_CREATE1 and PO output issue

    All,
    I am having the following issue.
    We use BI Integrated Planning to drive our purchasing.  I have developed code within an extractor that will create PO's in ERP based on BI cube data.
    I use BAPI_PO_CREATE1 to create the PO in ERP.  As background I created tables to match the BAPI_PO_CREATE1 structures in the BI system and then created a z function module to pass data from BI to ERP and then call the SAP Standard BAPI_PO_CREATE1.
    My issue is as follows:
    I can send across the relevant BI user and this sets the PO creator to be the correct user.  However the output associated with the PO is being set as the BWREMOTE user.  As  a result the email output from the PO is picking the BWREMOTE user as the person sending the email (can see it in SCOT) and not the actual user.
    Is there a way to ensure that the PO message (Output) creator can be modified and set to the correct user and not be the BWREMOTE user?
    Thanks in advance
    Eddie

    I don't have any value from POITEM-NET_PRICE....
    In my program i have:
    WO_POHEADER-COMP_CODE = '1376'.
    WO_POHEADER-DOC_TYPE = 'ZPCO'.
    WO_POHEADER-VENDOR = '0000900600'.
    WO_POHEADER-PURCH_ORG = 'N200'.
    WO_POHEADER-PUR_GROUP = '010'.
    WO_POHEADERX-COMP_CODE = '1376'.
    WO_POHEADERX-DOC_TYPE = 'ZPCO'.
    WO_POHEADERX-VENDOR = '0000900600'.
    WO_POHEADERX-PURCH_ORG = 'N200'.
    WO_POHEADERX-PUR_GROUP = '010'.
    WO_POITEM-po_item = '00010'.
    WO_POITEM-material = '000000000040900031'.
    WO_POITEM-PLANT = 'N200'.
    WO_POITEM-QUANTITY = '5.000'.
    WO_POITEM-ACCTASSCAT = 'X'.
    WO_POITEM-ITEM_CAT = '5'.
    append WO_POITEM.
    WO_POITEMX-po_item = '00010'.
    WO_POITEMX-material = '000000000040900031'.
    WO_POITEMX-PLANT = 'N200'.
    WO_POITEMX-QUANTITY = '5.000'.
    WO_POITEMX-ACCTASSCAT = 'X'.
    WO_POITEMX-ITEM_CAT = '5'.
    append WO_POITEMX.
    And please note that i am running this with TEST_RUN flagged. When is not flagged i get the new PO number created, so i think i am doing everything ok.. My problem is how to get the Net Price in simulation...
    Thanks
    BR
    Message was edited by:
            pati mio

  • How to give Common Background color for all JPanels in My Swing application

    Hi All,
    I am developing a swing application using The Swing Application Framework(SAF)(JSR 296). I this application i have multiple JPanel's embedded in a JTabbedPane. In this way i have three JTabbedPane embedded in a JFrame.
    Now is there any way to set a common background color for the all the JPanel's available in the application??
    I have tried using UIManager.put("Panel.background",new Color.PINK);. But it did not work.
    Also let me know if SAF has some inbuilt method or way to do this.
    Your inputs are valuable.
    Thanks in Advance,
    Nishanth.C

    It is not the fault of NetBeans' GUI builder, JPanels are opaque by default, I mean whether you use Netbeans or not.Thank you!
    I stand corrected (which is short for +"I jumped red-eyed on my feet and rushed to create an SSCCE to demonstrate that JPanels are... mmm... oh well, they are opaque by default... ;-[]"+)
    NetBeans's definitely innocent then, and indeed using it would be an advantage (ctrl-click all JPanels in a form and edit the common opaque property to false) over manually coding
    To handle this it would be better idea to make a subclass of JPanel and override isOpaque() to return false. Then use this 'Trasparent Panel' for all the panels where ever transparency is required.I beg to differ. From a design standpoint, I'd find it terrible (in the pejorative sense of the word) to design a subclass to inconsistently override a getter whereas the standard API already exposes the property (both get and set) for what it's meant: specify whether the panel is opaque.
    Leveraging this subclass would mean changing all lines where a would-be-transparent JPanel is currently instantiated, and instantiate the subclass instead.
    If you're editing all such lines anyway, you might as well change the explicit new JPanel() for a call to a factory method createTransparentJPanel(); this latter could, at the programmer's discretion, implement transparency whichever way makes the programmer's life easier (subclass if he pleases, although that makes me shudder, or simply call thePanel.setOpaque(false) before returning the panel). That way the "transparency" code is centralized in a single easy to maintain location.
    I had to read the code for that latter's UI classes to find out the keys to use (+Panel.background+, Label.foreground, etc.), as I happened to not find this info in an authoritative document - I see that you seem to know thoses keys, may I ask you where you got them from?
    One of best utilities I got from this forum, written by camickr makes getting these keys and their values very easy. You can get it from his blog [(->link)|http://tips4java.wordpress.com/2008/10/09/uimanager-defaults/]
    Definitely. I bit a pair of knucles off when discovered it monthes after cumbersomely traversing the BasicL&F code...
    Still, it is a matter-of-fact approach (and this time I don't mean that to sound pejorative), that works if you can test the result for a given JDK version and L&F, but doesn't guarantee that these keys are there to stand - an observation, but not a specification.
    Thanks TBM for highlighting this blog entry, that's the best keys list device I have found so far, but the questions still holds as to what specifies the keys.
    Edited by: jduprez on Feb 15, 2010 10:07 AM

  • Closing the Background report engine

    I use a menu that can call several reports, and when they open, the Reports Background Engine runs. I understand why it is useful to keep this open while the main app is on, but it does not close out automatically when the app closes. Is there a command that will do this?
    Thanks,
    Sara

    I Guess,
    Add_Parameter(pl_id, 'ORACLE_SHUTDOWN', TEXT_PARAMETER, 'YES') will do (pl_id is the parameter list that you must have created to run each individual report)

  • 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.

  • Layout variant is not working in background in ALV report

    Hi,
    I have one LAV report to send the report output through mail in foreground and backgroud.Final internal table is having 46 fileds to display the output.But here user is saving the layout variant and sending that layout variant output to mail id in excel format with zip file.Its working in foreground.But in background its not working.Even if we select the layout variant,its sending all the 46 fileds to mail.
    here we have used the below FM to update the fieldcat itab.
    CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
        IMPORTING
          et_fieldcat   = it_fieldcat[]
          es_variant    = v_disvariant
        EXCEPTIONS
          no_infos      = 1
          program_error = 2
          OTHERS        = 3.
    In for ground NO_OUT = 'x' for non selected fields and NO_OUT = ' ' for selected fields.
    But in background NO_OUT = ' ' for all the fileds, even if we select the layout variant.
    Please suggest me  with the solution.
    Regards,
    Jayaram

    hi ,
    Do according to this
    SORT t_ekbe by belnr.
      if  t_ekbe[] is not initial  .
          SELECT  MBLNR
            BWART
            SMBLN
            ERFMG   " This is the new added field
            erfme     " This is the new added field
          INTO CORRESPONDING FIELDS OF TABLE t_mseg
        for all entries in t_ekbe
          from mseg
          where mblnr = t_ekbe-belnr
          AND   bwart = '101'.
      endif.
    after this
    loop at t_ekbe .
    loop at t_mseg  where mblnr  = t_ekbe-belnr .
      t_ekbe-ERFMG = t_mseg-ERFMG .
    t_ekbe-erfme =   t_mseg-erfme  .
    modify t_ekbe transporting ERFMG  erfme .
    clear t_mseg .
    endloop.
    clear t_ekbe .
    endloop.
    Regards
    Deepak .

  • Problems creating background job for program (job open, submit and close)

    Hi gurus,
    im trying to start a background job using the FM BP_START_DATE_EDITOR to show the start date to the job or if it's imediate. this FM it's working fine, after call it im opening a job, submiting it and call the job close FM and the job close FM creates me the job.
    The problem it's when i go to the sm37 to see the job status the job has been canceled, and the job log says that i have to give a start date to the job.
    What i dont understand it's either the job is imediate or i choose a date to start the job always gives me this error...
    Below goes my code,
    any ideas will be rewarded
      CLEAR: stdt_modify_type, stdt_output.
      CALL FUNCTION 'BP_START_DATE_EDITOR'
           EXPORTING
                stdt_dialog                    = 'Y'
                stdt_input                     = stdt_input
                stdt_opcode                    = 14
           IMPORTING
                stdt_modify_type               = stdt_modify_type
                stdt_output                    = stdt_output
           EXCEPTIONS
                fcal_id_not_defined            = 1
                incomplete_last_startdate      = 2
                incomplete_startdate           = 3
                invalid_dialog_type            = 4
                invalid_eventid                = 5
                invalid_opcode                 = 6
                invalid_opmode_name            = 7
                invalid_periodbehaviour        = 8
                invalid_predecessor_jobname    = 9
                last_startdate_in_the_past     = 10
                no_period_data_given           = 11
                no_startdate_given             = 12
                period_and_predjob_no_way      = 13
                period_too_small_for_limit     = 14
                predecessor_jobname_not_unique = 15
                startdate_interval_too_large   = 16
                startdate_in_the_past          = 17
                startdate_is_a_holiday         = 18
                startdate_out_of_fcal_range    = 19
                stdt_before_holiday_in_past    = 20
                unknown_fcal_error_occured     = 21
                no_workday_nr_given            = 22
                invalid_workday_countdir       = 23
                invalid_workday_nr             = 24
                notbefore_stdt_missing         = 25
                workday_starttime_missing      = 26
                no_eventid_given               = 27
                OTHERS                         = 28.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        MOVE 'X' TO gv_flag.
      ENDIF.
      DATA jobname LIKE tbtcjob-jobname.
      DATA jobcount LIKE tbtcjob-jobcount.
      DATA job_release LIKE  btch0000-char1.
      DATA job_imediate TYPE c.
      CLEAR: jobname, jobcount, job_release.
      CONCATENATE 'MAPAEXEC' sy-uname sy-datum
                   INTO jobname SEPARATED BY space.
      CALL FUNCTION 'JOB_OPEN'
           EXPORTING
                jobname          = jobname
           IMPORTING
                jobcount         = jobcount
           EXCEPTIONS
                cant_create_job  = 1
                invalid_job_data = 2
                jobname_missing  = 3
                OTHERS           = 4.
      IF sy-subrc <> 0.
        MESSAGE i003(zmapas).
        EXIT.
      ENDIF.
      SUBMIT z_mapa_execucao_orcamental
             VIA JOB jobname NUMBER jobcount
             WITH ano EQ ano
             WITH so_perio IN so_perio
             WITH so_date IN so_date
             WITH so_org EQ so_org
             WITH so_num IN so_num
             AND RETURN.
      IF stdt_output-startdttyp EQ 'I'.
        CLEAR job_imediate.
        job_imediate = 'X'.
      ENDIF.
      CALL FUNCTION 'JOB_CLOSE'
           EXPORTING
                calendar_id                 = stdt_output-calendarid
                event_id                    = stdt_output-eventid
                event_param                 = stdt_output-eventparm
                event_periodic              = stdt_output-periodic  "?
                jobcount                    = jobcount
                jobname                     = jobname
                laststrtdt                  = stdt_output-laststrtdt
                laststrttm                  = stdt_output-laststrttm
                prddays                     = stdt_output-prddays  "??
                prdhours                    = stdt_output-prdhours  "?
                prdmins                     = stdt_output-prdmins  "??
                prdmonths                   = stdt_output-prdmonths
                prdweeks                    = stdt_output-prdweeks  "?
                predjob_checkstat           = stdt_output-checkstat
                pred_jobcount               = stdt_output-predjobcnt
                pred_jobname                = stdt_output-predjob
                sdlstrtdt                   = stdt_output-sdlstrtdt
                sdlstrttm                   = stdt_output-sdlstrttm
                strtimmed                   = job_imediate
                targetsystem                = stdt_output-instname
                start_on_workday_not_before = stdt_output-notbefore
                start_on_workday_nr         = stdt_output-wdayno
                workday_count_direction     = stdt_output-wdaycdir
           IMPORTING
                job_was_released            = job_release
           EXCEPTIONS
                cant_start_immediate        = 1
                invalid_startdate           = 2
                jobname_missing             = 3
                job_close_failed            = 4
                job_nosteps                 = 5
                job_notex                   = 6
                lock_failed                 = 7
                OTHERS                      = 8.
      IF sy-subrc <> 0.
        MESSAGE i003(zmapas).
        EXIT.
      ELSE.
        MESSAGE i004(zmapas) WITH jobname.
      ENDIF.
    Thanks in advance,
    Best Regards
    João Martins

    Hello João.
    In debug mode, check the value of variables you passed to parameters sdlstrtdt and sdlstrttm.
    As aditional info, I usually achieve your goal without FM BP_START_DATE_EDITOR.
    Check this code:
    CALL FUNCTION 'JOB_OPEN'
          EXPORTING
               jobname          = w_jobname
          IMPORTING
               jobcount         = w_jobcount
          EXCEPTIONS
               cant_create_job  = 1
               invalid_job_data = 2
               jobname_missing  = 3
               OTHERS           = 4.
    CHECK sy-subrc = 0.
    CLEAR seltab_wa.
    MOVE: t_jobs-param TO seltab_wa-selname,
    t_processar-line+34 TO seltab_wa-low.
    APPEND seltab_wa TO seltab.
    seltab_wa-selname = 'P_LOJA'.
    seltab_wa-low = t_processar-ficheiro+7(4).
    APPEND seltab_wa TO seltab.
    *** Submete o programa para o JOB
    SUBMIT (t_jobs-repid)
      WITH  SELECTION-TABLE seltab
      USER sy-uname
       VIA JOB w_jobname NUMBER w_jobcount
       AND RETURN.
    *** Encerra o JOB
      l_hora = sy-uzeit.
      ADD 60 TO l_hora.
    CALL FUNCTION 'JOB_CLOSE'
       EXPORTING
          jobcount           = w_jobcount
          jobname           = w_jobname
          sdlstrtdt            = sy-datum
          sdlstrttm           = l_hora
          targetserver       = w_servidor
       IMPORTING
          job_was_released     = l_liberado
       EXCEPTIONS
          cant_start_immediate = 1
          invalid_startdate    = 2
          jobname_missing      = 3
          job_close_failed     = 4
          job_nosteps          = 5
          job_notex            = 6
          lock_failed          = 7
          OTHERS               = 8.
    Regards.
    Valter Oliveira.

  • Background jobs

    Hi,
            We can schedule the programs or transactions in background through SM36 and we can see the status through SM37.Then what is the use of FM's JOb_open,Job_submit and Job_close.When we will use these FM's.
    Can anybody tell me the difference between these two methods for scheduling the jobs in background....with sample code if possible
    Thanks & Regards,
    Rakesh.

    hi,
    chk this,
    call funcatio.
    ****Open a job to submit the Post Program into
    call function 'JOB_OPEN'
    exporting
    jobname = jobname
    importing
    jobcount = jobcount
    exceptions
    cant_create_job = 1
    invalid_job_data = 2
    jobname_missing = 3
    others = 4.
    if sy-subrc 0.
    raise job_open_failed.
    endif.
    submit zefu_currency_load_callbak_ack
    via job jobname
    number jobcount
    with com_num = com_num
    with relay_nu = relay_num
    and return.
    if sy-subrc 0.
    raise job_step_failed.
    endif.
    ****Close the Job and start it immediately
    call function 'JOB_CLOSE'
    exporting
    jobcount = jobcount
    jobname = jobname
    strtimmed = 'X'
    exceptions
    cant_start_immediate = 1
    invalid_startdate = 2
    jobname_missing = 3
    job_close_failed = 4
    job_nosteps = 5
    job_notex = 6
    lock_failed = 7
    others = 8.
    if sy-subrc 0.
    raise job_close_failed.
    endif.
    Also,
    Create a Variant for the Program and
    Schedule JOB in background:
    Go to SM36 create a Job
    enter Program and Variant for that program in STEP..
    click on Start Condition
    Click on DATE and TIME enter date scheduled Start and END times
    click on Period Values
    Click on HOURLY/WEEKLY etc
    CLick on RESTRICTIONS also to use further criteria.
    so your job will be scheduled and run as per your requirement.
    and in SM37 Transaction check the status of that JOB
    Check this link for scheduling jobs..
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/3a7f87505211d189550000e829fbbd/content.htm
    You can also use the fun modules JOB_OPEN,JOB_CLOSE etc for job
    scheduling.
    hope this helps.
    regs,
    hema.

  • Running a report in Background

    Hi Guys,
                  I am designing a ALV report.
    This report have option in the selection screen, to run immediately or Background.
    I am using JOB_OPEN, JOB_SUBMIT and JOB_CLOSE FM's.
    My doubt is at which point I have to use these FM's.
    Immediately in START-OF-SELECTION ?
    If this is the case, I can write rest of my code after JOB_CLOSE FM.. Right ?.
    Thanks

    Hi Naresh,
                    Thanks for the reply.
    My doubt is, can I use these FM's in the report itself, or I have to write separate program for this ?
    If I can use in the same report, where exactly i can use it.
    For example.
    I have form to print ALV - GENERATE_ALV and send email - SEND_MAIL.
    do I use like this.
    start-of-selection.
    JOB_OPEN..
    JOB_SUBMIT..
    JOB_CLOSE..
    GENERATE_ALV
    SEND_MAIL
    Thanks

  • Background schedule

    dear experts,
    i am using these code to schedule a program to run in background
    export 'value' to memory id 'table'.
    call function job_open.
    submit 'zprogram' via job job_name  number job_number and return.
    call function job_close.
    in program 'zprogram' i have used the syntax
    import so_input  from memory id 'table'.
    in event initialization.
    but i thin data is not importing in called program using import statement. can anyone suggest me how to schedule it properly.
    is there any problem in my code??
    Edited by: shekharamit on Jul 20, 2010 6:53 AM

    Your export statement:
    export 'value' to memory id 'table'.
    and your IMPORT statement:
    import so_input from memory id 'table'.
    Don't you think there is definitely some problem with this. Read the F1 help & figure it out yourself.
    BR,
    Suhas

  • To delay a program submitted in background from another transaction.

    Hi All,
    There are 2 programs 'A' and 'B' . During execution of 'A' , 'B'  is called and submitted in background using FM Job_open & Job_close and submit query.
    My requirement is to Delay the Program 'B' by 2-3 mins without delaying Program 'A' .
    I tried using FM JOB_OPEN export condition sdlstrttm   = w_starttm but was of no help.
    I also tried using statement wait up to 120 seconds but this also makes wait to program 'A'.
    Please suggest solutions to this.
    Regards,
    Nibha

    Hi Prashant,
    I am not able to understand ur suggestion.
    My piece of code is
        call function 'JOB_OPEN'
          exporting
            jobname          = 'YI90C_BG'
           sdlstrtdt        = w_startdt
           sdlstrttm        = w_starttm
          importing
            jobcount         = job_count
          exceptions
            cant_create_job  = 1
            invalid_job_data = 2
            jobname_missing  = 3
            others           = 4.
        if sy-subrc <> 0.
          message id sy-msgid type sy-msgty number sy-msgno
                  with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        endif.
        if sy-subrc = 0.
          submit ympic_source_list_contr_upload
          with selection-table it_selcr
          and return
          via job 'YI90C_BG'
          number job_count.
          if sy-subrc = 0.
            call function 'JOB_CLOSE'
              exporting
                jobcount             = job_count
                jobname              = 'YI90C_BG'
                strtimmed            = 'X'
              importing
                job_was_released     = w_status
              exceptions
                cant_start_immediate = 1
                invalid_startdate    = 2
                jobname_missing      = 3
                job_close_failed     = 4
                job_nosteps          = 5
                job_notex            = 6
                lock_failed          = 7
                others               = 8.
          endif.
        endif.
    Please tell what changes should I make?
    Regards,
    Nibha

Maybe you are looking for