Function Module MASTER_IDOC_DISTRIBUTE to be called in background task?

Hi,
We are generating outbound Idocs in a report. In this report we are using Function Module Master_Idoc_Distribute. Now we have faced some performance issues and the basis consultant is asking us to:
Call the function module using CALL FUNCTION Master_Idoc_Distribute IN BACKGROUND TASK.
1) How will calling the FM Master_IDOC_Distribute in background task help improve the performance?
2) By calling the function module in background task, will it have any impact on the sequencing of the idocs? If yes what is the way out, as the idoc sequence is very important.
Thanks in advance,
Mick

1) How will calling the FM Master_IDOC_Distribute in background task help improve the performance?
->Calling the FM in background task will help in performance as it will be called in the background process mode like a tRFC.So it will not occupy any dialog process which are limited.
2) By calling the function module in background task, will it have any impact on the sequencing of the idocs? If yes what is the way out, as the idoc sequence is very important.
->It will not have any impact on IDoc sequence.

Similar Messages

  • How to capture errors when a Function module is called as BACKGROUND TASK

    How to capture errors when a Function module is called as BACKGROUND TASK?.Please advise.
    FUNCTION ZRPM_DELETE_PROJECT_DATA_API.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(IV_EXTERNAL_ID) TYPE  RPM_TV_EXTID OPTIONAL
    *"     VALUE(IV_PROJECT_GUID) TYPE  RPM_TV_GUID OPTIONAL
    *"     VALUE(FLAG) TYPE  BOOLEAN OPTIONAL
    *"  EXPORTING
    *"     VALUE(EV_RC) TYPE  I
    *"     VALUE(EV_MSG) TYPE  STRING
    *"     VALUE(ET_MSG) TYPE  RPM_TT_MESSAGES
      IF flag = cl_rpm_co=>sc_true.
        Call function 'RPM_DELETE_PROJECT_DATA' IN BACKGROUND TASK
          EXPORTING
            IV_EXTERNAL_ID  = IV_EXTERNAL_ID
            IV_PROJECT_GUID = IV_PROJECT_GUID
          IMPORTING
            EV_RC           = EV_RC
            EV_MSG          = EV_RC
            ET_MSG          = ET_MSG.
        COMMIT WORK.
      ELSE.
        CALL FUNCTION 'RPM_DELETE_PROJECT_DATA'
          EXPORTING
            IV_EXTERNAL_ID  = IV_EXTERNAL_ID
            IV_PROJECT_GUID = IV_PROJECT_GUID
          IMPORTING
            EV_RC           = EV_RC
            EV_MSG          = EV_MSG
            ET_MSG          = ET_MSG.
      ENDIF.
    ENDFUNCTION.
    In above code how to capture 'EV_RC' when FM is called as background task.

    Prakash,
    CALL FUNCTION IN BACKGROUND TASK allows no IMPORTING parameters, so that your code will produce a syntax error.
    The calling program can only handle errors of remote function calls (RFC) if these are either
    - synchronous RFC  (that is CALL FUNCTION ... DESTINATION ...) or
    - asynchronous RFC (that is CALL FUNCTION STARTING NEW TASK ... DESTINATION ...).
    Both synchronous and asynchronous RFC allow the capturing of errors by means of exceptions. But that is a different topic.

  • Function module is not working properly in background

    Hi  all,
    i have used one Function module 'PRICING' in user exit SAPMV45A to calculate pricing for sales order.
    i am using BAPI_SALESORDER_CHANGE to change the sales order pricing.
            when i run the program in foreground, all condition records for pricing is updated correctly. but it is not updating
    correctly when i run the program in background.
       Please tell me wheather 'PRICING'  or  'BAPI_SALESORDER_CHANGE'  function module is not working properly in background ?
       or any other reason?
    Thanks
    babu

    Hi Pabitra,
    Can you provide some more information as to the type of error you are getting? Or can you check the log entries and give some more information so that it would be possible to provide a solution.
    And, try to put questions in proper Forum for quick and prompt reply.
    Hope this helps.
    Thanks,
    Samantak.

  • Use of function called "in background task"

    Hi folks!
    In my company there are rumors that a function called "in background task" can be used to make sure that all database changes of previous statements are already persisted. This would mean that a function called "in background task" can be used to read data from database that has been written by the same report - in any case (update dispatching over several instances,...). Usually this won't be a good idea (we know well about SAPs update concepts and read everything about it on help.sap.com). Has anybody some experiences about this or is there even a guru, able to explain why it will always work (or not)? We don't have evidence that the database has finished writing for sure when the function starts - that's why I'm worried.
    Example:
    REPORT test.
    INSERT something to database.
    CALL FUNCTION function in background task.
    End of the report
    Will it always work (when testing, it does)?
    Any help will be appreciated!
    Greetings

    Hi,
    Logically it is correct. BACKGROUND TASK Triggers an asynchronous process. This FM is executed in multiple steps.
    In first step system save the data passed to FM interface to buffer. When ever program encounters Explicit/implicit commit, the source code of the FM is processed.
    Note: You can't get back the data from this FM call.
    Check the F1 help on call function statement. You will get much more details.
    Thanks,
    Vinod.

  • Function called IN BACKGROUND TASK goes to work process DIA, not BGD

    I'm calling a function IN BACKGROUND TASK
    In SM50, I see it running in a DIA work process.
    I want it to run in a BGD work process.
    Can this be done?  If so, how?  If not, why not?

    Hi...
    It looks like, it will always run in DIA process and not Background process...I am not sure that we can change the work process
    Check the below link..
    http://help.sap.com/saphelp_40b/helpdata/pt/69/c24f864ba111d189750000e8322d00/content.htm
    What is written in the link is...
    "Background updates (CALL FUNCTION IN BACKGROUND TASK) represent a variant of remote function call that is synchronous with the end of a transaction (COMMIT WORK). In background updating, an update is run in another dialog work process that may be in the same or in another application server and R/3 System. Because such updates run in their own LUWs, they may start only after all critical updates have been completed. Otherwise, it would not be possible to roll back background changes in the event of an error in another update component. "
    IF you get the answer of whether we can change the work process then please let us know...

  • How can I see if a function has been called in background task?

    I tried to see sy-batch, but it doesn't work.
    thanks
    Gabriele

    Try calling function module ID_OF_BACKGROUNDTASK.
    DATA: lv_tid type ARFCTID.
    CALL FUNCTION 'ID_OF_BACKGROUNDTASK'
       IMPORTING
         tid = lv_tid.
    IF lv_tid IS NOT INITIAL.
    * This was called with CALL FUNCTION ... IN BACKGRUND TASK.
    ELSE.
    ENDIF.

  • FM_NAME function module not able to call

    Hi Friends,
    as I am creating new adobe form but every thing is fine but I am unable to call FM_NAME(call the generated function module) function module ...
    can u suggest me the correct reason..
    regards
    rahul

    Hi,
    Please check the below code.
    DATA: fm_name           TYPE rs38l_fnam.      " Name of Function Module
    CALL FUNCTION 'FP_JOB_OPEN'                 
      CHANGING
        ie_outputparams = fp_outputparams
      EXCEPTIONS
        cancel          = 1
        usage_error     = 2
        system_error    = 3
        internal_error  = 4
        OTHERS          = 5.
    IF sy-subrc <> 0.
    ENDIF.
    CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'           " Form Processing Generation
      EXPORTING
        i_name     = 'ZADOBEFORM'
      IMPORTING
        e_funcname = fm_name.
    IF sy-subrc <> 0.
    ENDIF.
    CALL FUNCTION fm_name
      EXPORTING
        /1bcdwb/docparams        = fp_docparams
        zmari                   = it_mari
    *    IMPORTING
    *     /1BCDWB/FORMOUTPUT       =
      EXCEPTIONS
        usage_error           = 1
        system_error          = 2
        internal_error           = 3.
    IF sy-subrc <> 0.
    ENDIF.
    CALL FUNCTION 'FP_JOB_CLOSE'
    *    IMPORTING
    *     E_RESULT             =
      EXCEPTIONS
        usage_error           = 1
        system_error          = 2
        internal_error        = 3
        OTHERS               = 4.
    IF sy-subrc <> 0.
    ENDIF.
    Hope this helps.
    Regards,
    Sagar

  • How to create RFC function module and how to call this function module

    Hi,
    i want to know step for creating RFC function module and then How to  use this function module from some other sap system.
    Thnaks,
    jigar

    Jigar,
    To implement a remote function module in ABAP, perform the following steps:
    Register the module as remotely callable in the RFC server system.
    In the function module Administration screen (transaction code SE37), set the field Can be called via REMOTE CALL. Registering a module as remote causes an RFC stub to be generated for it.
    Write the code for the function module.
    Create the destinations.....................
    Displaying, Maintaining and Testing Destinations
    To display, create or modify destinations, choose Tools ® Administration ® Administration ® Network ® RFC destinations or enter transaction code SM59.
    Remote Destinations are stored in table RFCDES. The RFCDES table describes logical destinations for remote function calls.
    It is not possible to maintain the RFCDES table directly.
    You can also access logical destinations via the Implementation Guide (IMG) by choosing Tools ® AcceleratedSAP ® Customizing ® Execute Project ® SAP Reference IMG.
    In the Implementation Guide, expand the following hierarchy structure:
    Basis
    Application Link Enabling (ALE)
    Sending and Receiving Systems
    Systems in Network
    Define Target Systems for RFC Calls
    Displaying Destinations
    The initial screen for this transaction displays a tree:
    Different connection types (i.e. partner systems or programs) are possible. For further information, see Types of Destinations.
    To display all information for a given destination, double-click it, or place the cursor on it and press F2 .
    To search for a destination, press the Find button and specify your selection. You get a list of all entries matching your selection. Place the cursor on the one you want, and press F2 or simply double-click the destination. All information for the given entry appears.
    Creating Destinations
    On the destinations overview screen (transaction code SM59), the connection types and all existing destinations are displayed in a tree structure.
    All available connection types are explained in Types of Destinations.
    To create a new RFC destination, press the Create button. A new screen is displayed with empty fields for you to fill in.
    If you want to create a new destination
    As you create a remote destination, you can specify a particular application server or a group of servers for a balanced distribution of system load.
    For details of the destination parameters, see Entering Destination Parameters.
    Changing Existing Destinations
    On the destinations overview screen (transaction code SM59), the connection types and all existing destinations are displayed in a tree structure.
    You can display all information for a given destination by double-clicking it or pressing F2 on it.
    To change an existing destination, double-click it, or place the cursor on it and press the Change button.
    For details of the destination parameters, see Entering Destination Parameters.
    Testing Destinations
    To test a destination, choose the appropriate function from the Test menu.
    Connection (also available via the Test connection pushbutton)
    Authorization (checks logon data)
    Local network (provides a list of application servers)
    You can use the CALL FUNCTION statement to call remote functions, just as you would call local function modules. However, you must include an additional DESTINATION clause to define where the function should run:
    CALL FUNCTION RemoteFunction
    DESTINATION Dest
    EXPORTING
    f1 =...
    f2 =...
    IMPORTING
    f3 =...
    TABLES
    t1 =...
    EXCEPTIONS......
    The field Dest can be either a literal or a variable: its value is a logical destination (for example, "hw1071_53") known to the local SAP System. Logical destinations are defined in the RFCDES table (or the TRFCD table in R/2 Systems) via transaction sm59 or the following menu path: Tools ® Administration, Administration ® Network ® RFC destinations. You can also access logical destinations via the Implementation Guide (IMG) by choosing Tools ® Customizing ® Enterprise IMG. In the Implementation Guide, you can then choose Cross-application components ® ALE ® Communication ® Define RFC destination.
    The remote function call concept, for example, allows you to access a function module in an R/2 System from an ABAP program in an R/3 System. If you want to read a customer record from your R/2 System’s database, create a remotely callable function module in the R/2 environment which retrieves customer records. Call this function from your R/3 System using a remote function call and listing the destination for the target R/2 System:
    Pls. reward if useful

  • RFC Function Module behaves differently in foreground and background

    Hi,
    I have RFC function module which works well when executed in debugg mode where as in normal mode it doesnt work as the time stamp is not changed and the record cannot be created with the same timestamp.
    Can anybody suggest any solution on how to change the current timestamp when still in the same LUW.
    Regards,
    Roberts.

    Hi,
    Use:
    T1 = SY-UZEIT.
    GET TIME.
    T2 = SY-UZEIT.
    T1 will be different from T2
    Best regards,
    Leandro Mengue

  • HR TEM - Function Module  to Replace Attendee in the Background

    Hi Experts,
    We are on SAP 4.7.
    We have a requirement to automate the Replace Attendee process(T code PV03) in TEM.
    I need to ask, if there is any standard function module or BAPI like we have for Booking (BAPI_BOOK_ATTENDANCE) and for pre booking (BAPI_PREBOOK_ATTENDANCE) ?
    i've checked the function Module RH_PARTICIPATION_REPLACE but it requires screen input and works in foreground.
    If any one has any idea abou the function module or any other way to achieve this, the suggestion is highly appreciated.
    Appreciate your help!
    Thanks!
    Regards,
    Gurdip

    Copied the Function Module RH_PARTICIPATION_REPLACE  and created Z function module and suppressed the scrrens .
    Its working fine.
    Thanks

  • RFC enabled function module which will be called from XI

    Hi Abappers,
    I have to send confirmation of the sales orders created by inbound Idocs ORDERS05 to XI. For this I have to use outbound Idoc ALEAUD01. But since I also need to send NETWR(from VBAK) and there is no field in this Idoc for that,
    I have to develop an RFC enabled function module for which a RFC lookup will be performed from XI. This function module has to return NETWR values for sales orders. Can anyone please tell me how to go about with this function module.
    Thanks in advance.

    Hi Priyanka,
    Add a parameter in <b>tables tab</b> of function module with reference to NETWR. It'll work.
    Regards,
    Younus
    Reward Helpful Answers!!!!

  • FM call in background task

    Hi,
    I have called a function module in background task. Inside this FM I create application log and put in all the messages in the log which can be viewed using the transaction SLG1. But if the creation of the log fails I want to display the info to the user and exit the FM. I cannot display the info using the Message statement here. I tried to raise an exception, etc. from this FM so that I can process the exception in the calling FM and display a message. But this does not work as the execution of the calling FM and called FM in rfc proceeds simultaneosly. I know I can see the error using transaction sm58 but I am looking for an option wherein I can directly inform the user. Does someone have a suggestion how can proceed with this?
    Thanks.
    Best Regards,
    Pooja

    Hi
    There are two ways for you to handle,
    one manually setting up the job through SM36 which is better and convinient,
    secondly through program using FM's JOB_OPEN, SUBMIT, JOB_CLOSE.
    Find below steps in doing both:
    Procedure 1:
    1. Goto Trans -> SM36
    2. Define a job with the program and variant if any
    3. Click on start condition in application tool bar
    4. In the pop-up window, click on Date/Time
    5. Below you can see a check box "Periodic Job"
    6. Next click on Period Values
    7. Select "Other Period"
    8. Now give '15' for Minutes
    9. Save the job
    In SM37 u can check the status of the jobs that u have assigned to background...
    Here u mention the job name or the report name to check the status of the job...
    After mentioning the job name or program name u just execute it.. ( without any name also u can execute then it gives u all the jobs set by your user name..
    the status colud be released,active,finished etc..
    Procedure 2 via Program:
    Below is a sample code for the same. Note the ZTEMP2 is the program i am scheduling with 15mins frequency.
    DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,
          L_RELEASE(1) TYPE c.
       CALL FUNCTION 'JOB_OPEN'
         EXPORTING
           JOBNAME                = 'ZTEMP2'
        IMPORTING
          JOBCOUNT               = P_JOBCNT
        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.
       SUBMIT ZTEMP2 VIA JOB 'ZTEMP2' NUMBER P_JOBCNT
              TO SAP-SPOOL WITHOUT SPOOL DYNPRO
              WITH DESTINATION = 'HPMISPRT'
              WITH IMMEDIATELY = SPACE
              WITH KEEP_IN_SPOOL = 'X' AND RETURN.
       CALL FUNCTION 'JOB_CLOSE'
         EXPORTING
           JOBCOUNT                          = P_JOBCNT
           JOBNAME                           = 'ZTEMP2'
           STRTIMMED                         = 'X'
           PRDMINS                          = 15
        IMPORTING
          JOB_WAS_RELEASED                  = L_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
          INVALID_TARGET                    = 8
          OTHERS                            = 9.
       IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.
    Hope the above helps you.
    Alternately use CALL FUNCTION func IN BACKGROUND TASK
    Regards,
    Sree

  • Is there any function module to assign Object to Transport request (Task)?

    Hi There,
    My requirement is to assign an object to desired task of the transport request. I found one FM called TR_EXT_INSERT_IN_REQUEST. But it has some limitations.
    Limitations of FM :  TR_EXT_INSERT_IN_REQUEST
    1. It will assign the given object to given Transport request. But not to the task of a transport request. This FM will not allow   assigning objects to the task. It will allow only to request.
    2. Object entry present in transport request table e071. But, I can't find any version in version management. Moreover, the object is not locked under that particular request.
    Can any one let me know, is there any function module to fullfill the requirement without above mentioned limitations?
    Requirement :
    1. Given object should be assigned to given task of TR.
    2. Need FM to activate the Object and object texts.
    3. After assigning to the request, It should show the vesion in version management and object should be locked under particular Task/ Request.
    Your help would be greatly appreciated and <<removed by moderator>> Thanks in advance.
    Have a nice day!!
    Thanks and Regards,
    Neelima. D
    Edited by: kishan P on Jan 5, 2012 2:21 PM

    @ Dear Nabheet & Karuna
    The object is not in local folder. I am aware of the process of assigning the object to request manually.
    I want that to be done automatically. I wont prefer writing BDC for this.
    @ Dear Keshav,
    Thank you for the function module. But TR_INSERT_REQUEST_WITH_TASKS will create a tarnsport request with tasks.
    @ Dear All,
    My requirement is to assign the object to Task automatically. Not creating the request or Task. Task & Request are
    present already.

  • BAPI CALL IN BACKGROUND TASK

    Hi,
    We have a sales order workflow for exceptional demand.
    In one of the steps of the workflow,the corresponding task executes in background.
    Sales Order Change BAPI is called within this task.
    Now the problem is that in case the sales order is locked for execution by some other user, the BAPI call returns a message of type 'E'.
    Currently we send a mail to the concerned people to indicate that the sales order change has failed. However the users are concerned, since there is no immediate feeback on the errors.
    Is there any way that the user's can be informed instantly that an error has occured and also a retry option so that the BAPI call can be reexecuted at a later time.
    Regards,
    Jitender

    You can do this in two ways
    1. Put the BAPI call after a WHILE loop, that always checks for SY-SUBRC and within it you call the FM to lock the order
    OR
    2. Do this in workflow by using the return message type E to start the same task with some delay, say 30 mins or so...
    Good Luck
    Ravi

  • How to pass select option value to function module while using service call

    Hi,
    I have select-option in my WD application. To collect data based on user input im using service call. How to pass this select option values to my RFC.
    rgds
    sudhanshu

    Hi,
    Thank s for your reply. In fact im doing similar with following variation:
    i) collected range values using get_range* method.
    ii) separate low and high values as: 
    read table <field2> index 1 into wa_range.
    vert2_low = wa_range-low.
    vert2_high = wa_range-high.
    (Please note that in RFC I have taken two importing parameter as s_vert_lo and s_vert_hi)
    iii) Now setting these RFC attribute as:
    lo_el_importing->set_attribute(
        EXPORTING
          name =  `S_VERT_LO`
          value = vert2_low ).
    and
    lo_el_importing->set_attribute(
        EXPORTING
          name =  `S_VERT_HI`
          value = vert2_high ).
    iv) In RFC im having my query as :
    select <fld list> from BUT000 into table itab where vertical in r_vert.
    Here, r_vert is a range defined as:
    ranges r_vert for <fld refrence>
    r_vert-sign = 'I'.
    r_vert-option = 'BT'.
    r_vert-low = S_VERT_LO.
    r_vert-high = S_VERT_HI.
    append r_vert.
    Issue here is with ranges. if im passing both low and high values it is fine but if only low value being passed it is not giving me any record.
    Please suggest.
    Rgds
    Sudhanshu

Maybe you are looking for

  • How do I get back my phoneshortcut onto my homepage?

    I accidentally deleted my phone short cut key on my homepage and cant seem to find the phone shortcut to drag onto my home page Can any one please help?

  • Which casing would you choose???

    Hi all, I'm thinkin of gettin a casing for my 3rd gen nano. After browsin' through the Apple store, found 2 which I really like: Belkin Remix Acrylic Case and the Belkin leather folio. Here are the links for yoou guys to have a look: http://store.app

  • How do you change print quality for eprinting?

    HP Photosmart 5515 OS installed XP The driver does not give this option. I like to do Fast Draft sometimes.

  • Can't Restore IPod message: "can't mount ipod"

    when i try to restore my ipod, theres a message that says "can't mount iPod" is there any way i can restore it? your help is greatly appreciated.

  • Archivelink u2013 System refresh

    We are planning to refresh our SAP R/3 QA system with a copy of our PRD. For both systems we have a content server installed which are used for HR pictures etc but the links a created as archivelinks in R/3. Do we need to do some kind of post activit