cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

create inline a filter table with new abap syntax

sebastian_wilhelm1
Participant
6,362

Hi experts!

I have a table productions containing, among others, article ids. Now I want to loop over all entries for which no Article ID exists in the articleIs table. Can I do this inline with the new abap syntax. 

Something like this

 

LOOP AT filter #( productions IN articles where ArticleId not in articles-ArticleId ) INTO DATA(production).

 

Does anyone know if this is possible.

Thanks and regards,

Sebastian

Accepted Solutions (1)

Accepted Solutions (1)

patrick_winkler
Product and Topic Expert
Product and Topic Expert
    TYPES: BEGIN OF ty_production,
             prod_id    TYPE string,
             article_id TYPE string,
           END OF ty_production,
           BEGIN OF ty_article,
             article_id TYPE string,
           END OF ty_article,
           tt_productions TYPE SORTED TABLE OF ty_production WITH UNIQUE KEY prod_id,
           tt_articles    TYPE SORTED TABLE OF ty_article    WITH UNIQUE KEY article_id.

    DATA(productions) = VALUE tt_productions( ( prod_id = 'P1' article_id = 'A1' )
                                              ( prod_id = 'P2' article_id = 'A2' )
                                              ( prod_id = 'P3' article_id = 'A3' ) ).
    DATA(articles) = VALUE tt_articles( ( article_id = 'A1' )
                                        ( article_id = 'A3' )
                                        ( article_id = 'A4' ) ).

    LOOP AT FILTER #(  productions EXCEPT IN articles WHERE article_id = article_id )
      ASSIGNING FIELD-SYMBOL(<prod_with_not_exst_art>).
      out->write( <prod_with_not_exst_art>-prod_id ).
    ENDLOOP.

Answers (0)