Handling 2 messages in a function module

Hi ,
I have a requirement where I need to trigger 2 messages if sy-subrc fails in a Function Module.
     Function module                              GET_JOB_RUNTIME_INFO
     IMPORTING
     JOB名(JOBNAME)=          P_WK_JOBNM
     Error(SY-SUBRC <> 0)
     Result message output
     (EN) Total : &1, Success : &2, Error : &3
     Type: u2019Su2019
     &1:u20190u2019      &2:u20190u2019     &3:u20190u2019
     Perform error handling(->Error Handling:030)
Error Handling 30:  Error Handling as ABEND
Show message (message type u2018Eu2019)
(EN)Error was found in function module. Function module: &1 Returned value: &2 &3
&1:'GET_JOB_RUNTIME_INFO'
&2: Exception No
I have written the code in the following way.
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
  EVENTID                       =
  EVENTPARM                     =
  EXTERNAL_PROGRAM_ACTIVE       =
  JOBCOUNT                      =
   JOBNAME                       = l_job_name
  STEPCOUNT                     =
EXCEPTIONS
   NO_RUNTIME_INFO               = 1
   OTHERS                        = 2
IF sy-subrc <> 0.
message s010(zmm)  with c_zero c_zero c_zero.
message e001(zmm) display like 'A'.
ENDIF.
But the above code is not working fine.  Only the second message ie [message e001(zmm) display like 'A' ] is being displayed.
In debugging mode the cursor is passing to the first message but still it is not being displayed.
Can any one help me in solving this problem
Thanks in advance,
Indira

check this sample code
here gt_return is of type bapiret2_t
    MOVE <fs_bank_details>-bankkey TO gv_msg_par1.
    MOVE <fs_bank_details>-bankname TO gv_msg_par2.
    PERFORM fm_format_message USING gc_msgno083
                                    gc_e.
FORM fm_format_message  USING    pv_msgno TYPE sy-msgno
                                 pv_type TYPE bapi_mtype.
  DATA:ls_return TYPE bapiret2.
  CLEAR: ls_return.
  CALL FUNCTION 'BALW_BAPIRETURN_GET2'
    EXPORTING
      type   = pv_type   "Message type
      cl     = gc_bp     "Message class
      number = pv_msgno  "Message No
      par1   = gv_msg_par1 "value for place holder1
      par2   = gv_msg_par2 "value for place holder2
    IMPORTING
      return = ls_return.
  IF ls_return IS NOT INITIAL.
    APPEND ls_return TO gt_return.
  ENDIF.
ENDFORM.                    " FM_FORMAT_MESSAGE

