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!)

Hi @Emmanuelzion

Sorry for not seeing this earlier. The errors you got are because of an incorrect syntax in the type definitions. Currently the ABAP integration in Exercism so not able to give better more detailed error messages in this case (it’s still pretty new).

The itab exercises are a bit advanced for a beginner in ABAP. Try some of the easier ones like “reverse” or “two fer” at the start. Requesting a mentor will also help you learn more quickly if you’re stuck (better than the forum).

Finally, if you have other technical issues with ABAP, it’s better to check for known issues or open a new issue in the corresponding repo on GitHub: ABAP on Exercism

Best
Marc

I’m not an absolute beginner at programming, but I am new to ABAP. I tried to tackle this exercise for a few hours, checked every syntax reference I could, double-checked everything, until I noticed that the errors were in cl_itab_basics.clas.testclasses.abap. I don’t discard the possibility that the errors are related to something I’m doing wrong with my code in zcl_itab_basics.clas.abap. But either way, I’m going to go ahead and try a different exercise.

We received the following error when we ran your code:

./zcl_itab_basics.clas.testclasses.abap[3, 10]  - Variable "CUT" contains unknown: REF, unable to resolve zcl_itab_basics (unknown_types) [E]
./zcl_itab_basics.clas.testclasses.abap[16, 5]  - Target type unknown, cut (check_syntax) [E]
./zcl_itab_basics.clas.testclasses.abap[21, 5]  - "DATA" not found, Target (check_syntax) [E]
./zcl_itab_basics.clas.testclasses.abap[22, 5]  - "actual" not found, findTop (check_syntax) [E]
./zcl_itab_basics.clas.testclasses.abap[54, 5]  - Method "fill_itab" not found, methodCallChain (check_syntax) [E]
./zcl_itab_basics.clas.testclasses.abap[62, 5]  - Statement does not exist in ABAPopen-abap(or a parser error), "cl_abap_unit_assert" (parser_error) [E]
./zcl_itab_basics.clas.testclasses.abap[105, 5] - Method "add_to_itab" not found, methodCallChain (check_syntax) [E]
./zcl_itab_basics.clas.testclasses.abap[114, 5] - Statement does not exist in ABAPopen-abap(or a parser error), "cl_abap_unit_assert" (parser_error) [E]
./zcl_itab_basics.clas.testclasses.abap[154, 5] - Method "sort_itab" not found, methodCallChain (check_syntax) [E]
./zcl_itab_basics.clas.testclasses.abap[160, 5] - Statement does not exist in ABAPopen-abap(or a parser error), "cl_abap_unit_assert" (parser_error) [E]
./zcl_itab_basics.clas.testclasses.abap[166, 5] - Method "search_itab" not found, methodCallChain (check_syntax) [E]
abaplint: 11 issue(s) found

If you want help, it would be good to share your code :slight_smile: Without seeing any code, it’s hard to say anything other than the linter is probably working correctly.

Hey @Emmanuelzion it seems the way you are declaring the TYPES is not correct.
You can use only built-in types or DDIC types to declare the field. Ex:

description TYPE string GROUP A-2,
group TYPE group B,
number TYPE i 5,
description TYPE group B,

This above is not valid.
Please check my solution here Exercism and you will understand, also please read about ABAP types here: Built-In ABAP Types - ABAP Keyword Documentation

I’m sure you will find your solution.

Best regards, Raquel

1 Like