Popup BAPI return messages

Hello experts,
I would like a way to quickly handle the BAPI return table (TYPE TABLE OF bapiret2).  I would like to pass the table into a function module or helper method to popup all the messages at once.  This is the same way MIGO (and many other programs) do a popup of messages with little red, yellow, and green icons to the left.  Currently I am using a series of calls to function module BAL_LOG_... and I feel there has to be a better way.
I tried searching for the answer to this question, but if the answer exists, it is buried within the noise of a million people saying use 'POPUP_TO_CONFIRM' and other function modules.  To clarify: I do not want buttons to confirm.  I want a popup of a list of messages with red, yellow, and green icons on the left.
Whoever answers my question correctly will henceforth be referred to by me as "the Magnificent."

My 2 cents ...
IF_RECA_MESSAGE_LIST is the most convenient message handler i have used so far So i would use it in this way -
Get the instance using the factory class CF_RECA_MESSAGE_LIST=>CREATE( ).
Add the BAPI messages using the method ADD_FROM_BAPI( ).
Get the handle via GET_HANDLE( ) & display using function BAL_DSP_LOG_DISPLAY.
DATA(o_msg_list) = cf_reca_message_list=>create( ).
o_msg_list->add_from_bapi(
  EXPORTING
    it_bapiret = VALUE #( id = 'BC_IBF'
                        ( type = 'I'  number = '008' )
                          type = 'E' ( number = '050' message_v1 = 'AA')
                                     ( number = '051' message_v1 = 'BB')
                                     ( number = '055' message_v1 = 'CC')
DATA st_log_disp_prof TYPE bal_s_prof.
CALL FUNCTION 'BAL_DSP_PROFILE_POPUP_GET'
  IMPORTING
    e_s_display_profile = st_log_disp_prof.
st_log_disp_prof-use_grid   = abap_true.
st_log_disp_prof-disvariant
  = VALUE #( handle = o_msg_list->get_handle( )
             report = sy-repid
CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
  EXPORTING
    i_s_display_profile  = st_log_disp_prof
  EXCEPTIONS
    profile_inconsistent = 1
    internal_error       = 2
    no_data_available    = 3
    no_authority         = 4
    OTHERS               = 5.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
BR,
Suhas

Similar Messages

  • How to display BAPI return message as a pop up

    Hi,
    I am able to get BAPI return message but my requirement is to display these BAPI return messages as pop up's like alerts in javascript.
    I am using abstract portal component.
    any suggestions.
    Regards
    Praveen

    Hi,
    Place a hidden field in your abstract portal component like this:
    <input type ="hidden" name ="returnedmessage" value=<i>the variable returned from JCO</i>>
    In addition to this:
    <script language = "javascript">
    if (document.<i>formname</i>.returnedmessage.value != null || document.<i>formname</i>.returnedmessage.value != "")
    alert(document.<i>formname</i>.returnedmessage.value);
    </script>
    If you are transferring your code to a JSP it would less cumbersome else you would have to enclose all this in response.write(); statements.
    Regards,
    Prem

  • BAPI return message problem

    Hi All,
    I created BAPI for Sale order the order created successfully but the return message S -success  is not coming- but the error message the sale order is already exist. How to solve this. I used the returnmessage for BAPI - BAPIRETURN1.
    Thanks,
    Suresh Maniarasu
    Edited by: suresh maniarasu on May 23, 2009 12:20 PM

    Well S  is not coming because there is no Success. Its giving error that Order already exists in system. Seems like straightforward condition.

  • How to handle BAPI RETURN message?

    Hi ,
    I developed a bapi ,it is calling from java  application . i don't konw how to send the return message to java application .Pl any one help out this problem.
    Thanks&Regards,
    Pratap

    bapi's normally have a return parameter of type BAPIRETURN (structure) or BAPIRET (internal table) that contain the result messages from a bapi. So if you develop your own bapi you should add this kind of export parameter.
    regards,
    Hans

  • BAPI return message

    Hi,
    I am trying to use 'BAPI_INQUIRY_CREATEFROMDATA2' to create Inquiries. It is creating successfully. But if there any pricing errors like 'Pricing error: Mandatory condition SRP5 is missing', it is not giving this return message but instead giving generic return message saying 'The sales document is not yet complete: Edit data'.
    If we use BDC to create the Inquiry, if the same problem happens, it does gives the specific return message ('Pricing error: Mandatory condition SRP5 is missing').
    Is there a way to get this specific return message from the BAPI as well?
    Thanks..
    Swetha.

    Hi Swetha ,
    BAPI is a kind of direct table update and BDC is creation of data thro' screen validation. So SAP take cares of all the validation when you run the BDC, but in case of BAPI, you will always get these kinds of message which are hard to interpreter. Also there is no way to manipulate these messages.
    Thanks,
    Mandar

  • BAPI return messages.

    Hi,
    When we create a sale order manually using VA01 tcode, we will be getting messages like 'material entered is critical part' or when the customer is on credit hold we will be getting 'Credit check maximum document value exceed'.
    My problem is i am not getting these messages in my return table when i create a sale order using 'SD_SALESDOCUMENT_CREATE'. Whether there is any value we need to pass in the import to get all the messages type S, I, W in our return table.
    Please let me know the solution.
    It's very urgent.
    Thanks,
    Srinath S.

    after my bapi call.
    i gave append <my_ret_table>.
    eg:
      CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
        EXPORTING
          sales_header_in     = header
        IMPORTING
          salesdocument_ex    = sales_doc
          sales_header_out    = header_out
          sales_header_status = header_status
        TABLES
          return              = bapireturn
          sales_items_in      = sditm
          sales_items_inx     = sditmx
          sales_partners      = parnr
          sales_schedules_in  = sch
          items_ex            = item
          schedule_ex         = schedule
          business_ex         = business.
    APPEND bapireturn..
    but the last message is appended again.

  • Write BAPI return messages into text

    Dear experts,
                  I want to write error messages into a text file. i tried in many ways like, using GUI_DOWNLOAD i converted messages to non sap but it creates only empty text file. Is there any other function module in sap?

    Thanks Guys, here is my sample code...
    tables:bapimathead,
            bapi_makt,
            bapi_mara,
            bapi_marax,
            bapi_marc,
            BAPI_MARCX.
    data:begin of itab occurs 0,
           MATERIAL type BAPIMATHEAD-MATERIAL,
           IND_SECTOR TYPE BAPIMATHEAD-IND_SECTOR,
           MATL_TYPE type bapimathead-MATL_TYPE,
           PLANT type BAPI_MARC-PLANT,
           MATL_DESC TYPE BAPI_MAKT-MATL_DESC,
           BASE_UOM TYPE bapi_mara-BASE_UOM,
           MATL_GROUP type bapi_mara-MATL_GROUP,
    *      OLD_MAT_NO TYPE BAPI_MARA-OLD_MAT_NO,
    *      DIVISION TYPE BAPI_MARA-DIVISION,
    *      UNIT_OF_WT TYPE BAPI_MARA-UNIT_OF_WT,
    *      NET_WEIGHT TYPE BAPI_MARA-NET_WEIGHT,
    *      DOCUMENT TYPE BAPI_MARA-DOCUMENT,
    *      DOC_TYPE TYPE BAPI_MARA-DOC_TYPE,
           LANGU TYPE BAPI_MAKT-LANGU,
           PUR_GROUP TYPE BAPI_MARC-PUR_GROUP,
           MRP_TYPE TYPE BAPI_MARC-MRP_TYPE,
           MRP_CTRLER TYPE BAPI_MARC-MRP_CTRLER,
           LOTSIZEKEY TYPE BAPI_MARC-LOTSIZEKEY,
           PLND_DELRY TYPE BAPI_MARC-PLND_DELRY,
           SM_KEY TYPE BAPI_MARC-SM_KEY,
           end of itab.
    DATA:    it_RETURN like bapiret2 OCCURS 0 WITH HEADER LINE,
              IT_BAPI LIKE BAPI_MAKT OCCURS 0 WITH HEADER LINE,
              IT_MSG LIKE TLINE OCCURS 0 WITH HEADER LINE.
    parameters:p_file TYPE IBIPPARMS-PATH obligatory.
    at selection-screen on value-request for p_file.
    perform get_f4help.
    start-of-selection.
    perform upload_file_itab.
    perform call_bapi.
    *END-OF-SELECTION.
    *PERFORM ERROR.
    *&      Form  get_f4help
    form get_f4help .
    CALL FUNCTION 'F4_FILENAME'
      EXPORTING
        PROGRAM_NAME        = SYST-CPROG
        DYNPRO_NUMBER       = SYST-DYNNR
      IMPORTING
        FILE_NAME           = P_FILE  .
    endform.                    " get_f4help
    *&      Form  upload_file_itab
    form upload_file_itab .
    DATA:V_FILE TYPE STRING.
    MOVE P_FILE TO V_FILE.
    CALL FUNCTION 'GUI_UPLOAD'
       EXPORTING
        filename                      = V_FILE
        FILETYPE                      = 'ASC'
        HAS_FIELD_SEPARATOR           = 'X'
       TABLES
         data_tab                      = ITAB .
    endform.                    " upload_file_itab
    *&      Form  call_bapi
    form call_bapi .
    loop at itab.
    BAPIMATHEAD-material = itab-MATERIAL.
    bapimathead-IND_SECTOR = itab-IND_SECTOR.
    BAPIMATHEAD-MATL_TYPE = itab-MATL_TYPE.
    BAPIMATHEAD-BASIC_VIEW = 'X'.
    BAPIMATHEAD-PURCHASE_VIEW = 'X'.
    BAPIMATHEAD-MRP_VIEW = 'X'.
    bapi_mara-MATL_GROUP = itab-MATL_GROUP.
    bapi_mara-base_uom = itab-base_uom.
    *BAPI_MARA-OLD_MAT_NO = ITAB-OLD_MAT_NO.
    bapi_marax-MATL_GROUP = 'X'.
    bapi_marax-BASE_UOM = 'X'.
    *BAPI_MARA-DIVISION = ITAB-DIVISION.
    *BAPI_MARA-UNIT_OF_WT = ITAB-UNIT_OF_WT.
    *BAPI_MARA-NET_WEIGHT = ITAB-NET_WEIGHT.
    *BAPI_MARA-DOCUMENT = ITAB-DOCUMENT.
    *BAPI_MARA-DOC_TYPE = ITAB-DOC_TYPE.
    IT_BAPI-LANGU = ITAB-LANGU.
    IT_BAPI-LANGU_ISO = 'EN'.
    IT_BAPI-MATL_DESC = ITAB-MATL_DESC.
    BAPI_MARC-PLANT = ITAB-PLANT.
    BAPI_MARC-PUR_GROUP = ITAB-PUR_GROUP.
    BAPI_MARC-MRP_TYPE = ITAB-MRP_TYPE.
    BAPI_MARC-MRP_CTRLER = ITAB-MRP_CTRLER.
    BAPI_MARC-LOTSIZEKEY = ITAB-LOTSIZEKEY.
    BAPI_MARC-PLND_DELRY = ITAB-PLND_DELRY.
    BAPI_MARC-SM_KEY = ITAB-SM_KEY.
    BAPI_MARCX-PLANT = 'X'.
    BAPI_MARCX-PUR_GROUP = 'X'.
    BAPI_MARCX-MRP_TYPE = 'X'.
    BAPI_MARCX-MRP_CTRLER = 'X'.
    BAPI_MARCX-LOTSIZEKEY = 'X'.
    BAPI_MARCX-PLND_DELRY = 'X'.
    BAPI_MARCX-SM_KEY = 'X'.
    APPEND IT_BAPI.
    clear it_bapi.
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
       EXPORTING
         headdata                  = BAPIMATHEAD
        CLIENTDATA                 = bapi_mara
        CLIENTDATAX                = bapi_marax
        PLANTDATA                  = BAPI_MARC
        PLANTDATAX                = BAPI_MARCX
        IMPORTING
        RETURN                     = it_RETURN
      TABLES
        MATERIALDESCRIPTION        = IT_BAPI .
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'  .
    LOOP AT IT_RETURN.
    CALL FUNCTION 'RPY_MESSAGE_COMPOSE'
       EXPORTING
        LANGUAGE                = SY-LANGU
         MESSAGE_ID              = IT_RETURN-ID
         MESSAGE_NUMBER          = IT_RETURN-NUMBER
      IMPORTING
        MESSAGE_TEXT            = IT_RETURN-MESSAGE
      TABLES
        LONGTEXT                = IT_MSG
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDLOOP.
    CALL FUNCTION 'GUI_DOWNLOAD'
       EXPORTING
    *   BIN_FILESIZE                    =
        FILENAME                        = 'D:/DEMO.TXT'
        FILETYPE                        = 'ASC'
    *   APPEND                          = ' '
    *   WRITE_FIELD_SEPARATOR           = ' '
    * IMPORTING
    *   FILELENGTH                      =
       TABLES
         DATA_TAB                        = IT_RETURN
    *   FIELDNAMES                      =
      EXCEPTIONS
        FILE_WRITE_ERROR                = 1
        NO_BATCH                        = 2
        GUI_REFUSE_FILETRANSFER         = 3
        INVALID_TYPE                    = 4
        NO_AUTHORITY                    = 5
        UNKNOWN_ERROR                   = 6
        HEADER_NOT_ALLOWED              = 7
        SEPARATOR_NOT_ALLOWED           = 8
        FILESIZE_NOT_ALLOWED            = 9
        HEADER_TOO_LONG                 = 10
        DP_ERROR_CREATE                 = 11
        DP_ERROR_SEND                   = 12
        DP_ERROR_WRITE                  = 13
        UNKNOWN_DP_ERROR                = 14
        ACCESS_DENIED                   = 15
        DP_OUT_OF_MEMORY                = 16
        DISK_FULL                       = 17
        DP_TIMEOUT                      = 18
        FILE_NOT_FOUND                  = 19
        DATAPROVIDER_EXCEPTION          = 20
        CONTROL_FLUSH_ERROR             = 21
        OTHERS                          = 22
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    WRITE : /1 IT_RETURN-ID, 10 IT_RETURN-TYPE, 20 IT_RETURN-NUMBER, 25 IT_RETURN-MESSAGE.
    ENDLOOP.
    ENDFORM.
    Text file generated and getting message like 0 bytes transferred.

  • Regarding BAPI Return Parameter.

    Hi All,
              I want to create Bapi Return Message with Variable values like : ' Sales Order 1876738267 is not created, please try again.' and want to create a log of this after BAPI calling in Calling FM. How can I do this. Please guide me.
    Thanks in Advance.

    Hi,
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
      EXPORTING
        ORDER_HEADER_IN           = sd_header
      WITHOUT_COMMIT            = ' '
      CONVERT_PARVW_AUART       = ' '
    IMPORTING
       SALESDOCUMENT             = sd_doc_num
      SOLD_TO_PARTY             =
      SHIP_TO_PARTY             =
      BILLING_PARTY             =
       RETURN                    = return_it
      TABLES
        ORDER_ITEMS_IN            = itemin_it
        ORDER_PARTNERS            = partnr_it
      ORDER_ITEMS_OUT           =
      ORDER_CFGS_REF            =
      ORDER_CFGS_INST           =
      ORDER_CFGS_PART_OF        =
      ORDER_CFGS_VALUE          =
      ORDER_CCARD               =
      ORDER_CFGS_BLOB           =
      ORDER_SCHEDULE_EX         =
    WRITE : / 'sy-subrc = ' , SY-SUBRC.
    IF NOT SD_DOC_Num IS INITIAL.
    WRITE : / 'Sales Order ' , SD_DOC_Num, 'Created'.
    ELSE.
    WRITE : / 'incorrect'.
    WRITE : / RETURN_it-TYPE , RETURN_it-MESSAGE.
    WRITE : / RETURN_it-LOG_NO, RETURN_it-LOG_MSG_NO,
              RETURN_it-MESSAGE_V1.
    ENDIF.
    Hope this helps you.
    Thanks,
    Ruthra

  • Return Messages for a BAPI run in Background

    Hi all,
    I am running a BAPI( BAPI_SALESORDER_CHANGE ) in Background task, It works fine and updates the Sales order but i dont get any return messages.But based on the return messages i need to show up on the report which orders got updated and which are not.....
    Can anyone help me how can i get the return messages when i run a BAPI in background task......

    Thanks for the quick response....I think you got me wrong...I am not running the program as a background job....I am running only the bapi in background task as below.....
                CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
                   IN BACKGROUND TASK AS SEPARATE UNIT
                     EXPORTING
                          salesdocument    = v_vbeln
                          order_header_in  = it_bapisdh1
                          order_header_inx = it_bapisdh1x
                     TABLES
                          return           = it_return
                          partnerchanges   = it_bapiparnrc.
    When the bapi runs as a background task i dont get any return messages in it_return but the sales order gets updated....
    But i will have to capture the return messages as well....How can i achieve that ?

  • How to display the return message in popup window

    Hi Experts,
    In WDA i want to display the return message through popup window.
    Regards,
    M.Chella Meenal.

    hi Chella Meenal ,
    you can generate the popup using popup factory class also , look at the below sample code for displaying message in a popup , and you can do your own configurating like visible , enable the buttons you want ..
    data:
        lr_component type ref to if_wd_component,
        ls_conf type wdr_popup_to_confirm,
        lt_texts     type string_table.
      ls_conf-window_position = '1'.
      ls_conf-button_1-text = 'OK'.
      ls_conf-button_1-icon = 'ICON_OKAY'.
      ls_conf-button_1-enabled = 'X'.
      ls_conf-button_1-visible = CL_WD_UIELEMENT=>E_VISIBLE-VISIBLE.
      ls_conf-button_2-visible = CL_WD_UIELEMENT=>E_VISIBLE-NONE.
      ls_conf-button_cancel-visible = CL_WD_UIELEMENT=>E_VISIBLE-NONE.
      lr_component = wd_comp_controller->wd_get_api( ).
      append 'some text' to lt_texts.
      cl_wd_popup_factory=>popup_to_confirm(
          component        = lr_component
          text             = lt_texts
          CONFIGURATION    = ls_conf
          window_title     = 'some title' ).
    Regards
    Chinnaiya P

  • Error in BAPI RETURN for Service Contract

    Hi,
      I get an error in the BAPI Return for the Uploading the Service Contracts by LSMW. The Error Message is E BS No status object is available for &.Also want to know can we upload multiple line of header text for a Contract by this BAPI. If so then how would I do this , as the BAPI structure BAPISDTEXT has textline upto 132 characters. And I am take only one file in LSMW where the header & details come alongwith text. Or could also tell me the file structure of for the data upload. The legacy system sends multiple text in the header for a Contract.For Eg.
    Header1 Detail1 Text1
    HEader1 Detail2 Text2
    Header1 Detail3 Text3
    So I would need this text1TEXT2text3 in the Header Text of the Contracts. Or do I need the change the file structure. Many thanks for your time and help.

    Thanks Nablan, I could do that for multiple header coming in file. But I have a question for you on BAdI ALM_ME_006_GOODSMVT. I have implemented this BAdI , and this BAdI is called by a function Module ALM_MEREP_006_CREATE. When I test this FM giving the Material , Orderid and Movement type entries, this BAdI is triggered when giving a breakpoint. I've given this code for changing the movement type to 961. Cause the stanadrd scenario does not maintain Movement type 961 in Mobile Asset Management. The Movement type 961 for unplanned Materials comes to SAP and changes to 261 as maiantained by TCOKO table. To bypass this & retain the movement type 961 in SAP I'm using this BAdI. Currently this is what I'm doing and am stuck in the method interface how do I call the method.
    method IF_EX_ALM_ME_006_GOODSMVT~CREATE .
    break-point.
    *DATA : i_ce_goodsmovement TYPE REFERENCE
              ALM_ME_CUSTOMER_ENHANCEMENT.
    DATA : lr_badi_goods_movement TYPE REF TO if_ex_alm_me_006_goodsmvt.
    DATA : ls_user_data TYPE ALM_ME_USER_DATA-USERID.
    *DATA : goods_movement TYPE ALM_ME_MATERIAL_MOVEMENT.
    CALL METHOD lr_badi_goods_movement->create
      EXPORTING
           ce_goodsmovement = ce_goodsmovement
      IMPORTING
           user_data        = ls_user_data
           custom_user_data = ls_ce_user_data
           goods_movement   = goods_movement
      changing
           return           = return[].
    CALL FUNCTION 'ALM_ME_COMMIT_OR_ROLLBACK'
           TABLES
                return = return.
    endmethod.
    Please help me to get the data in this method. How do I call this.

  • Regarding BAPI Return Table

    Hi all,
    I am having an issues, when the user enters the correct value into an input field then i am getting the output properly. But if he enters any wrong value a message is populated into the BAPI return table. So how do I check if the BAPI return table is empty or not. If it is empty then it has to open the output table and if it is not empty it has to show the error message as an pop-up or table format.
    Please reply, points will be rewarded.
    Thanks & Regards,
    M.Ramana Murthy

    Hi Ramana,
    If you want to capture the message returning from the BAPI which you are using then do the following:
    1.> Drag the line from the BAPI return port and link it to a form or to a table.
    2.> Then go to the form/table click the UIelement and in properties of that assign the default value which you want to display. It may be a message coming out of the BAPI.Through this way you can capture the values coming out of the BAPI
    Regards,
    Nutan

  • Multiline BAPI return structure  and RFC Adapter

    Since SP14 RFC Adapter check return structure of RFC function.
    But how it works if BAPI returns multiline BAPIRET2?
    Will adapter loop all elements and perfom commit only if <b>all</b> alements don't have errors.

    I'am about this:
    <i>As of SP 14 support for commit handling for single BAPI calls was added to the RfcAdapter receiver channel. If activated in the receiver channel setting, the received XI message will be executed as synchronous RFC (sRFC) in the receiving system. This is also true for asynchronous (QoS EO) XI messages to receive and analyze the execution result by the RfcAdapter.
                   The received response is parsed by the RfcAdapter to get the BAPI return parameter with name "RETURN". This return parameter can be of BAPIRETURN, BAPIRET1 or BAPIRET2 types. The "RETURN" parameter is checked for the response status (field TYPE) which can take following values:
                  1. 'S' : Success
                  2. 'I' : Information
                  3. 'W' : Warning
                  4. ''  : Empty String
                  5. 'A' : Abort
                  6. 'E' : Error
                   If the response contains one amongst the first four response status then it implies that the BAPI was successful. If the response contains one amongst the last two response then the BAPI failed. If the BAPI "RETURN" parameter is of not of type ABAP structure rather of type ABAP table, a empty table is also considered as successful execution result.
                   In case of a successful execution the BAPI function module "BAPI_TRANSACTION_COMMIT" is called within the same context to trigger the commit of the BAPI. In case of a failure the BAPI function module "BAPI_TRANSACTION_ROLLBACK" is executed by RFC Adapter which rolls back the changes.</i>

  • BAPI Error Message Handling

    Hi Group,
    I am using BAPI ,How to display the BAPI  Error Message (eg:BAPIRET1) which is returning by BAPI

    HI ,
    ITS SIMPLE TRY THIS CODE
    AWARD PTS
    DATA: gt_ret     TYPE TABLE OF bapiret2,
               ls_ret    TYPE bapiret2,
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          salesdocument     = p_vbeln
          order_header_in   = gt_hdr
          order_header_inx  = gt_hdrx
        TABLES
          return            = gt_ret -
    >>>>.<b>IMPORTANT</b>
          order_item_in     = gt_itm
          order_item_inx    = gt_itmx
          schedule_lines    = gt_sched
          schedule_linesx   = gs_schedx
          order_text        = gs_stdtxt.
          PARTNERS          = gs_partner
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      LOOP AT gt_ret INTO ls_ret.
        WRITE:/ ls_ret-type.
        WRITE:/ ls_ret-message.
      ENDLOOP.

  • Is there any BAPI returning the affected organisational units to users?

    Dear all,
    I would like to ask a question about organizational units. Whenever I want to affect a user to a given unit I
    use PPOME transaction. If I want to do this in ABAP level I use the function module RH_RELATION_WRITE.
    I would like to know, is there any BAPI returning the affected organizational unit to a given user?
    Thanks in advance,
    Kind Regards,
    Dariyoosh

    Alberto Sesma wrote:
    You can use Function Module RH_STRUC_GET
    >
    >
    > CALL FUNCTION 'RH_STRUC_GET'
    >   EXPORTING
    >      ACT_OTYPE = 'US'
    >      ACT_OBJID = user_name
    >      ACT_WEGID = 'US_CP_O'
    >   TABLES
    >        RESULT_TAB = LT_RESULT_TAB.
    >
    >
    > You will get the related org units in LT_RESULT_TAB. There are other two table parameters in that function module that you may find useful.
    >
    > If the function does not return any valid data you may try with other values for WEGID. You will find all the possible evaluation paths in transaction OOAW.
    >
    > Kind regards
    Dear Alberto,
    Thank you very much for your answer. I didn't know this FM and it solved my problem.
    For those who may be intered here is exactly I proceed. Suppose that in the table HRP1000 you have an
    structure (type S) with ObjID = 50000342 and you wish to have the SapUserID of the affected persons.
    DATA:
          affected_users TYPE STANDARD TABLE OF swhactor,
          user LIKE LINE OF affected_users.
    START-OF-SELECTION.
      CALL FUNCTION 'RH_STRUC_GET'
        EXPORTING
          act_otype              = 'S'
          act_objid              = '50000342'
          act_wegid              = 'A008'
          act_plvar              = '01'
          act_begda              = sy-datum
          act_endda              = sy-datum
          act_tdepth             = 0
       TABLES
         result_tab             = affected_users
    EXCEPTIONS
       NO_PLVAR_FOUND         = 1
       NO_ENTRY_FOUND         = 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.
      LOOP AT affected_users INTO user.
        WRITE: / user-objid.
      ENDLOOP.
    Also in transaction OOAW we can have all possible values for the third argument of the module function (act_wegid).
    For those who are interested, here are a few among many possible values which seem to be intesting for my
    problem.
    DFPS_DG1----
    Organizational Unit of User
    DFPS_DG3----
    All Org. Units Above a User
    ORGAS----
    Closest Organizational Unit and structure
    ORGASS----
    Closest Organizational Unit and structure     
    PPLEORG     -
    Organizational unit of an employee or position
    SAP_ORGP----
    Organizational assignments of a user/person
    SAP_USOG----
    Organizational Assignments of a User
    SAP_US_S----
    Positions and Personnel Number of a User
    US_S_S_C----
    All positions and jobs of a user
    WFM_ORGU----
    Organizational Assignment of User
    WF_ORGUN----
    Organizational unit of a user/person (module id Ben./Pers.)
    For example, let's say we have a userid named MYUSER01 and we would like to find all structures to which the user
    is affected. Here is how I proceed.
    DATA:
          itab_user_structures TYPE STANDARD TABLE OF swhactor,
          row_user_structures LIKE LINE OF itab_user_structures.
    START-OF-SELECTION.
    CALL FUNCTION 'RH_STRUC_GET'
        EXPORTING
          act_otype              = 'US'
          act_objid              = 'MYUSER01'
          act_wegid              = 'US_S_S_C'
          act_plvar              = '01'
          act_begda              = sy-datum
          act_endda              = sy-datum
          act_tdepth             = 0
       TABLES
         result_tab             = itab_user_structures
    EXCEPTIONS
       NO_PLVAR_FOUND         = 1
       NO_ENTRY_FOUND         = 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.
      LOOP AT itab_user_structures INTO row_user_structures.
        WRITE: / row_user_structures-objid.
      ENDLOOP.
    Thank you very much for your help.
    Kind Regards,
    Dariyoosh

Maybe you are looking for

  • Deskjet 3050 J610a Wireless issues

    I'm trying to set up my Deskjet 3050 J610a to use over my wireless network, the printer sets it self up on the network and connects fine to the router, but is unavailable when i use the wireless network setup tool. Router:   Linksys Wag160n Auth: WPA

  • Embed OVP in custom Web Dynpro

    Hi, I'm experiencing a similar problem as described [here|How to Embed FPM ABAP into a WebDynpro ABAP Application;, but that thread is closed (unanswered). I want to embed an (ESS) OVP component in my Z Web Dynpro. I defined a component usage for the

  • Occasional soft sound after Windows 8.1 update

    Hi, I have a strange problem. I updated to Windows 8.1 about two weeks ago. For about a week now I have noticed that occasionally my sound drops. I usually watch shows or something on say 20 volume. The sound suddenly drops and I have to turn it all

  • Problems with home button

    My son got me an Ipod 5th gen back in october through the apple online store and has worked just great until today, the home button does not seem to work and am looking for some help if i can fix it or should i find someone or send it back to apple t

  • Can 9233 measure AC voltages across a register in a circuit or from any voltage-type sensor?

    I actually have tried this, but uncessussful. I guess that this was due to the current source for IEPE inside the module which yields 22.2 V when no load is connected. As I know, I can't swistch off the IEPE so that the large voltage of 22.2 V has to