I really do not know how to go about the test I was given as I have tried to solve it without any progress

Learn the basics about ABAP internal tables.

Your class has an internal table named initial_data. It has three columns: GROUP, NUMBER, and DESCRIPTION.

Step 1

Your first task is to complete the method fill_itab and place 6 records into this table with the following values:

GROUP NUMBER DESCRIPTION
A 10 Group A-2
B 5 Group B
A 6 Group A-1
C 22 Group C-1
A 13 Group A-3
C 500 Group C-2

It might be helpful to share which test is failing, what the error is and what code you tried.

We received the following error when we ran your code:

./zcl_itab_basics.clas.abap[9, 5] - Statement does not exist in ABAPopen-abap(or a parser error), "TYPES" (parser_error) [E]
./zcl_itab_basics.clas.abap[9, 5] - Statement does not exist in ABAPopen-abap(or a parser error), "TYPES" (parser_error) [E]
./zcl_itab_basics.clas.abap[9, 5] - Statement does not exist in ABAPopen-abap(or a parser error), "TYPES" (parser_error) [E]
./zcl_itab_basics.clas.abap[9, 5] - Statement does not exist in ABAPopen-abap(or a parser error), "TYPES" (parser_error) [E]
./zcl_itab_basics.clas.abap[9, 5] - Statement does not exist in ABAPopen-abap(or a parser error), "TYPES" (parser_error) [E]
./zcl_itab_basics.clas.abap[9, 5] - Statement does not exist in ABAPopen-abap(or a parser error), "TYPES" (parser_error) [E]
abaplint: 6 issue(s) found

tbh I’m a beginner and I want to learn but its really giving me hard time

You are definitely heard.

Are you a beginner with programming, or a beginner only in ABAP?

What does your solution (attempted solution) look like?

I’m a total beginner in every aspect of programming

CLASS zcl_itab_basics DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .

PUBLIC SECTION.
TYPES group TYPE c LENGTH 1.
TYPES: BEGIN OF initial_type,
group TYPE group,
number TYPE i,
description TYPE string,
group TYPE group A,
number TYPE i 10,
description TYPE string GROUP A-2,
group TYPE group B,
number TYPE i 5,
description TYPE group B,

       END OF initial_type,
       itab_data_type TYPE STANDARD TABLE OF initial_type WITH EMPTY KEY.

METHODS fill_itab
       RETURNING
         VALUE(initial_data) TYPE itab_data_type.

METHODS add_to_itab
       IMPORTING initial_data TYPE itab_data_type
       RETURNING
        VALUE(updated_data) TYPE itab_data_type.

METHODS sort_itab
       IMPORTING initial_data TYPE itab_data_type
       RETURNING
        VALUE(updated_data) TYPE itab_data_type.

METHODS search_itab
       IMPORTING initial_data TYPE itab_data_type
       RETURNING
         VALUE(result_index) TYPE i.

PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.

CLASS zcl_itab_basics IMPLEMENTATION.
METHOD fill_itab.
"add solution here
ENDMETHOD.

METHOD add_to_itab.
updated_data = initial_data.
"add solution here
ENDMETHOD.

METHOD sort_itab.
updated_data = initial_data.
"add solution here
ENDMETHOD.

METHOD search_itab.
DATA(temp_data) = initial_data.
"add solution here
ENDMETHOD.

ENDCLASS.

this is my solution and it might look embarrassing but yes it is my solution

Not to discourage you, because that is not the intention here, but you might want to look at this discussion about being a beginner in programming and how it relates here, along with our ideas about what is coming to address that.

It can be done, but my suggestion is to find a mentor that can help you navigate these waters, or go down that road on these tires, as it were.

Good luck on your adventure. While it can be done here, from this starting point, you will want to have some additional resources and hopefully some good mentors.

1 Like

You should see pictures of (anything) that I started doing, when learning, and I guarantee you they could be a source of embarrassment, except that I think “how can it be embarrassing when it looks like anyone that ever did that thing for the first time?”

So, no, I am not embarrassed to look at code that looks like that, and neither should you.

Ok thank you very much I appreciate a lot …

By any chance did you watch ForrestKnight that led you to this website?

Best advice is to come here once you have learned all the basic tools you need to do the exercises here?

If you do not have a good reason to learn ABAP specifically (like work, or friends, or pre-existing code you want to work on, or…), as a complete beginner you might want to look elsewhere for your first language. Judging by how very little I have heard of ABAP in some 14 years of being around, I fear a relative lack of learning resources about ABAP.

(I realize that absence of evidence is merely weak evidence of absence; please correct me if I’m wrong on this!)