How to get CJ20N project hierarchy?

Viewed 227

I need to get the hierarchy of a project (like shown in transaction CJ20N) in ABAP. I've found a function module 'GET_PROJECT_HIERARCHY', which delivers me a table like this:

enter image description here

However, I rather need all WBS elements, order numbers, purchase requests and network elements (AUFNR) in this project. Is there a better function module or a next step to the GET_PROJECT_HIERARCHY?

2 Answers

At least what concerns WBS elements you can get them from table PRPS

DATA: lt_prhi TYPE TABLE OF prhi.

CALL FUNCTION 'GET_PROJECT_HIERARCHY'
  EXPORTING
    i_pronr = '00000113'
  TABLES
    t_prhi  = lt_prhi.

SELECT * FROM prps 
  INTO TABLE @DATA(lt_prps) 
   FOR ALL ENTRIES IN lt_prhi 
 WHERE pspnr = lt_prhi-posnr.

cl_demo_output=>display( lt_prps ).

Thank you Suncatcher, your directed me the right way with the PRPS table and I'll accept your answer. I finally decided to build a custom query, looking in the tables PRPS, AFVC, AUFK, AFKO and PROJ to get all the data I want using the PSPHI column from GET_PROJECT_HIERARCHY.

I just wanted to post my solution, maybe it helps others too.

SELECT 
   PROJ~PSPID, 
   PROJ~POST1 AS PROJ_NAME, 
   PRPS~POST1 AS WSB_NAME, 
   AFVC~LTXA1, 
   AUFK~KTEXT
 FROM 
  PRPS 
   LEFT JOIN PROJ ON PROJ~PSPNR = PRPS~PSPHI 
   LEFT JOIN AUFK ON AUFK~PSPEL = PRPS~PSPNR 
   LEFT JOIN AFKO ON AUFK~AUFNR = AFKO~AUFNR 
   LEFT JOIN AFVC ON AFKO~AUFPL = AFVC~AUFPL
 WHERE 
  PRPS~PSPHI = '00000136'
 INTO TABLE @DATA(LT_RESULT)
Related