2

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?

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
toffler
  • 1,231
  • 10
  • 27

2 Answers2

3

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 ).
Suncatcher
  • 10,355
  • 10
  • 52
  • 90
  • Thank you - you pointed me in the right direction. 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. However, since you brought me to the PRPS table, I'll accept your answer. – toffler Jun 01 '22 at 13:08
  • indeed, I was going to tell that there is no other way than to fetch orders, PRs, requests manually from tables, but I thought it was obvious and needless to mention :) – Suncatcher Jun 01 '22 at 13:10
1

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)
toffler
  • 1,231
  • 10
  • 27