2023 Jul 14 9:12 AM
Hello everyone,
I have one interface which is used for 3 classes and I have one class from this classes is Abstract class I need a way to to exclude this class when I call the program, please find my code here:
2023 Jul 14 11:02 AM
LOOP AT lt_classes ASSIGNING FIELD-SYMBOL(<print_cl>).
DATA: get TYPE REF TO zmar_if_handson .
CREATE OBJECT get TYPE (<print_cl>-clsname).
SELECT SINGLE @abap_true INTO @DATA(lv_exists) FROM seoclassdf WHERE clsname= @<print_cl>-clsname AND clsabstrct = @abap_true.
IF sy-subrc = 0 AND lv_exists = abap_true.
ls_output-daemon_name = get->naming( ).
ls_output-priority = get->priority( ).
ls_output-damon_config = get->get_daemon_start_config( ).
APPEND ls_output TO lt_output.
ENDIF.
ENDLOOP.
You need to review the basic grammar of ABAP.
2023 Jul 14 9:16 AM
TABLE: "SEOCLASSDF"
FIELD: "CLSABSTRCT" = 'X'
SELECT SINGLE @ABAP_TRUE INTO @DATA(LV_EXISTS) FROM SEOCLASSDF WHERE CLSNAME= @<print_cl>-clsname AND CLSABSTRCT = @ABAP_TRUE.
IF SY-SUBRC = 0 AND LV_EXISTS = ABAP_TRUE.
" ABSTRCT CLASS
ELSE.
ENDIF.
2023 Jul 14 9:18 AM
Thank you for your answer, but can you please explain more?
2023 Jul 14 9:23 AM
SE16N, paste your classname into the SEOCLASSDF-CLSNAME, observe the value of CLSABSTRCT and you will understand.
2023 Jul 14 9:45 AM
I Understand now but when i pass my class name into CLSNAME = @myclass_name I get an error says that this field is uknown IDK why, do you have why is this happening?
2023 Jul 14 9:48 AM
Please provide a screenshot of the error & paste your code.
2023 Jul 14 10:03 AM
SELECT SINGLE @ABAP_TRUE INTO @DATA(LV_EXISTS) FROM SEOCLASSDF WHERE CLSNAME = @ZMAR_HANDSON2 AND CLSABSTRCT = @ABAP_TRUE.
IF sy-subrc = 0 and lv_exists = ABAP_TRUE.
ELSE.
ENDIF.
And this is my error:
2023 Jul 14 10:06 AM
2023 Jul 14 10:11 AM
2023 Jul 14 10:21 AM
2023 Jul 14 10:31 AM
Yes the error is gone thank you, but it didn't select the class from the 3 classes which using the same interface, I use this line in this loop
'' lt_classes'' is a table which conssest the 3 classes which using the same interface and this is the error:
2023 Jul 14 2:14 PM
omar.saber Better post code as text rather than image (impossible to copy/paste)
2023 Jul 14 9:31 AM
Please use the CODE button when pasting code. It makes it easier to read and you're more likely to get an answer.
2023 Jul 14 10:04 AM
2023 Jul 14 11:02 AM
LOOP AT lt_classes ASSIGNING FIELD-SYMBOL(<print_cl>).
DATA: get TYPE REF TO zmar_if_handson .
CREATE OBJECT get TYPE (<print_cl>-clsname).
SELECT SINGLE @abap_true INTO @DATA(lv_exists) FROM seoclassdf WHERE clsname= @<print_cl>-clsname AND clsabstrct = @abap_true.
IF sy-subrc = 0 AND lv_exists = abap_true.
ls_output-daemon_name = get->naming( ).
ls_output-priority = get->priority( ).
ls_output-damon_config = get->get_daemon_start_config( ).
APPEND ls_output TO lt_output.
ENDIF.
ENDLOOP.
You need to review the basic grammar of ABAP.
2023 Jul 14 11:12 AM
I am a beginner to ABAP programming and have only been started 3 weeks ago so I still learning, But thank you very much for your help, I am really appreciate it 🙂
2023 Jul 14 11:15 AM
2023 Jul 14 2:13 PM