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

Similar Messages

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

  • 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

  • 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

  • How to get subrc in this function module

    CALL FUNCTION 'FI_PERIOD_CHECK'
         EXPORTING
             I_BUKRS          = 'C553'
            I_OPVAR          = ' '
              I_GJAHR          = it_out-datains1+0(4)
              I_KOART          = 'S'
             I_KONTO          = 'zzzzzzzzzz'
              I_MONAT          = L_IODM
       EXCEPTIONS
            ERROR_PERIOD     = 1
            ERROR_PERIOD_ACC = 2
            OTHERS           = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    when i am testing this function module i am getting error_period_acc =2.
    but i used this one in program like above code i am getting subrc=0.
    i have doubt in this one is we can comment exceptions or uncomment.
    i want sy-subrc <> 0.
    how can i get

    Try using this way
        CALL FUNCTION 'FI_PERIOD_CHECK'
             EXPORTING
                  i_bukrs          = cashin_header-bukrs
                  i_gjahr          = i_gjahr
                  i_koart          = 'D'
                  i_monat          = i_poper
             EXCEPTIONS
                  error_period     = 1
                  error_period_acc = 2
                  OTHERS           = 3.
        IF sy-subrc <> 0.
          CALL FUNCTION 'BALW_BAPIRETURN_GET2'
               EXPORTING
                    type   = sy-msgty
                    cl     = sy-msgid
                    number = sy-msgno
                    par1   = sy-msgv1
                    par2   = sy-msgv2
                    par3   = sy-msgv3
                    par4   = sy-msgv4
               IMPORTING
                    return = return.
          APPEND return.
        ENDIF.

  • Getting values from a function module called in a WDA method

    Friends,
    I am trying to execute a function module from WDA.
    I have created a service call for the function module. The function module takes values from the user, looks up the corresponding values of another field and returns the values in an internal table.
    I am using the "Method Call in Used Controller" of WD Code wizard to call the function module.
    When the event handler method containing the call to the function module is executed, nothing happens.
    I am not sure how to pass values to the function module and to get the return values from the function module.
    I am new to using function modules from WDA. Please help me out.
    Thanks and Regards.

    Rashmi,
    Is the function module intended to collect input data from the UI and process it? - Yes
    If yes, then the input (importing parameter) to the Function Module is a table of values (which should be ideally from the context mapped to the Table UI Element). - The importing parameter is a single value NOT a table and is mapped to the view context.
    Now this table UI Element is bound to the view controller context , which in turn is mapped to the component controller context. And you are indeed being able to read the value of this internal table in the component controller method where the function module is being called by means of get_static_attributes_table (Is this right? - Yes, I am able to read the table of values that is passed from the component controller view to form view context by using get_static_attributes_table.
    Or are you being able to read it in the event handler method of the view controller and not being able to read it in the component controller method) -
    The function module takes a single value as import parameter and returns a table of values as return value.
    It works fine when no importing parameter is being used and returns the table of values that is getting passed from component controller context to form view context when i am able to read it using get_static_attributes_table.
    Now the question is: how to pass the import parameter value to the function module. I assumed since the importing parameter is a context node (like the return values are), i should set the value ( captured when the user enters the value in the form) to the importing parameter context attribute using set_attribute method. Since it is mapped to the component controller context, i assumed it will get passed and the method will take it as input parameter.
    Let me know if my assumptions are correct regarding passing the import parameters and what is missing here.
    Thanks and Regards.

  • 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

  • Get interface of RFC function modules in a remote system

    Hi,
    my goal is to write a report which checks if DDIC structures in two systems fit together when I use RFC`s.
    I have the destination and the name of the RFC.
    Can somebody tell me if I can get a list of the Importing/Exporting Parameters of this RFC? Maybe even with a typedescribtion?
    Thanks for you help.
    Best regards
    Lars
    Edited by: Lars-Eric Biewald  on May 21, 2008 8:39 AM

    Hello ,
    Thank you for your quick help.
    Here I have 3 ECC 6 system .
    1 Central systen
    2 Slave system
    Data will be updated to 2 slave system using RFC function module .
    We've already the SAP address, Client, User name , Password.. of the remote system
    So here how we will create RFC in SM59 to be used in the RFC call ?
    We will transfer the username, password , client in the RFC function module/..
    Here I do not know how to create RFC connection in SM59 and how to use them in ABAP
    Could you please help me ????
    Thanks

  • 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

  • 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 get info from calling Function Module without passing it.

    Hi,
    I am facing a problem like from calling function module i want values of some variables and i dont want to change the import and export parameters, is there any way to get it done...
    Thanks in advance...

    Hi,
    It is possible only if you can find the memory id of the varibale.
    You can find out it by debugging
    <removed by moderator>
    Edited by: Mike Pokraka on Aug 4, 2008 9:37 AM

  • 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

  • Get formatted adress via function module

    Hi there,
    I am looking for a function module that gives me a formatted version of a given adress number. Like it is in form printing I need that for a normal ABAP-reporting.
    Is there any function module that helps me doing that? ADDR_GET I doesn't mean.
    Kind regards
    JetGum

    Hi,
    Kindly check the FM ADDRESS_INTO_PRINTFORM.
    Regards,
    Ankur Parab

Maybe you are looking for