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

Types

Former Member
0 Likes
819

hi

can any one explain me reg the declaration of types, based on that declaring the internal tables and work areas. with an example.

regards

ratna

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
781
  • Types for Quants

TYPES: BEGIN OF TY_LQUA,

LENUM TYPE LQUA-LENUM,

MATNR TYPE LQUA-MATNR,

WERKS TYPE LQUA-WERKS,

LGORT TYPE LQUA-LGORT,

GESME TYPE LQUA-GESME,

GEWEI TYPE LQUA-GEWEI,

SONUM TYPE LQUA-SONUM,

LGTYP TYPE LQUA-LGTYP,

LGPLA TYPE LQUA-LGPLA,

END OF TY_LQUA,

  • Types for the Final Internal table

BEGIN OF TY_FINAL,

FLAG(1),

LENUM TYPE LQUA-LENUM,

MATNR TYPE LQUA-MATNR,

GESME TYPE LQUA-GESME,

GEWEI TYPE LQUA-GEWEI,

LGTYP TYPE LQUA-LGTYP,

LGPLA TYPE LQUA-LGPLA,

MBLNR TYPE MSEG-MBLNR,

GJAHR TYPE MSEG-GJAHR,

TANUM TYPE LTAK-TANUM,

STATUS(100),

END OF TY_FINAL.

************************************************************************

  • INTERNAL TABLES *

  • *

************************************************************************

DATA: IT_LQUA TYPE TABLE OF TY_LQUA, "Quants table

IT_FINAL TYPE TABLE OF TY_FINAL. "Final Internal Table

************************************************************************

  • WORK AREAS *

  • *

************************************************************************

DATA: X_LQUA TYPE TY_LQUA, "Quants

X_FINAL TYPE TY_FINAL. "Final

4 REPLIES 4
Read only

Former Member
0 Likes
782
  • Types for Quants

TYPES: BEGIN OF TY_LQUA,

LENUM TYPE LQUA-LENUM,

MATNR TYPE LQUA-MATNR,

WERKS TYPE LQUA-WERKS,

LGORT TYPE LQUA-LGORT,

GESME TYPE LQUA-GESME,

GEWEI TYPE LQUA-GEWEI,

SONUM TYPE LQUA-SONUM,

LGTYP TYPE LQUA-LGTYP,

LGPLA TYPE LQUA-LGPLA,

END OF TY_LQUA,

  • Types for the Final Internal table

BEGIN OF TY_FINAL,

FLAG(1),

LENUM TYPE LQUA-LENUM,

MATNR TYPE LQUA-MATNR,

GESME TYPE LQUA-GESME,

GEWEI TYPE LQUA-GEWEI,

LGTYP TYPE LQUA-LGTYP,

LGPLA TYPE LQUA-LGPLA,

MBLNR TYPE MSEG-MBLNR,

GJAHR TYPE MSEG-GJAHR,

TANUM TYPE LTAK-TANUM,

STATUS(100),

END OF TY_FINAL.

************************************************************************

  • INTERNAL TABLES *

  • *

************************************************************************

DATA: IT_LQUA TYPE TABLE OF TY_LQUA, "Quants table

IT_FINAL TYPE TABLE OF TY_FINAL. "Final Internal Table

************************************************************************

  • WORK AREAS *

  • *

************************************************************************

DATA: X_LQUA TYPE TY_LQUA, "Quants

X_FINAL TYPE TY_FINAL. "Final

Read only

anversha_s
Active Contributor
0 Likes
781

hi,

*&---------------------------------------------------------------------*
*& Report  ZTYPES                                                      *
*&                                                                     *
*&---------------------------------------------------------------------*
REPORT  ZTYPES                                                  .

* Table declaration (old method)
DATA: BEGIN OF tab_ekpo OCCURS 0,             "itab with header line
  ebeln TYPE ekpo-ebeln,
  ebelp TYPE ekpo-ebelp,
 END OF tab_ekpo.

*Table declaration (new method)     "USE THIS WAY!!!
TYPES: BEGIN OF t_ekpo,
  ebeln TYPE ekpo-ebeln,
  ebelp TYPE ekpo-ebelp,
 END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,      "itab
      wa_ekpo TYPE t_ekpo.                    "work area (header line)

* Build internal table and work area from existing internal table
DATA: it_datatab LIKE tab_ekpo OCCURS 0,      "old method
      wa_datatab LIKE LINE OF tab_ekpo.

* Build internal table and work area from existing internal table,
* adding additional fields
TYPES: BEGIN OF t_repdata.
        INCLUDE STRUCTURE tab_ekpo.  "could include EKKO table itself!!
TYPES: bukrs  TYPE ekpo-werks,
       bstyp  TYPE ekpo-bukrs.
TYPES: END OF t_repdata.
DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0,   "itab
      wa_repdata TYPE t_repdata.                 "work area (header line)

Rgs

Annver

if hlped pls mark points

Read only

Former Member
0 Likes
781
Read only

Former Member
0 Likes
781

Hi Ratna,

When you want delcare your own date types ,You choose the option using types.

Types doesn't occupy any memory as it template and it is modify the structure of many objects declared using this easily .

Regards,

siva