Any FM or BAPI to Read the Org Stucture ?

Hi Experts,
Is there any FM / BAPI  to retrieve the Organization structure of given User , Specially the details of the Company Code (Like Company code that he is Assigned to ),
Thanks In Advance
Badari patil

All of OM will come with this Code !
TYPES: tt_hrp1001 TYPE STANDARD TABLE OF hrp1001 INITIAL SIZE 0.
DATA: it_hrp1001 TYPE tt_hrp1001.
TYPES: BEGIN OF t_orgdisplay,
  level(40) TYPE c,
  id        type i,
  parent    type i,
  objid TYPE hrp1001-objid,
  orgtx   TYPE string,
  begda TYPE hrp1001-begda,
  endda TYPE hrp1001-endda,
  display type string,
END OF t_orgdisplay.
DATA: it_orgdisplay TYPE STANDARD TABLE OF t_orgdisplay,
      wa_orgdisplay TYPE t_orgdisplay.
DATA: wa_hrp1001 LIKE LINE OF it_hrp1001,
      wa_objid TYPE hrp1001-objid ,
      wa_objid1 TYPE hrp1001-objid,
      wa_objid2 TYPE hrp1001-objid,
      wa_objid3 TYPE hrp1001-objid,
      wa_objid4 TYPE hrp1001-objid,
      wa_objid5 TYPE hrp1001-objid,
      wa_objid6 TYPE hrp1001-objid,
      gd_branchid type i,
      gd_parent1 type i,
      gd_parent2 type i,
      gd_parent3 type i,
      gd_parent4 type i,
      gd_parent5 type i,
      gd_parent6 type i,
      gd_parent7 type i.
SELECT *
  FROM hrp1001
* up to 500 rows
  INTO TABLE it_hrp1001
WHERE otype = 'O'  AND
       plvar = '01' AND
       rsign = 'B'  AND
       ( relat = '002' OR
         relat = '003' ) AND
       begda LE sy-datum AND
       endda GE sy-datum.
clear: gd_branchid.
*level 1
gd_parent1 = 0.
LOOP AT it_hrp1001 INTO wa_hrp1001 WHERE objid = '50006550'.
  wa_objid = wa_hrp1001-varyf+2(8).
  wa_objid = '50006550'.
  wa_orgdisplay-level(2) = wa_orgdisplay-level(2) + 1.
  perform append_org_data using gd_branchid gd_parent1.
  gd_parent2 = gd_branchid.
*  WRITE:/ 'level1'.
* level 2
  LOOP AT it_hrp1001 INTO wa_hrp1001 WHERE objid    = wa_objid
                                       AND varyf(1) = 'O'.
    wa_objid1 = wa_hrp1001-varyf+2(8).
    wa_orgdisplay-level+2(2) = wa_orgdisplay-level+2(2) + 1.
    perform append_org_data using gd_branchid gd_parent2.
    gd_parent3 = gd_branchid.
*    WRITE:/ 'level2'.
*   level 3
    LOOP AT it_hrp1001 INTO wa_hrp1001 WHERE objid    = wa_objid1
                                         AND varyf(1) = 'O'.
      wa_objid2 = wa_hrp1001-varyf+2(8).
      wa_orgdisplay-level+4(2) = wa_orgdisplay-level+4(2) + 1.
      perform append_org_data using gd_branchid gd_parent3.
      gd_parent4 = gd_branchid.
*      WRITE:/ 'level3:', wa_objid2 .
*     level4
      LOOP AT it_hrp1001 INTO wa_hrp1001 WHERE objid    = wa_objid2
                                           AND varyf(1) = 'O'.
        wa_objid3 = wa_hrp1001-varyf+2(8).
        wa_orgdisplay-level+6(2) = wa_orgdisplay-level+6(2) + 1.
        perform append_org_data using gd_branchid gd_parent4.
        gd_parent5 = gd_branchid.
*        WRITE:/ 'level4:', wa_objid3.
*       level5
        LOOP AT it_hrp1001 INTO wa_hrp1001 WHERE objid    = wa_objid3
                                             AND varyf(1) = 'O'.
          wa_objid4 = wa_hrp1001-varyf+2(8).
          wa_orgdisplay-level+8(2) = wa_orgdisplay-level+8(2) + 1.
          perform append_org_data using gd_branchid gd_parent5.
          gd_parent6 = gd_branchid.
