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.

Similar Messages

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

  • NO Authorization error when accessing Functional module RH_CUT_OBJECT

    Hi,
    I am getting NO AUTHORIZATIOn error when I am executing SE37-->FUNCTIONAL OBJECT-RH_CUT_OBJECT.
    I also checked SU53 screenshot which says AUTHORIZATION CHECK SUCCESSFUL and there are no errors or missing authorizations highlighted in SU53.
    I switched on the TRACE-ST01 then also the error is not captured.
    I would like to know WHY am I getting NO AUTHORIZATION error.
    I am already having access to T-CODE SE37, SE11, SE80, SMARTFORMS and authorization object S_DEVELOP.
    I need to know this ASAP on why I am getting NO AUTHORIZATION error when I am trying to access the FUNCTIONAL MODULE RH_CUT_OBJECT whereas I am having all the required authorization required for ABAP Developer including SE37.
    Is it something I need change at ABAP code level.
    Please advise ASAP.

    The reason is ..You do not have acess to see/acess the data this FM is trying to acess ...Debug the function module keep a breakpoint at The Raise statement see which authorization you do not have ....BTW this is my guess you are trying to demilit certain objects /infotypes using this FM and delimit basically makes that object non-usable in that system  .So it is quite evident that every one will not have authorization for that .Please post in detail that what is it that you are trying to achieve using this function module .....
    Also you can check with debugging  which authority object is being checked before raising the message and can ask security team to get that added to your profile ....
    Thanks,
    Anjaneya

  • Runtime error when testing function module 'RSWR_RFC_SERVICE_TEST'

    Hi,
    I'am integrating BIW 3.5 with EP 6.0 according to the report 'RSPOR_SETUP'.I've carried all the steps,but an error on step 12 : system failure during call of function module 'RSWR_RFC_SERVICE_TEST' is there .When I test the connection with function module 'RSWR_RFC_SERVICE_TEST', a runtime error is coming i.e. "<--Localization failed: ResourceBundle='com.sap.engine.services.rfcengine.RFCR'.
    Any help would be highly appreciated.
    Regards.
    Manoj

    Hi Manoj,
    From this I can understand that a critical resource is missing which is required to start the RFC service in Reporting Services Web Runtime. This might be because of incomplete patch deployment. Deploy all the required software component archives related to com.sap.engine.services component and then retry this... I think this should solve the issue.
    Imran...

  • How is TKOMK filled when entering function module RV_INVOICE_DOCUMENT_ADD

    Hello,
    I am debugging the Invoice program, SAPMV60A, and the table I am interested in is TKOMK. When I am in MV60AF0B_BELEG_SICHERN TKOMK is empty but when I enter function module RV_INVOICE_DOCUMENT_ADD TKOMK is already filled, and I can't see how.
    Can anyone tell me where the information comes from?

    Hi
    FM RV_INVOICE_DOCUMENT_ADD  belongs to function group V60A, both programs SAPMV60A and SAPLV60A have an internal table called TKOMK, so I think another fm of V60A fills the table TKOMK and so you can see it as soon you enter in a fm of V60A.
    Max

  • How to write the exceptions in function module

    dear all,
         how to write the exceptions in function modules with example.
    thanq
    jyothi

    Hi,
    Raising Exceptions
    There are two ABAP statements for raising exceptions. They can only be used in function modules:
    RAISE except.
    und
    MESSAGE.....RAISING except.
    The effect of these statements depends on whether the calling program handles the exception or not. The calling program handles an exception If the name of the except exception or OTHERS is specified after the EXCEPTION option of the CALL FUNCTION statement.
    If the calling program does not handle the exception
    · The RAISEstatement terminates the program and switches to debugging mode.
    · The MESSAGE..... RAISING statement displays the specified message. Processing is continued in relation to the message type.
    If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE..... RAISING statement does not display a message. Instead, it fills the system fields sy-msgid, sy-msgty, sy-msgno , and SY-MSGV1 to SY-MSGV4.
    Source Code of READ_SPFLI_INTO_TABLE
    The entire source code of READ_SPFLI_INTO_TABLE looks like this:
    FUNCTION read_spfli_into_table.
    ""Local Interface:
    *" IMPORTING
    *" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
    *" EXPORTING
    *" VALUE(ITAB) TYPE SPFLI_TAB
    *" EXCEPTIONS
    *" NOT_FOUND
    SELECT * FROM spfli INTO TABLE itab WHERE carrid = id.
    IF sy-subrc NE 0.
    MESSAGE e007(at) RAISING not_found.
    ENDIF.
    ENDFUNCTION.
    The function module reads all of the data from the database table SPFLI where the key field CARRID is equal to the import parameter ID and places the entries that it finds into the internal table spfli_tab. If it cannot find any entries, the exception NOT_FOUND is triggered with MESSAGE ... RAISING. Otherwise, the table is passed to the caller as an exporting parameter.
    Calling READ_SPFLI_INTO_TABLE
    The following program calls the function module READ_SPFLI_INTO_TABLE:
    REPORT demo_mod_tech_fb_read_spfli.
    PARAMETERS carrier TYPE s_carr_id.
    DATA: jtab TYPE spfli_tab,
    wa LIKE LINE OF jtab.
    CALL FUNCTION 'READ_SPFLI_INTO_TABLE'
    EXPORTING
    id = carrier
    IMPORTING
    itab = jtab
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    CASE sy-subrc.
    WHEN 1.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
    WHEN 2.
    MESSAGE e702(at).
    ENDCASE.
    LOOP AT jtab INTO wa.
    WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
    ENDLOOP.
    The actual parameters carrier and jtab have the same data types as their corresponding interface parameters in the function module. The exception NOT_FOUND is handled in the program. It displays the same message that the function module would have displayed had it handled the error.
    Or
    just have to decide what exceptions u want and under what conditions.
    then declarethese exeptions under the exceptions tab.
    in the source code of ur function module.
    if
    like this u can code .
    now when u call the function module in tme mainprogram.
    if some error occurs and u have declared a exception for this then it will set sy-subrc = value u give inthe call of this fm.
    in the fm u can program these sy-subrc values and trigger the code for ur exception.
    Please reward if useful
    Regards,
    Ravi
    Edited by: Ravikanth Alapati on Mar 27, 2008 9:36 AM

  • There seems to be an error in the function module OPEN_FORM obstructing the

    Hi,
    There seems to be an error in the function module OPEN_FORM obstructing the process.
    Some vendors are not cabaple of usinf EDI and for some reason also not willing to use TTOOL solutions (example Hewlet Packard). In those cases the supplier still would like to get purchase order electronically via e-mail. Sending POu2019s via external mail (SMTP) is basically standard function in R/3 that has been possible since the version 4.5. It is not pre-configured, so (almost) all the required elements needs to be configured.
    When we send the output message through ME9F t'code i facing the problem in the above FM.
    Please help me how to solve this.
    Vijay

    Got you, the digital display for Cupertino and Frankfurt are wrong too.
    Submit feedback:
    http://www.apple.com/feedback/iphone.html

  • How to make use of SE37- Function Module & how to find out the table?

    Hi ,
    1.Could anyone help me what's this SE37-Function module is all about,How to make use of this?
    For Eg,If i want to delete a BOM permanently from the system then I have to use the Function module CM_DB_DEL_FROM_ROOT_BOM.
    But after giving the particular name what should i do?
    Please help me.
    2.How to find out the respective table for a particular field sya for T code-COGI, T code MFBF,where its values are getting populated.,Please help in this issue.
    Thanks in adavnce for spending some time
    Raj.S

    Hi Raj
    Function Modules
    Function modules are procedures that are defined in special ABAP programs only, so-called function groups, but can be called from all ABAP programs. Function groups act as containers for function modules that logically belong together. You create function groups and function modules in the ABAP Workbench using the Function Builder.
    Function modules allow you to encapsulate and reuse global functions in the SAP System. They are managed in a central function library. The SAP System contains several predefined functions modules that can be called from any ABAP program. Function modules also play an important role during updating  and in interaction between different SAP systems, or between SAP systems and remote systems through remote communications.
    Unlike subroutines, you do not define function modules in the source code of your program. Instead, you use the Function Builder. The actual ABAP interface definition remains hidden from the programmer. You can define the input parameters of a function module as optional. You can also assign default values to them. Function modules also support exception handling. This allows you to catch certain errors while the function module is running. You can test function modules without having to include them in a program using the Function Builder.
    The Function Builder  also has a release process for function modules. This ensures that incompatible changes cannot be made to any function modules that have already been released. This applies particularly to the interface. Programs that use a released function module will not cease to work if the function module is changed.
    Check this link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
    You can execute function module in SE37ie you can perform the activiites defined in the function module by executing it.
    By deleting BOM you mention the FM name in se37 and execute. In some function module it will ask input parameters as developed in the program , you have to give the input parameters and execute.

  • How to import a range in Function module?

    I am using a Function module in which material is getting imported.
    In the import tab we have
    Parameter Name    Typing     Associated Type       optional          pass value
    IM_MATERIAL       TYPE       MATNR                 <checked>         <checked>
    So when the Function module is execute we can enter only one value into the IM_MATERIAL.
    But now it has to be enhanced for entering multiple values. How to import the material as a range?
    Please throw light.
    Thanks.

    Hi
    If you are using a select-options you can use this approach.
    TABLES: MARA.
    DATA: RANGE TYPE WRF_MATNR_RANG_TTY.
    SELECT-OPTIONS: SO_MATNR FOR MARA-MATNR.
    START-OF-SELECTION.
      RANGE[] = SO_MATNR[].
    CALL FUNCTION 'ZTEST'
    EXPORTING
       I_RANGE       = RANGE.
    Where I_RANGE is defined using this table type WRF_MATNR_RANG_TTY
    Parameter Name    Typing     Associated Type     optional          pass value
    I_RANGE       TYPE       WRF_MATNR_RANG_TTY      <checked>     <checked>

  • Getting error in the function module

    Hi everybody.
    I have created one function module in se37 and i am calling that function module in the se38 report, when i am executing the report it is throwing me an error.
    here in my report i am having the select option fields ex matnr, in the function module importing i have given the parameter matnr over there and when i am running the report it is through an error that 
    "The function module interface allows you to specify only 
    fields of a particular type under "MATNR".               
    The field "S_MATNR" specified here is a different        
    field type                                                "
    IF i am giving the parameter instead of select-options in the report and executing, then the function module is getting triggered and receiving the data what ever the code is available in the source code.
    can anyone help me out in this issue so that i can get the data while using the select-option instead of parameter.
    Thanks in advance

    Hi,
    Actually, I wouldn't recommend the use of that tables parameter...
    From sap help:
    Table parameters are obsolete CHANGING parameters that are typed as standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to a formal parameter of this type, an empty local header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. Pass by value is not possible in formal parameters defined using TABLES. Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created for the internal table in the function module by using the addition LIKE LINE OF itab of the DATA statement.
    Exceptions
    So i definitely would go with either importing or changing parameter...
    Cheers,
    m.

  • How to capture errors records in flat file in BDC

    hi ,
        i would like to know how to capture error records while  uploading a flat file to screen through BDC .
    appreciatable solutions are rewarded.
    thanks,
    shan

    Hi shan,
    write this code, it will solve your problem.
    DATA : BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    DATA : I_MSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF I_ERR OCCURS 0,
              MATNR(18),
              FLAG(1),
              MSG(100),
           END OF I_ERR.
    DATA :V_LINES TYPE I.
    LOOP AT ITAB.
    REFRESH BDCTAB.
    PERFORM SCREEN USING: 'SAPLMGMM' '0060'.
    PERFORM FIELD USING: 'RMMG1-MATNR'  ITAB-MATNR,
                          'RMMG1-MBRSH' ITAB-MBRSH ,
                          'RMMG1-MTART' ITAB-MTART,
                          'BDC_OKCODE' '/00'.
    PERFORM SCREEN USING: 'SAPLMGMM' '0070'.
    PERFORM FIELD USING: 'MSICHTAUSW-KZSEL(01)' 'X' ,
                         'MSICHTAUSW-KZSEL(02)' 'X' ,
                         'MSICHTAUSW-KZSEL(09)' 'X' ,
                         'BDC_OKCODE' '=ENTR'.
    PERFORM SCREEN USING: 'SAPLMGMM' '0080'.
    PERFORM FIELD USING: 'RMMG1-WERKS' ITAB-WERKS,
                         'BDC_OKCODE' '=ENTR'.
    PERFORM SCREEN USING: 'SAPLMGMM' '4004'.
    PERFORM FIELD USING:  'MAKT-MAKTX' ITAB-MAKTX,
                          'MARA-MEINS' 'EA' ,
                          'MARA-MATKL' '001',
                          'BDC_OKCODE' '/00'.
    PERFORM SCREEN USING: 'SAPLMGMM' '4004'.
    PERFORM FIELD USING:  'BDC_OKCODE' '/00'.
    PERFORM SCREEN USING: 'SAPLMGMM' '4000'.
    PERFORM FIELD USING:  'MAKT-MAKTX' ITAB-MAKTX,
                          'MARA-MEINS' 'EA',
                          'MARC-EKGRP' '001',
                          'MARA-MATKL' '001',
                          'BDC_OKCODE' '=BU'.
    CALL TRANSACTION 'MM01' USING BDCTAB
                            MODE 'A'
                            MESSAGES INTO I_MSG.
    FINDING LAST MESSAGE IN THE I_MSG TABLE*****
    DESCRIBE TABLE I_MSG LINES V_LINES.
    ACCORDING TO THE V_LINES NUMBER TABLE WILL BE READ****
    READ TABLE I_MSG INDEX V_LINES.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
       ID              = I_MSG-MSGID
       LANG            = '-D'
       NO              = I_MSG-MSGNR
       V1              = I_MSG-MSGV1
       V2              = I_MSG-MSGV2
       V3              = I_MSG-MSGV3
       V4              = I_MSG-MSGV4
    IMPORTING
       MSG             = I_ERR-MSG
    EXCEPTIONS
       NOT_FOUND       = 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.
    IF I_MSG-MSGID EQ 'M3' AND I_MSG-MSGNR EQ '800'.
    I_ERR-FLAG = 'S'.
    ELSE.
    I_ERR-FLAG = 'E'.
    ENDIF.
    I_ERR-MATNR = ITAB-MATNR.
    APPEND I_ERR.
    CLEAR I_ERR.
    ENDLOOP.
    WRITE:/ 'SUCCESS RECORDS' COLOR COL_POSITIVE.
    SKIP.
    WRITE:/ 'MATERIAL' COLOR COL_HEADING, 20 'MESSAGE' COLOR COL_HEADING.
    LOOP AT I_ERR WHERE FLAG EQ 'S'.
    WRITE:/ I_ERR-MATNR, 20 I_ERR-MSG.
    ENDLOOP.
    SKIP 2.
    WRITE:/ 'ERROR RECORDS' COLOR COL_NEGATIVE.
    SKIP.
    WRITE:/ 'MATERIAL' COLOR COL_HEADING, 20 'MESSAGE' COLOR COL_HEADING.
    LOOP AT I_ERR WHERE FLAG EQ 'E'.
    WRITE:/ I_ERR-MATNR, 20 I_ERR-MSG.
    ENDLOOP.
    *&      Form  SCREEN
         SCREEN
    form SCREEN  using P_PROG P_SCREEN.
    BDCTAB-PROGRAM = P_PROG.
    BDCTAB-DYNPRO = P_SCREEN.
    BDCTAB-DYNBEGIN = 'X'.
    APPEND BDCTAB.
    CLEAR  BDCTAB.
    endform.                    " SCREEN
    *&      Form  FIELD
       FIELD
    form FIELD  using  FNAME FVAL .
    BDCTAB-FNAM = FNAME.
    BDCTAB-FVAL = FVAL.
    APPEND BDCTAB.
    CLEAR BDCTAB.
    endform.                    " FIELD
    Thanks,
    Murali

  • Error Error 6 in function module RSS_PROGRAM_GENERATE

    Hello Experts,
    When I attempt to run the extract checker for datasource, 0material_LPRH_HIER I receive the following error: Error 6 in function module RSS_PROGRAM_GENERATE.
    I referred to the oss notes 328948. But the note is addressing to lower versions of R/3.
    I am working on ECC 6.0 and no way that note is helpful to me. I did check for the previous posts addressing this issue and i said already those posts refer to the older version of R/3.
    I did check for the previous post and all are addressing to the lower version of release.
    KK

    This is the reply I got from SAP:
    The error error 6 RSS_PROGRAM_GENERATE is more related to Hierarchy .
    Are you creating a hierarchy data source if so you need to use
    RSA1HCAT report .But normally you will not get any errors when you
    create the data source by your own .
    705212--> Syntax error in the generated extraction program
    Please use the program RSA1HCAT in SE38 to check your hierarchy.

  • Error message for function module

    I have created a custom function module. I have activated it. But when i'm trying to use it in a program it is showing an error. The function module has 'TABLES' but it is showing error as:
    "field "TABLES" is unknown. It is neither in one of the specified tables nor defined by a DATA statement".
    Please help me!!
    Thank you.

    Hello Titan,
    Generally you get these kind of syntax errors when there is some problem with the format of the program. Please recheck the format of the program in which you are calling the newly created function module. Please check if there are any erroneous '.' or ',' in the program before the 'Tables' partameter of the function module.
    Please verify the same.
    Regards,
    Pavan

  • How to use Logical database in function module?

    I will create a function module in HR.
    but how to use Logical database  in function module ?  Logical database PNP always show screen.in function (RFC) code , it is a matter.

    You cannot attach the LDB to the main program of the function group.
    - So you may [SUBMIT|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=submit&adv=false&sortby=cm_rnd_rankvalue] a report which use the LDB and get back the data (export/import), by default in the syntax of SUBMIT the selection-screen will not be displayed
    - Use [LDB_PROCESS|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=ldb_process&cat=sdn_all], fill a structured table for selection, and get data back in another table
    - Use [HR function modules to read Infotypes|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=hrfunctionmodulestoread+Infotypes&adv=false&sortby=cm_rnd_rankvalue].
    Regards

  • How to find out the inbound function module in the extended idoc

    Hi,
    how to find out the inbound function module in the extended idocs
    Thanks .

    through we41/we42 you can find the inbound function module.......
    or
    thorough we19(idoc test tool) ....
    give the input as message type or basic idoc..
    press exec...
    then you can find th button on application tool bar as inbound funtion module....
    from here also you can find..........
    <REMOVED BY MODERATOR>
    Khasimsa
    Edited by: Alvaro Tejada Galindo on Apr 14, 2008 1:34 PM

