cancel
Showing results for 
Search instead for 
Did you mean: 

Load 0WBS into internal table in start routine to lookup in transformation

LargePie04
Discoverer
0 Kudos
109

Hi all,

I'm struggling a bit with abap as I'm not an abaper, just trying to do something simple.

As the title states, I want to load 0WBS_ELEMT_ATTR (Fields: 0CO_OBJNR and 0WBS_ELEMT) into an internal table in start routine and use that to lookup.

In the start routine I've declared the table.

TYPES: BEGIN OF ty_wbs,
         co_objnr   TYPE /BI0/OICO_OBJNR,
         wbs_elemt  TYPE /BI0/OIWBS_ELEMT,
END OF ty_wbs.

Trying to load the table is where I'm running into trouble

SELECT co_objnr
       wbs_elemt
INTO TABLE it_wbs
FROM /BI0/PWBS_ELEMT
FOR ALL ENTRIES IN SOURCE_PACKAGE

This needs a where clause and I'm not sure how to write it.

the 0CO_OBJNR in 0WBS_ELEMT_ATTR is type CHAR and Length 22.

the routine I'm writing it in where I want to match PS_PSP_PNR is type NUMC and Length 08.

How can I write something like this without it erroring saying co_objnr and ps_psp_pnr are different type and length.

WHERE co_objnr = SOURCE_PACKAGE-PS_PSP_PNR

Thanks

 

Sandra_Rossi
Active Contributor
0 Kudos
Which ABAP version are you using? One solution which always works: define an internal table with components of the right length, and transfer SOURCE_PACKAGE into it.

Accepted Solutions (0)

Answers (1)

Answers (1)

raymond_giuseppi
Active Contributor
0 Kudos

The internal format for WBS element is 8 numeric characters, and external format is 24 alphanumeric characters. This is usually handled by a conversion-exit.

  • Those are copied in BW into fields WBS_ELEMT and WBS_ELM_EX. WBS_ELM_EX
  • OBJNR is a 22 alphanumeric character  field, for WBS its value is 'PR' concatenated with the 8 numeric character field and trailing spaces.

You could fill the internal table used in FOR ALL ENTRIES with only co_objnr+2(8)