Similar Messages

  • Create generic component to handle errors after using the function modules

    Hi,
    Please provide steps to create a generic component to handle the BAPI Return structure meesages after the function calls..
    Please let me know how to pass the structure or internal table from one component to other.
    Thanks in Advance,
    SV
    Moderator Message: No Step-by-steps will be provided here. Either take a classroom course or search for SAP Documentation
    Edited by: kishan P on Dec 10, 2010 3:14 PM

    Hi Hari,
    Plz give me ur mail id.. i will forward some documents regarding Generic Extraction using FM  and query...
    For function module means.. you have to  create function module. in RSAX..in R/3 side
    and you want to extract data using Query means...you have to create Infoset query in (SQ01,SQ02,SQO3) IN r/3 Side
      you can refer this blog also..
    to Function module "RSAX_BIW_GET_DATA_SIMPLE" and there is very good weblog . Search "generic extraction" for weblog. /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    thanks
    @jay

  • Suppressing Messages Generated by Function Modules

    Hello,
    Is there a way to suppress a message generated from within a function module even though the function module doesn't raise an exception to be handled?
    I am calling L_TO_CREATE_MULTIPLE and it calls another function module that doesn't raise an exception, it just generates a message. I'd like to be able to handle the message rather than have it displayed to the user.
    Thanks for any help anyone could provide.
    Best Regards,
    Brett

    Brett,
    When I tried it in a normal function module (not RFC), I am not able to suppress the "Information" messages. I have a BDC inside the fn module.
    Do you have any idea?
    Thanks for your help,
    Bala

  • SM21 Messages stored in function modules or database tables.

    Hi Everyone,
    Can anyone please inform me where the messages from SM21 are stored, i.e in which function modules or through which data base tables. And how can I retrieve those messages in my ABAP program for a specific error.
    Please respond the earlier the better.
    Thanks,
    Prashant.

    Check with the table.
    T100 Messages
    Regards,
    Maha

  • Exception handling for a standard SAP Function Module - the OO way

    Hello,
    I was wondering what is the correct way to call a standard SAP function module inside a method of global class.
    I want to display the error via the:
    get_text( ) and get_longtext( ) methods.
    I don't want to use the sy-subrc check. Is this possible?
    My example doesn't seem to work...
    See example bellow:
    DATA: ex_object_cx_root TYPE REF TO cx_root,
          ex_text TYPE string,
          ex_text_long TYPE string.
    TRY.
          CALL FUNCTION 'L_TO_CONFIRM'
            EXPORTING
              i_lgnum                        = i_lgnum      " Warehouse number
              i_tanum                        = i_tanum      " Transfer order number
              i_quknz                        = '1'          " '1' - confirm withdrawal only (picking )
              i_commit_work                  = 'X'          " Indicator whether COMMIT WORK in function module
            TABLES
              t_ltap_conf                    = it_ltap_conf " Table of items to be confirmed
            EXCEPTIONS
              to_confirmed                   = 1    " Transfer order already confirmed
              to_doesnt_exist                = 2
              item_confirmed                 = 3
              item_subsystem                 = 4
              to_item_split_not_allowed      = 51
              input_wrong                    = 52
              OTHERS                         = 53.
        CATCH cx_root INTO ex_object_cx_root.
          ex_text = ex_object_cx_root->get_text( ).
          ex_text_long = ex_object_cx_root->get_longtext( ).
          " Error:
          RAISE EXCEPTION TYPE zcx_transfer_order
            EXPORTING textid = zcx_transfer_order=>zcx_transfer_order
                 err_class = 'ZCL_WM_TRANSFER_ORDER'
                 err_method = 'CONFIRM_TO_2STEP_PICKING'
                 err_message_text = ex_text
                 err_message_text_long = ex_text_long.
      ENDTRY.
    Thank you very much in advance

    Hello Marko,
    If i understand correctly you've enclosed the call to the FM 'L_TO_CONFIRM' inside the TRY ... CATCH ... ENDTRY block.
    CATCH cx_root INTO ex_object_cx_root.
          ex_text = ex_object_cx_root->get_text( ).
          ex_text_long = ex_object_cx_root->get_longtext( ).
    You can't do this because the FM 'L_TO_CONFIRM' doesn't propagate OO exceptions!
    Your approach is almost correct, what you've to do is goes like this:
    CALL FUNCTION 'L_TO_CONFIRM'
      EXPORTING
        i_lgnum                        = i_lgnum      " Warehouse number
        i_tanum                        = i_tanum      " Transfer order number
        i_quknz                        = '1'          " '1' - confirm withdrawal only (picking )
        i_commit_work                  = 'X'          " Indicator whether COMMIT WORK in function module
      TABLES
        t_ltap_conf                    = it_ltap_conf " Table of items to be confirmed
      EXCEPTIONS
        to_confirmed                   = 1    " Transfer order already confirmed
        to_doesnt_exist                = 2
        item_confirmed                 = 3
        item_subsystem                 = 4
        to_item_split_not_allowed      = 51
        input_wrong                    = 52
        OTHERS                         = 53.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
              INTO ex_text. "Get the ex_text by this technique & not by CX_ROOT->GET_TEXT()
    ENDIF.
    I'll have to check how to fetch the long text of the message
    BR,
    Suhas

  • Error message when using function module HRIQ_TESTRESULTS_CREATE

    Hi,
    I need your help, I'm trying to use function module HRIQ_TESTRESULTS_CREATE to create external test results, I've used this function before without subscores, now I need to create subscores, but I get the message: "Grading scale UBID applies".
    The test type EXAM_UB_ING has assigned the UBID academic scale, which has a range from 1 to 677. Test type EXAM_UB_ING has 3 subtests (grammar, listening and reading) which also have the UBID academic scale assigned.
    I think this isn't a customizing problem because I can create test results with subscores using the PIQST00 transaction, the error message happens just when using the function module.
    I'm using this import parameters:
    STUDENT:
    PL:           01
    OT:          ST
    OBJID:     Student ID
    TESTRESULTS_HEADER:
    ISSUEDATE                      08.02.2010
    VALIDDATE                      30.04.2010
    TEST_GUID
    TESTEO                         50000269
    TRANSEO                        00000000
    TESTTYPE                       EXAM_UB_ING
    SESSIONID                      T1
    SESSIONYEAR                    2010
    ENTRYDATE                      08.02.2010
    TESTPASSFAIL
    TESTTOTRES                     458
    TESTSCALE_ID
    TOTALPERCENT1                   0,00
    TOTALPERCENT2                   0,00
    ENTRYMODE
    SUBTY
    Table TESTRESULTS_SUBSCORES:
    SUBTESTID            GRAMMAR
    SUBTESTTRES      GRAMMAR
    SUBT                     203
    SUBTESTID            READING
    SUBTESTTRES      READING
    SUBT                     120
    Does anybody know which could be the error? Or any other function module which I can use? (with HRIQ_TESTRESULTS_PROCESS_DATA I get the same error message).
    Thanks in advance!
    Araceli

    Araceli,
      I just noticed. You are populating SUBTESTSCALE_ID in subtest result structure.That's the reason it's throwing this error. it is trying to match Scale ID from test with value in sub test result scale ID.
    Prabhat Singh

  • Get Message ID in Function Module Endpoint

    Hi,
    I need to retrieve the message ID of an incoming web service call that has a remote function module as its endpoint.  This is a direct call to the web service and does not come via PI.  I have tried the following code with no success:
      data:  lo_server_context type ref to if_ws_server_context,
             lo_msgid_protocol type ref to if_wsprotocol_message_id,
             lv_message_id     type sxmsmguid.
      try.
          lo_server_context   = cl_proxy_access=>get_server_context( ).
          lo_msgid_protocol ?=
               lo_server_context->get_protocol( if_wsprotocol=>message_id ).
          lv_message_id = lo_msgid_protocol->get_message_id( ).
        catch cx_ai_system_fault into lo_cx_ai_system_fault.
      endtry.
    The message ID is always initial.
    Any ideas?
    Regards,
    Dion

    Yes, check fields system structure SY with fields like  SY-MSGV[1-4], SY-MSGID and so on.
    Cheers

  • How to capture error message from standard function module

    Dear friends
    when i  execute standard function module in finance , i am getting error message , pls check the below screen shot,
    how to capture the below error message so that i have display in my webdynpro component
    Thanks
    Vijaya

    Hello Vijaya,
    Incase of BAPI's they have a return table parameter T_RETURN. Just read that return table to get the error message.
    Incase of normal function modules, there will be exceptions raised for the message used inside the function module. Just read the sy-subrc after the FM and based on the sy-subrc value find the respective exception raised.
    May be you can try like this, whenever the message is raised it will be stored in the system variable.
    CALL FM.
    check for the system variables.
    sy-msgid = Message ID of the latest message raised.
    sy-msgno = message number of the latest message raised.
    sy-msgty = message type of the latest message raised.
    sy-msgv1 = variable1 of the latest message raised.
    sy-msgv2 = variable2 of the latest message raised.
    sy-msgv3 = variable3 of the latest message raised.
    sy-msgv4 = variable4 of the latest message raised.
    Regards,
    TP

  • Is it possible to circumvent error message within a function module?

    Hello friends,
    Is it possible to circumvent error message generation from within a function module? My program calls a FM (namely FKK_S_CADOCUMENT_WRITEOFF) to do some updates. However, in certain cases this FM throws error messages and terminates the whole process. I cannot control the aftermath because it never gets back to the calling program.It stops at the FM level and not at my program level.
    In essence, what I would like to do is to let the FM do its thing, generate some kind of exception (but no error message), come back to the calling program, and then I can capture the status in my program and do what is necessary from then on.
    Your help is greatly appreciated

    Hi,
    Do not use Excerption Tab.
    Instead declare a variable or Structure at export parameter.
    Which will return you error Description or Status of the FM.
    For Example.
    Goto Se37 ---> key in FM name of yours.
    Go to Table tab
    At Parameter Name Column key in RETURN, Type as LIKE and Associate type as BAPIRET2.
    ThankS & regards,
    ShreeMohan
    Edited by: ShreeMohan Pugalia on Aug 10, 2009 12:31 PM

  • Connection closed message by RFC function module.

    Hi experts,
    I have an RFC function module where I have no own exception defined. I use 'standard' ones.
    EXCEPTIONS
      communication_failure = 1 MESSAGE ls_proto-message
      system_failure        = 2 MESSAGE ls_proto-message
    Inside this FM I do update of database table using MODIFY dbtab statement.
    In some cases I get exception 'Conection closed' as a message.
    Does anybody know what this message means?
    Could it be temporary connection failure or timeout by table update?
    Thanks a lot.

    HI,
    then it is a temporary failure ..when u get this message ..what u can do is GOTO SM59->try to do a test connection with the destination logical system(Other Sap system)..see if u r able to login...If u r able to login then the RFC connection is fine otherwise we need to check in detail in which cases we are getting the error..
    Regards,
    Nagaraj

  • Catching error message from standard function module to internal table.

    Hi,
    i am calling a FM in my custom prog.
    After execution of the FM some auto generated errors is getting displayed.
    I want to pass this error to an internal table.
    Please tell me how to do this?
        CALL FUNCTION 'FORMAT_CHECK'
          EXPORTING
            i_checkrule   = t005-prbkn
            i_checkfield  = it_ven-bankn
            i_checklength = t005-lnbkn
            i_checkmask   = space
            i_fname       = fname
          EXCEPTIONS
            not_valid     = 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.
    I want to catch this particular error message in the itab.
    Thanks,
    SAM.

    Even we can create an internal table  nad move the messages to it.
    DATA : BEGIN OF L_ERR OCCURS 0,
            SNO LIKE SY-tabix,                                  "serial no
            MSGTY LIKE SY-MSGTY,                         "message type
            MSGNO LIKE SY-MSGNO,                        "message no
            ERR_TEXT LIKE T100-TEXT,                     "message text
           END OF L_ERR. 
       IF SY-SUBRC <> 0.
              L_ERR-SNO      = SY-TABIX.
              L_ERR-MSGTY    = SY-MSGTY.
              L_ERR-MSGNO    = SY-MSGNO.
              L_ERR-ERR_TEXT = TEXT-015.                        "Problem encounterd in uploading data.
              APPEND L_ERR.
              clear L_ERR.
         ENDIF.

  • Message handling in function module

    Dear All,
    I created a function module to create equipment master. but i want to know how to handle message for this function module.
    Like if i create an equipment which is already been created then the message should shoe that equipment already exist.
    <removed by moderator>
    this is my query. so pls kindly tell me how to handle message for this query
    Moderator message: please post only relevant code parts, your posts must contain less than 5000 characters to preserve formatting.
    Edited by: Thomas Zloch on Apr 14, 2011 10:00 AM

    Hi Prakrita,
    Try building below code within the RFC after you have added return structure in your RFC parameters.
      IF sy-subrc NE 0.
        CLEAR message.
        message-msgty = 'E'.
        message-msgid = 'ZMI'.
        message-msgno = '001'.
        message-msgv1 =  ID.
      PERFORM return_message USING message
                                   CHANGING return.
      Endif.
      form return_message USING    VALUE(P_MESSAGE)   LIKE MESSAGE
                                   CHANGING P_RETURN  LIKE BAPIRETURN.
      CHECK NOT MESSAGE IS INITIAL.
      CALL FUNCTION 'BALW_BAPIRETURN_GET'
           EXPORTING
                TYPE       = P_MESSAGE-MSGTY
                CL         = P_MESSAGE-MSGID
                NUMBER     = P_MESSAGE-MSGNO
                PAR1       = P_MESSAGE-MSGV1
                PAR2       = P_MESSAGE-MSGV2
                PAR3       = P_MESSAGE-MSGV3
                PAR4       = P_MESSAGE-MSGV4
           IMPORTING
                BAPIRETURN = P_RETURN
           EXCEPTIONS
                OTHERS     = 1.
    endform.

  • Handling pop up of sub type HR_MAINTAIN_MASTERDATA function module

    Hi All,
    I am using HR_MAINTAIN_MASTERDATA for creating employee it's working fine but i am not able to handle pop up for sub type.
    For example sub type for Address it gives me pop up with values 1 Permamant address 2 Office address etc.
    Anybody know how to handle such pop up in function module. How to provide values to sub type.
    Thanks in advance.

    Hi,
    <li>Instead of using HR_MAINTAIN_MASTERDATA function module, you can use HR_INFOTYPE_OPERATION, because HR_MAINTAIN_MASTERDATA is used inside HR_INFOTYPE_OPERATION.
    <li>Check the sample program .
    REPORT  ztest_notepad .
    DATA:p0006  TYPE STANDARD TABLE OF p0006 WITH HEADER LINE.
    DATA:return LIKE  bapireturn1.
    p0006-pernr = '00001234'.
    p0006-subty = '2'.
    p0006-endda = '99991231'.
    p0006-begda = sy-datum.
    p0006-anssa = '2'.
    p0006-name2 = 'xyz'.
    p0006-stras = 'Street 64'.
    p0006-ort01 = 'US'.
    p0006-pstlz = '560634'.
    APPEND p0006.
    CLEAR  p0006.
    LOOP AT p0006.
      CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
        EXPORTING
          number = p0006-pernr.
      CALL FUNCTION 'HR_INFOTYPE_OPERATION'
        EXPORTING
          infty         = '0006'
          number        = p0006-pernr
          subtype       = p0006-subty
          validityend   = p0006-endda
          validitybegin = p0006-begda
          record        = p0006
          operation     = 'INS'
          tclas         = 'A'
        IMPORTING
          return        = return.
      IF  return IS INITIAL.
        WRITE 'Successfully records created'.
      ENDIF.
      CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
        EXPORTING
          number = p0006-pernr.
    ENDLOOP.
    Thanks
    Venkat.O

  • Function Module  Error Message to appear in  Monitor-Detail TAB

    Hello ABAP / BW Gurus,
    how and can I write an error message in a function module
    that it appears in the detail tab of the monitor ?
    Thank You
    Martin Sautter

    OK

  • 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

