1

I am trying to declare a global table gt_sel2 as type table zqmqnewslist(which is a structure), however one component of the zqmqnewslist which is PRUEF(type ZQMKZPRUEF), I do not want it in the newly table gt_sel2.

Is there any way to declare the table gt_sel2 as type zqmqnewslist without the component PRUEF? I know that we can also do it through a select, where we select all the necessary components of the table zqmqnewslist excluding PRUEF, but is there any short way?

Thank you all in advance!

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
Frank
  • 153
  • 3
  • 17

1 Answers1

2

Not with ABAP syntax.

If you use the old ABAP editor, you may do it in seconds as shown below. Let's assume you want to declare all components of BAPIRET2 except LOG_NO :

Click the "Pattern" button:

Pattern button in SE38

Type the DDIC structure, table or view name:

generate DATA for filtered components of structure BAPIRET2

Select all components:

select all structure components

Exclude by pressing at the same time the Ctrl key and selecting the line of the component with the mouse:

exclude component LOG_NO

Obtained code:

DATA: BEGIN OF ts_bapiret2,
        type       TYPE bapiret2-type,
        id         TYPE bapiret2-id,
        number     TYPE bapiret2-number,
        message    TYPE bapiret2-message,
        log_msg_no TYPE bapiret2-log_msg_no,
        message_v1 TYPE bapiret2-message_v1,
        message_v2 TYPE bapiret2-message_v2,
        message_v3 TYPE bapiret2-message_v3,
        message_v4 TYPE bapiret2-message_v4,
        parameter  TYPE bapiret2-parameter,
        row        TYPE bapiret2-row,
        field      TYPE bapiret2-field,
        system     TYPE bapiret2-system,
      END OF ts_bapiret2.

Now declare your internal table:

DATA bapiret2_tab LIKE TABLE OF ts_bapiret2.
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • however, this will not solve the problem of maintainability. When someone changes the original `zqmqnewslist` structure you have to change your code to reflect this, and this is what OP didn't wanted, as I got it – Suncatcher Dec 08 '21 at 14:39