Skip to Content

Importing HR Clusterdata in Object Oriented Programing

Apr 13 at 04:33 AM


avatar image
Former Member


I'm new to object oriented programing.
I'm having problems using the IMPORT Syntax to read clusterdata from PCL4(LA) in a Global Class.

I've read all the documentation but can't find the solution or problem.

Let's give you my code.

In procedual code I've used:

INCLUDE: rpc4la00.
SELECT srtfd aedtm uname
FROM pcl4
WHERE relid = 'LA'
  AND srtfd = 'A100119992006201803230946550001'. "Example 
LOOP AT it_pcl4 INTO wa_pcl4.
MOVE wa_pcl4-srtfd TO lo-key.
IMPORT header belege FROM DATABASE pcl4(la) ID lo-key. 
"Most of the stuff gets its definition from the include

This works just fine. "header" and "belege" get's filled.
I can't use this type of coding in OO since it's obsolete and the include uses obsolete code as well.

So my OO-Code looks like this (simplified).

Data:     gt_pcl4    TYPE TABLE OF pcl4,
          gt_header  TYPE TABLE OF pc403,
          gs_header  TYPE pc403,
          gt_version TYPE TABLE OF pc402,
          gt_belege  TYPE TABLE OF pc404,
          gs_belege  TYPE pc404.
"Defining them since I can't use the include.

METHOD get_key_id.
  SELECT srtfd
    FROM pcl4
 WHERE srtfd = 'A100119992006201803230946550001'.

METHOD import_header_belege.
 MOVE iv_id TO gs_key.  "which is gs_pcl4-srtfd.

All of the above works fine as well. The key is correctly filled.

Now to the syntax for importing the data.

I've used combinations of

  DATA: wa TYPE pcl4.

    IMPORT pc403 =  gt_header  FROM DATABASE pcl4(la) TO wa ID gs_key.
    IMPORT pc403 = gs_header  FROM DATABASE pcl4(la) TO wa ID gs_key.

The only thing that gets filled is "wa"

Edit: see:

Can anyone explain why gt_header is not getting filled with the data from the database?
Maybe not using the syntax correctly?
As I've said the procedual coding works.

Thank you in advance.

wa.png (15.5 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Bartosz Siminski Apr 13 at 08:09 AM

I've noticed that you are skipping some key fields from PCL4 in OO sample so you are selecting all RELID types and probably there is already some with the same ID but with different cluster content. That's why I believe that proper code should look more like this:

SELECT relid srtfd srtf2 FROM pcl4.
Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thank you for your input.

The Structure gs_key(type PC400), which is the ID for selecting the data from the database, only consists of the following:

So while I think that you are correct and I will implement it in the final coding, it should't matter for selecting the data from the database collection.

Edit: I tried it and I still don't get the data from the cluster.

pc400.png (7.9 kB)

Second thig that needs to be adjusted is the name of cluster table from pc403 to header:

import header = gt_header from ...

This is because if you will look into RPCBDT00 definition mentioned structure PC403 is just an include of table definition called HEADER.

Former Member

Thank you :)

You are correct! It now works!

Is there any way to check for the parameter list except diving into the code?

Edit: Maybe to clarify. How would I get the correct name doing it dynamically.