Maybe you are looking for

  • Expdp failed job disappear

    Hi all, I am testing the expdp on attach job in 10.2R3 1. expdp job and ^C to stop it C:\TEMP>expdp system/oracle directory=testdir dumpfile=test5.dmp logfile=test5.log full=y job_name=expjob . . exported "SCOTT"."DEPT" 5.656 KB 4 rows . . exported "

  • ITunes 7.0.2 doesn't install, iTunes store is strange, and more...

    Clicking "Support" brings me to the Japanese apple web site. When I try to install 7.0.2 I get this message: This installation cannot directly upgrade the version of iPod software found on this computer. Please uninstall the iPod software and try aga

  • "HadrLogCapture" messages in SQL Server Log

    HI  After activating  AlwaysOn High Availibility Groups in SQL Server 2012 R2 and adding databases at the availibilitygroup, SQL Server  started genereting lots of messages in the SQL Server Logs.  Some example Messages are: "DbId (1466) log capture

  • Friends, Link for Java Material, Practice Test......

    Hi friends, One of my friend has suggest me this below site for Online Learning, Practice Test, etc.. Please visit this site and register your self there www.elearnonnet.com Registration is free of charges. You can get lots of free materials like Ora

  • E75 Mail and Destinations

    Hello, Does anyone know how to set up Mail to use Destinations? Can't see it anywhere, I have to keep selecting WIFI at home and 3G out. I don't get any signal in my house. Cheers, Keiran.