Skip to Content
avatar image
-3
Former Member

Importing HR Clusterdata in Object Oriented Programing

Hello,

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
INTO CORRESPONDING FIELDS OF TABLE it_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
ENDLOOP.

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
    INTO CORRESPONDING FIELDS OF TABLE gt_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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    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.
    Add comment
    10|10000 characters needed characters exceeded

    • 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.