*          WRITE:/ 'level5:', wa_objid4.
*       level6
        LOOP AT it_hrp1001 INTO wa_hrp1001 WHERE objid    = wa_objid4
                                             AND varyf(1) = 'O'.
          wa_objid5 = wa_hrp1001-varyf+2(8).
          wa_orgdisplay-level+10(2) = wa_orgdisplay-level+10(2) + 1.
          perform append_org_data using gd_branchid gd_parent6.
          gd_parent7 = gd_branchid.
*          WRITE:/ 'level6:', wa_objid5.
*       level7
        LOOP AT it_hrp1001 INTO wa_hrp1001 WHERE objid    = wa_objid5
                                             AND varyf(1) = 'O'.
          wa_objid6 = wa_hrp1001-varyf+2(8).
          wa_orgdisplay-level+12(2) = wa_orgdisplay-level+12(2) + 1.
          perform append_org_data using gd_branchid gd_parent7.
*          WRITE:/ 'level6:', wa_objid6.
        ENDLOOP.
          CLEAR: wa_orgdisplay-level+12(2).
        ENDLOOP.
         CLEAR: wa_orgdisplay-level+10(2).
        ENDLOOP.
        CLEAR: wa_orgdisplay-level+8(2).
      ENDLOOP.
      CLEAR: wa_orgdisplay-level+6(2).
    ENDLOOP.
    CLEAR: wa_orgdisplay-level+4(2).
  ENDLOOP.
  CLEAR: wa_orgdisplay-level+2(2).
ENDLOOP.
CLEAR: wa_orgdisplay-level(2).
export it_orgdisplay to memory id 'ZORGSTRUCT'.
DATA A LIKE TABLE OF it_orgdisplay .
IMPORT A FROM MEMORY ID 'ZORGSTRUCT'.
BREAK-POINT.
*&      Form  append_org_data
*       text
*  -->  p1        text
*  <--  p2        text
form append_org_data using p_id
                           p_parent.
  gd_branchid = gd_branchid + 1.
  wa_orgdisplay-objid = wa_hrp1001-varyf+2(8).
  wa_orgdisplay-begda = wa_hrp1001-begda.
  wa_orgdisplay-endda = wa_hrp1001-endda.
  wa_orgdisplay-id     = p_id.
  wa_orgdisplay-parent = p_parent.
  if wa_orgdisplay-level+2  is initial.
    wa_orgdisplay-display = 'TOP'.
  endif.
