Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP OO: Create data

Former Member
0 Likes
1,259

Hello,

I'am experiencing some problems with a Z-Class.

I want to read data from HR-Infotypes. Normaly you can use log. database PNP, macro PROVIDE, GET PERNR and so on.

This you can not use in a class (if there is a way, I would be happy to know how).

So far, I decided to use the function module:

HR_READ_INFOTYPE

So I need a different internal table every time I want to read/check a knew infotype.

Therefore I use the following attributes:

DDIC_TABLENAME;Instance Attribute;Private;Type TABNAME16

ITAB;Instance Attribute;Private;Type Ref To DATA

ITAB should be my dynamic internal table, DDIC_TABLENAME the name of the infotype in use.

Coding in my method:

FIELD-SYMBOLS: <ITAB> TYPE ANY TABLE,

<W_TAB> TYPE ANY.

CREATE DATA: ITAB TYPE (ME->DDIC_TABLENAME).

ASSIGN: ME->ITAB->* TO <ITAB>.

But I'am getting the following dump:

CREATE DATA: The type entered (" ") is not a valid data type.

What's wrong with that?

Regards

Maik

8 REPLIES 8
Read only

Former Member
0 Likes
938

hi,

Change the statement

CREATE DATA: ITAB TYPE (ME->DDIC_TABLENAME).

as

CREATE DATA: ITAB TYPE <b>ME->(DDIC_TABLENAME)</b>.

Regards,

Sailaja.

Read only

0 Likes
938

Hi,

this is causing the following error during activating:

You cannot use constructor parameters in a dynamic CREATE OBJECT.

Regards

Maik

Read only

Former Member
0 Likes
938

table_name = ME->DDIC_TABLENAME.

CREATE DATA itab TYPE STANDARD TABLE OF (table_name).

Regards,

ravi

Read only

0 Likes
938

Hi,

no, it doesn't work: by the way:

System is 4.6C !!!!

CREATE DATA: ITAB TYPE STANDARD TABLE OF (TABLE_NAME).

Table is unknown

As I know, this coding works only with 4.7 and higher.

Regards

Maik

Read only

0 Likes
938

Hi

You're right and so you can create an internal table dunamically only using method CREATE_DYNAMIC_TABLE of cllass CL_ALV_TABLE_CREATE.

Max

Read only

0 Likes
938

Hi,

I tried this way already, but I'am getting a dump too:

GENERATE_SUBPOOL_DIR_FULL

What does this mean?

I used the same coding as I already used in productive programms:

  • DATA: I_FCAT TYPE LVC_T_FCAT,

  • ITABREF TYPE REF TO DATA,

  • WTABREF TYPE REF TO DATA.

*

  • FIELD-SYMBOLS: <S> TYPE ANY, "Structure

  • <T> TYPE STANDARD TABLE, "Table

  • <FCAT> TYPE LVC_T_FCAT.

*

  • FREE: I_FCAT, ITABREF.

  • CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

  • EXPORTING

  • I_STRUCTURE_NAME = DDIC_TABLENAME

  • CHANGING

  • CT_FIELDCAT = I_FCAT

  • EXCEPTIONS

  • INCONSISTENT_INTERFACE = 1

  • PROGRAM_ERROR = 2

  • OTHERS = 3.

*

  • CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE

  • EXPORTING

  • IT_FIELDCATALOG = I_FCAT

  • IMPORTING

  • EP_TABLE = ITABREF.

*

  • ASSIGN ITABREF->* TO <T>. "Tab

  • ASSIGN I_FCAT TO <FCAT>. "Fieldcat

  • CREATE DATA WTABREF LIKE LINE OF <T>. "Structure

  • ASSIGN WTABREF->* TO <S>.

Regards

Maik

Read only

0 Likes
938

Hi

If I remember it can generate only certain number of subroutine: from SAP help:

............

Up to 36 temporary subroutine pools can currently be managed for each roll area.

Max

Read only

0 Likes
938

Hi,

yes, you're right - 36 in one session.

So that's the end of it? A rat trap?

Regards

Maik