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

Problem on TY_SAPLANES

Former Member
0 Likes
447

I have code the folowing example and i Keep recieving the error MSG The work area "list_of_planetypes" is not long enough, any suggestions???

THanks ins Advance!

Erick

CLASS lcl_airplane DEFINITION.

PUBLIC SECTION.

METHODS: constructor IMPORTING

im_name TYPE string

im_planetype TYPE saplane-planetype,

display_attributes.

CLASS-METHODS: display_no_airplanes,

class_constructor.

PRIVATE SECTION.

DATA: name TYPE string,

planetype TYPE saplane-planetype.

TYPES:BEGIN OF ty_planetypes,

planetype TYPE saplane-planetype,

END OF ty_planetypes.

CLASS-DATA no_airplanes TYPE i.

CLASS-DATA: wa_list_of_planetypes TYPE ty_planetypes,

list_of_planetypes TYPE STANDARD TABLE OF ty_planetypes.

ENDCLASS. "lcl_airplane

CLASS lcl_airplane IMPLEMENTATION.

METHOD constructor.

name = im_name.

planetype = im_planetype.

no_airplanes = no_airplanes + 1.

ENDMETHOD. "constructor

METHOD display_attributes.

WRITE: / icon_ws_plane AS ICON,

/ 'Name of airplane:'(001), AT 30 name,

/ 'Airplane type'(002), AT 30 planetype.

ENDMETHOD. "display_attributes

METHOD display_no_airplanes.

WRITE: /, /'Total of number planes'(ca1), AT 30 no_airplanes LEFT-JUSTIFIED.

ENDMETHOD. "display_no_airplanes

METHOD class_constructor.

SELECT * FROM saplane INTO TABLE list_of_planetypes.

ENDMETHOD. "class_constructor

ENDCLASS. "lcl_airplane IMPLEMENTATION

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
399

Hi.

This occurs because the type ty_planetypes that you defined have only one field from the saplane structure and in the select you´re are retrieving all the fields from the structure. Try to change the select command like follows:

SELECT planetype FROM saplane INTO TABLE list_of_planetypes.

or change the type to have the same structure from the DDIC.

You can use the select command as follow, too:

 SELECT * FROM saplane INTO CORRESPONDING FIELDS OF TABLE list_of_planetypes.

But for performance reasons the first select it's recommended.

Regards,

1 REPLY 1
Read only

Former Member
0 Likes
400

Hi.

This occurs because the type ty_planetypes that you defined have only one field from the saplane structure and in the select you´re are retrieving all the fields from the structure. Try to change the select command like follows:

SELECT planetype FROM saplane INTO TABLE list_of_planetypes.

or change the type to have the same structure from the DDIC.

You can use the select command as follow, too:

 SELECT * FROM saplane INTO CORRESPONDING FIELDS OF TABLE list_of_planetypes.

But for performance reasons the first select it's recommended.

Regards,