cancel
Showing results for 
Search instead for 
Did you mean: 

Error is: No component exists with the name "FOR".

sh4il3sh
Participant
0 Kudos
378

Question title is the error I get in complier:

I simply want to concatenate all BAPI error messages, I can do with Reduce maybe.
but now I am curious why am I getting error.

ls_head is a structure with fields MSGTYP, MESSAGE(char1024) etc..
I understand that another ( ) after FOR essentially means creating rows with every loop which is obviously wrong but I get error for the line above it first.

Code below:

 

 

DATA: ls_head TYPE ZSK_S_VBAK. 

ls_head = VALUE #( FOR <ls_ret> IN lt_return2 WHERE ( type = 'E' ) 
       ( message = message && lc_semicol && <ls_ret>-message ) ).

 

 

 

Ryan-Crosby
Active Contributor
0 Kudos
You haven't assigned a variable for iterating lt_return2. It should be something like FOR msg IN lt_return2.
sh4il3sh
Participant
0 Kudos
@Ryan-Crosby It was omitted in this post idk how, but the error remains.
View Entire Topic
lou_
Explorer

Hi, according to the documentation you can't use FOR with VALUE if your type is a structure. This is only possible if your type is an internal table. 

VALUE - Structures
Syntax
... VALUE dtype|#( [let_exp]
                   [BASE dobj]
                   comp1 = dobj1 comp2 = dobj2 ... ) ...

VALUE - Internal Tables
Syntax
... VALUE dtype|#( [let_exp]
                   [BASE itab]
                   [FOR for_exp1
                    FOR for_exp2
                    ... ]
                   ( line_spec1 )
                   ( line_spec2 )
                     ... ) ...

Regards.

sh4il3sh
Participant
0 Kudos
thank you! now I know the reason why REDUCE worked.