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: 

Is single type structure and elementary type structure the same?

Former Member
0 Kudos
102

Apologies as I just started learning ABAP this month and currently doing a self-study bootcamp on my current employer.

I've encountered a problem with this kind of instruction:

1.0 putting all the variables in a single type structure (ls_profile).

This is my work:

TYPES:  BEGIN OF ls_profile,
            employee_number TYPE string,
            first_name TYPE string,
            last_name TYPE string,
            birthdate TYPE string,
            dream_salary TYPE string,
            hobby TYPE string,
        END OF ls_profile. 

2.0 Create a structured variable (wa_profile) using the correct types.

2.1 Populate the structured variable with the correct data.

DATA(wa_profile) = VALUE ls_profile( employee_number = 'Employee Number' 
first_name = 'First Name'
last_name = 'Last Name'
birthdate = 'Birthdate'
dream_salary = 'Dream Salary'
hobby = 'Hobby').
3.0 Display the contents of the structure.

WRITE:  |{ wa_profile-employee_number }|,
    /   |{ wa_profile-first_name }|,
    /   |{ wa_profile-last_name }|,
    /   |{ wa_profile-birthdate }|,
    /   |{ wa_profile-dream_salary }|,
    /   |{ wa_profile-hobby }|.

Am I doing it right?
2 REPLIES 2

FredericGirod
Active Contributor
0 Kudos
47

String is a text, I am not sure the birtdate should be a text. I think it should be a date. Same for dream_salary.

The 2.0 seams to means you have to create-it using the old method DATA my_structure TYPE my_type.

For the last one, you could use cl_demo_output=>display_data( wa_profile ).

FredericGirod
Active Contributor
47

If it is a study, you could do it creating a local class / local interface. (you have 1 hour !) 😉