Application Development 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: 

Include a type in a internal table declaration.

Former Member
0 Kudos

Hi.

How can I do this?:

TYPES: BEGIN OF ty_simples,

agr_name LIKE agr_define-agr_name,

text LIKE agr_texts-text.

TYPES: END OF ty_simples.

  • Transacciones de GS.

TYPES: BEGIN OF ty_transacciones_gs,

tcode LIKE agr_tcodes-tcode,

text LIKE bmeniface-text.

TYPES: END OF ty_transacciones_gs.

And after:

DATA: begin of t_simples occurs 0.

include structure ty_simples.

include structure ty_transacciones_gs.

data: end of t_simples.

I have got a verification error.

Thanks!

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

LIke this, but you have the "TEXT" field twice, which is not allowed, so you need to name them differently.



types: begin of ty_simples,
       agr_name like agr_define-agr_name,
       text1 like agr_texts-text.
types: end of ty_simples.
* Transacciones de GS.
types: begin of ty_transacciones_gs,
        tcode like agr_tcodes-tcode,
        text2 like bmeniface-text.
types: end of ty_transacciones_gs.


data: begin of t_simples occurs 0.
        include type ty_simples.                  "<--  USE TYPE 
        include type ty_transacciones_gs.   "<--  USE TYPE 
data: end of t_simples.

Regards,

RIch HEilman

4 REPLIES 4

0 Kudos

Hi,

use as follows

DATA: begin of t_simples occurs 0.

include type ty_simples.

include type ty_transacciones_gs.

data: end of t_simples.

else

DATA: begin of t_simples occurs 0.

agr_name LIKE agr_define-agr_name,

text LIKE agr_texts-text,

tcode LIKE agr_tcodes-tcode,

text LIKE bmeniface-text.

data: end of t_simples.

Regards,

Sesh

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

LIke this, but you have the "TEXT" field twice, which is not allowed, so you need to name them differently.



types: begin of ty_simples,
       agr_name like agr_define-agr_name,
       text1 like agr_texts-text.
types: end of ty_simples.
* Transacciones de GS.
types: begin of ty_transacciones_gs,
        tcode like agr_tcodes-tcode,
        text2 like bmeniface-text.
types: end of ty_transacciones_gs.


data: begin of t_simples occurs 0.
        include type ty_simples.                  "<--  USE TYPE 
        include type ty_transacciones_gs.   "<--  USE TYPE 
data: end of t_simples.

Regards,

RIch HEilman

raymond_giuseppi
Active Contributor
0 Kudos

Syntax is INCLUDE TYPE gibing

  data: begin of t_simples occurs 0.
          INCLUDE TYPE ty_simples.
          INCLUDE TYPE ty_transacciones_gs.
  DATA: END OF t_simples.

But as field text is TWICE defined, try

  data: begin of t_simples occurs 0.
  data    part1 TYPE ty_simples.
  data    part2 TYPE ty_transacciones_gs.
  DATA: END OF t_simples.

or remove one of the TEXT fields.

Regards

marcelo_ramos
Active Contributor
0 Kudos

Hi,

Use as follow,

TYPES: BEGIN OF ty_simples,
       agr_name LIKE agr_define-agr_name,
       text1 LIKE agr_texts-text.
TYPES: END OF ty_simples.

TYPES: BEGIN OF ty_transacciones_gs,
        tcode LIKE agr_tcodes-tcode,
        text2 LIKE bmeniface-text.
TYPES: END OF ty_transacciones_gs.
 
* INTERNAL TABLES  
data: BEGIN OF t_simples occurs 0.
        INCLUDE TYPE ty_simples.               
        INCLUDE TYPE type ty_transacciones_gs. 
data: END OF t_simples.

Regards.

Marcelo Ramos