* Retrieve Org. Unit text
*  50006550
  PERFORM get_org_unit USING wa_orgdisplay-objid
                             wa_hrp1001-begda
                             wa_hrp1001-endda
                       CHANGING wa_orgdisplay-orgtx.
  translate wa_orgdisplay-orgtx using ''' '.
  if wa_orgdisplay-orgtx is initial.
    wa_orgdisplay-orgtx = 'Text unavailable'.
  endif.
  APPEND wa_orgdisplay TO it_orgdisplay.
  clear: wa_orgdisplay-display.
endform.                    " append_org_data
*&      Form  get_org_unit
* Retrieve Org. Unit text
FORM get_org_unit USING    p_orgeh
                           p_begda
                           p_endda
                  CHANGING p_orgtx.
  DATA: orgeh_short(12) TYPE c,
        orgeh_stext(40) TYPE c,
        read_return TYPE i.
* Returns full orgunit text, entry in table t527x is sometimes
* truncated so that it fits into a 25 character field
  CALL FUNCTION 'HR_READ_FOREIGN_OBJECT_TEXT'
       EXPORTING
          otype                   = 'O'
*         otype                   = ot_orgunit
            objid                   = p_orgeh   "p0001-orgeh
            begda                   = p_begda   "p0001-begda
            endda                   = p_endda   "p0001-endda
            reference_date          = p_begda   "p0001-begda
       IMPORTING
            short_text              = orgeh_short
            object_text             = orgeh_stext
            return                  = read_return
       EXCEPTIONS
            nothing_found           = 1
            wrong_objecttype        = 2
            missing_costcenter_data = 3
            missing_object_id       = 4
            OTHERS                  = 5.
  IF sy-subrc EQ 0.
    p_orgtx = orgeh_stext.
  ELSE.
*     If function module fails return text from text table
    SELECT SINGLE orgtx
      FROM t527x
      INTO p_orgtx
     WHERE orgeh EQ p_orgeh AND  "Replace with org. unit field
           sprsl EQ sy-langu AND
           ( endda GE sy-datum AND
             begda LE sy-datum ).
  ENDIF.
ENDFORM.                    " get_org_unit

Similar Messages

  • Is there any FM or BAPI to delete the sales orders

    Hi,
    Is there any FM or BAPI to delete the sales orders
    Thanks,
    srinivas.

    BAPI_SALESORDER_CHANGE
    [Link|http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bapi_salesorder_change-delete-sales-order-ver-470-1081398]

  • Is there any FM or BAPI to capture the action in CRMD_ORDER?

    Hi All,
    In CRMD_ORDER transaction, I need to know the action selected by the user like CREATE TRANSPORT OF COPIES, LOGON TO SYSTEM etc. Is there any FM or BAPI available to capture this action details?
    Thanks in advance.

    BAPI_SALESORDER_CHANGE
    [Link|http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bapi_salesorder_change-delete-sales-order-ver-470-1081398]

  • Read the Org Model

    Hi,
    I need to read the BP assigned to a specific position on my CRM Org Model. This position is assigned to the first organizational unit of it. Could you give some functions in order to do this. I though to use HRP1000 and HRP1001 for this purpose but I can't hardcode the Position Number or Description. (This number will change in other environments.)
    It's very urgent.
    Regards.

    Hi Javier,
    You can use table HRP1000 to get a Org unit based on SHORT. If you want all the org units attached in the heirarchy, you can use Function RH_STRUC_GET with act_weigd = 'SAP_SORG'.
    Example code:
    SELECT SINGLE objid FROM hrp1000 INTO (i_objid)
    WHERE short = i_orgdata.
    IF sy-subrc EQ 0.
    CALL FUNCTION 'RH_GET_ACTIVE_WF_PLVAR'
    IMPORTING
    act_plvar = lv_plvar
    EXCEPTIONS
    no_active_plvar = 1.
    CALL FUNCTION 'RH_STRUC_GET'
    EXPORTING
    act_otype = 'O'
    act_objid = i_objid
    act_wegid = 'SAP_SORG'
    ACT_INT_FLAG =
    act_plvar = lv_plvar
    act_begda = sy-datum
    act_endda = sy-datum
    act_tdepth = 0
    act_tflag = 'X'
    act_vflag = 'X'
    authority_check = 'X'
    TEXT_BUFFER_FILL =
    BUFFER_MODE =
    IMPORTING
    act_plvar = lv_plvar
    TABLES
    result_tab = result_tab
    result_objec = result_objec
    result_struc = result_struc
    EXCEPTIONS
    no_plvar_found = 1
    no_entry_found = 2
    OTHERS = 3
    This should give you the object ID's for all the nodes (organization, position and the holders like business partners assined to positions)
    Result tab of the above function will look like this :
    OT OBJID
    O 50000063
    O 50000064
    S 50000065
    O 50000072
    S 50000073
    CP 50000427
    where O corresponds to org object, S-> position and CP-> central person number of business partner (note: when you assign business partner to the postion, it stores the person number of the partner). So you would need to use the function BP_CENTRALPERSON_GET with IV_person_id = central person number (50000427) to get the user Id or partner number
    Hope this helps.
    Chandrika

  • Do any of you have trouble reading the text on the 15" MBP?

    Does the 1440x900 resolution make it difficult to read the text on the screen?

    Not for me, but my eyes are good at close range for someone in his 60s. Those who are more farsighted and need reading glasses for close work may have more trouble.
    The things to be concerned about are the menus, dialog boxes, and other Finder and OS elements that can't be enlarged except by reducing the display resolution, which blurs everything on the display. In most applications' windows, you can easily change the font size or zoom in on the page as a whole to suit yourself. Ultimately, whether you're comfortable with the screen resolution at its native (maximum) setting is a purely personal decision that only you can make. I strongly advise you NOT to buy any computer whose display is uncomfortable to use at its native setting, because you will be looking at a blurry screen ALL the time if you have to use any LCD display at a non-native resolution.

  • Firefox will not let use any checkboxes on any sites, like when you read the rules and want to check the acceot checkbox. We just started using firefox alot because IE is running incredibly slow on our computer. Any ideas

    Our computer has been running terribly slow, so we switched to using Firefox and it will not let me use any checkboxes on any website. Is there a setting or anything that needs to be changed

    Many of your points are totally legitimate.
    This one, however, is not:
    …To put it another way, the design of the site seems to be geared much more towards its regular users than those the site is supposedly trying to "help"…
    The design and management of the forums for more than five years have driven literally dozens of the most valuable contributors and "regulars" away from the forums—permanently.
    The only conclusion a prudent, reasonable person can draw from this state of affairs is that Adobe consciously and deliberately want to kill these forums by attrition—without a the PR hit they would otherwise take if they suddenly just shut them down.

  • Is there any FM or BAPI to get list of all sales orders

    Hello all,
            I have the requirement like below.
    Is there any FM if i Pass Drawing document no, type,part,revision level which gives
    the output list as.
    1) all sales orders, where the above drawing document no is attached to the materials
    and these materials are used as one of the lower level components in the Sales order BOM,
    I need to show all those sales orders along with SO number,item,Material,Plant and BOM Item no,
    2)all sales orders, where the above drawing document no is attached to the materials
    and the same material is one of the item in sales order.
    3)all sales orders, where the above drawing document no is used as one of the component in Sales order BOm's
    Addition of 1,2,3 will be the o/p.
    are there any FM or BAPI to get the above list.
    Basically the above report is concatenation of report outputs of t-code CSD5 and CS15.
    Awaiting reply.
    Thanks.

    Hi venkatesh,
       You can use the BAPI
    BAPISDORDER_GETDETAILEDLIST
    to get list of all sales orders.
    Here is a lik which provides you BAPI'S regarding everything.
    [http://www.saptechies.com/sap-bapi-list/]
    Hope this will help you.
    Regards,
    Pavan.

  • How to read the content of .msg file type with attachments in SAP crm?

    Hi All,
    Need to develop a RFC FM which will take any BP number as input
    Read the attachments in the BP and identify the attachment which is an email( .msg).
    Identify by the mime type and file extension
    Scan through the email to get the attachments of that email read the content of the
    attachment as a binary file and return that binary file with file name, size
    etc.
    I need to read the data (in binary format) attachment of an attachment of .msg file type .
    I have done till step 2 .
    Please help me on step 3.
    Thanks&Regards,
    Pratap Naik

    Can any one help me on this ?
    Thanks in advance.
    Regards,
    Pratap Naik

  • How to read the value of OLAPDataGrid cell/s from external object

    Hi,
    I have an OLAPDataGrid control in an Adobe flex application,
    and I am using the cutom renderer to render the cells of the
    OLAPDataGrid ,
    any Idea how I can read the value of each cell at the
    renderer , so I will be able to decide about the actions for each
    cell at the renderer?

    "j_shawqi" <[email protected]> wrote in
    message
    news:gkqgdl$539$[email protected]..
    > Hi,
    > I have an OLAPDataGrid control in an Adobe flex
    application,
    > and I am using the cutom renderer to render the cells of
    the OLAPDataGrid
    > ,
    > any Idea how I can read the value of each cell at the
    renderer , so I will
    > be
    > able to decide about the actions for each cell at the
    renderer?
    I'm thinking that you'll need to look at the listData
    property. I'm not
    sure what you get in an OLAP Grid that orients you to your
    cell position,
    but I'd set a break point in the listData override of your
    renderer and see
    what you actually have, or look at the docs for the data type
    of the
    listData object that the default renderer expects to get.
    HTH;
    Amy

  • Read the version of deployed EAR modules via JMX (WLS 10.0)

    Hello
    We are deploying some EAR components into a WLS 10.0. Now we want to monitor the version number of the deployed EARs via a JMX client. The version number is provided in the manifest of the EAR (Implementation-Version).
    I read through some JMX related documents by BEA and searched the web, but I could not find any information on how to read the version.
    Does anybody know how to do that or where to look in order to get the version numbers of the deployed components via JMX? Do I have to write my own MBean offering this version attribute?
    Every hint is welcomed!
    Thanks
    Toni
    Edited by: user10451156 on Oct 21, 2008 10:53 AM

    Hi, Toni.
    The input must be a externally provided version number, if you have no access to write manifest entries, or to the deployment process.
    If this version number is already set in the ear file, you can use this process inside your custom mbean (an elaboration of Benoit's suggestion)
    1 look up the application component from JMX
    * http://edocs.bea.com/wls/docs100/wlsmbeanref/mbeans/AppDeploymentMBean.html
    2 obtain the path of the ear file
    3 open a JarURLConnection to this ear
    * http://java.sun.com/javase/6/docs/api/java/net/JarURLConnection.html
    4 read the implementation version, which was already provided.
    * http://java.sun.com/javase/6/docs/api/java/util/jar/Attributes.Name.html#IMPLEMENTATION_VERSION
    Sadly, this won't pop-up on the WLS console, you'd have to write or use a custom extension to do that.
    * https://wls-console-extensions.projects.dev2dev.bea.com/
    I hope this helps.
    -Adrian

  • BAPI to read classification of Material Variant

    Hi experts,
    In our customer we are using material with a reference product KMAT (Material Variant), and we need a BAPI to read the configuration of the materials.
    Does anyone knows which BAPI can we use to read the configuration of the material variant?
    We tried to use the BAPI_PRDSRVAPS_GETCLASSES, but for material variant it didn't work, just to products that doesn't have a KMAT related.
    Thanks in advanced
    Thiago Cyrillo

    Thiago,
    Why dont you use a class like /SAPAPO/CL_MC01_CCV and method like GET_SINGLE_CHARVAL?
    Kedar

  • Function or bapi to upload the lead questionnaire to lead partner portal

    hi all,
    Is there any function or bapi to upload the lead questionnaire that exists in the marketing leads-lead partner portal . The survey should get attached to the lead . I am able to create the lead though with the LDPO process by a function module .Any help on this will be very useful.
    Thanks in advance.
    Mithun

    Hi Bharani,
    I can answer two of your questions:
    2. No, with a BAPI you cannot see the screens during processing.  After it is called you can display the BOM and check that the data is loaded correctly.
    3. You can see the error messages of the BAPI by looking in the RETURN structure.  This will contain details of any error, warning, information, and success messages generated during the creation of the BOM.
    Cheers,
    Brad

  • TS1192 'Could not read the iPhoto Library. The library at [file path] has a corrupted AlbumData.xml file.'

    Got this msh from Piasa...any ideas?  'Could not read the iPhoto Library. The library at [file path] has a corrupted AlbumData.xml file.'

    Contact Adobe support - that is not an iPhoto message - in general Piasa has no ability to access the iPhoto library - there have been hacks but often they do not worka nd can cause problems
    You need to user either Picasa or iPHoto - using both on the same photos is problematic
    LN

  • How to read the position in an linear encoder, model AT112 from mitutoyo?

    Hello,
    any one knows how to read the positon in a linear encoder, model AT112 from mitutoyo, that have the signal out in the sinusoidal form?
    thanks

    Hello Hugo,
    In order to help you efficiency, please contact National Instruments (01.48.14.24.24) with the reference number 409230.
    I will personnally help you to connect your linear encoder.
    Regards.

  • FM\BAPI To Assign the BP to the Org. Position

    Hi Friends,
    Kindly suggest me  any FM\BAPI to assign BP to the org. position.
    Regards,
    Narendra Goyal

    Check if CRM_ORGMAN_CREATE_REL_OBJ_UIU helps.

Maybe you are looking for

  • Activation after crash/new hard drive

    I purchased Studio MX and upgraded to ver 8 on the Mac. My hard drive has since crashed. I reinstalled and used the ver 8 serial number and provided my MX serial number. It says the serial number for ver 8 has already been activated. How do I reactiv

  • Printing scannable Bar Codes on PDF file?

    Hi: I am working a PO report (standard) and designing using RTF template to print as PDF output. I need to print the item as bar code that needs to be scanned. I downloaded a free font 39 and registered in Admin tab of XML Publisher responsibility. I

  • SharePoint Provider Hosted App

    Hi all, I'm new in SP online development, and I want to know how can I open a SharePoint Provider Hosted App in visual studio? what are the steps? can I use it if I'm not using Azure? thank's!!

  • Links no longer clickable in emails can't find where to change setting

    I changed a Firefox setting several months ago that no longer allows me to click and open the link in on that tab. I now have to right click and open link in a new tab. I cannot find anywhere to change the setting back. I find no settings for links.

  • Split columns in ALV Grid Display.

    Hi Currently we are displaying the output as below : currently : Docid | Created | Posted |       |          |      | Needed : Docid     |     Created     |     Posted     |          |X1     |X2     |X3     |X4     |      |     |     |     |     | no