Maybe you are looking for

  • SXMB_GET_MESSAGE_PAYLOAD

    hi, Can you please tell me what are the inputs to be taken in the function module SXMB_GET_MESSAGE_PAYLOAD. Thanks, Shreya.

  • Glyph panel not displaying font character sets in cs5.5

    Hi I'm having issues with accessing font character sets & glyphs in ID cs5.5. I have all my fonts in fontbook and can see the full font character sets displayed but when I go to my glyph panel to access any additional character or glyphs sets there i

  • Blank spaces in HTML where tiff or jpeg files should be?

    Robohelp 7 (new user) and Framemaker 8.0p277. I have a Framemaker book file that I would like to convert to HTML using Robohelp. I have right-clicked on Project Files > Add Framemaker File > Add by Reference. I selected the Framemaker book file and i

  • Presenter 8- Theme Editor Preview stopped working

    When I click on the Theme Tab the pop up window for the Theme Editor shows but the preview display has the Adobe Presenter pre-load screen and nothing else. This was OK  in the trial version and then it stopped.  I just purchased the license and unin

  • RElease Codes triggerd without configured.

    Hi, There are two release codes maintained in the release strategy. Problem is, when creating a PO usimg the conditions of that release strategy there are 3 release codes comes out, considering I maintained only two release codes. I checked the setti