2021 Dec 07 6:37 AM
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 }|.
2021 Dec 07 6:58 AM
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 ).
2021 Dec 07 7:00 AM
If it is a study, you could do it creating a local class / local interface. (you have 1 hour !) 😉