2019 May 15 8:22 AM
HI,
i´m just a little confused. I want to append a table_line to deep structure by using table expression, but the syntax check didn´t know the ITAB (field"..." unknown...."
Append value #( wa ) to itab_a[ col_a = 'xyz' ]-itab_b.
Could anyone explain me my fault?
Thanks a lot 🙂
2019 May 15 11:40 AM
TYPES:
BEGIN OF ty_alv_data,
kunnr TYPE kunnr,
name1 TYPE name1,
ort01 TYPE ort01,
land1 TYPE land1,
t_color TYPE lvc_t_scol,
END OF ty_alv_data.
TYPES: tt_alv_data TYPE STANDARD TABLE OF ty_alv_data
WITH DEFAULT KEY.
DATA(itab_alv) = VALUE tt_alv_data( (
kunnr = '123'
name1 = 'ABCD'
ort01 = 'LV'
land1 = 'NV'
t_color = VALUE #( ( fname = 'KUNNR'
color-col = col_negative
color-int = 0
color-inv = 0 )
( fname = 'ORT01'
color-col = col_total
color-int = 1
color-inv = 1 ) ) )
( kunnr = '456' name1 = 'XYZ'
ort01 = 'LA' land1 = 'CA' ) ).
* ### EDIT ###
DATA(wa_col) = VALUE lvc_s_scol( fname = 'KUNNR'
color-col = col_negative
color-int = 0
color-inv = 0 ).
APPEND VALUE #( wa_col ) TO itab_alv[ 2 ]-t_color.
*FAIL "ITAB_ALV[" is not a field name.
APPEND wa_col TO itab_alv[ 2 ]-t_color.
* "ITAB_ALV[" is not a field name.
2019 May 15 11:44 AM
Each append throws the msg ""ITAB_ALV[" is not a field name."
Maybe the append-statement cannot process the table expression?
Sure, i can use assign fieldsymbol etc. but i wanna try it to build it with "new logic".
2019 May 15 3:43 PM
As SAP says (right of SUBMIT form): "You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details."
2019 May 15 3:46 PM
As SAP says (right of SUBMIT form): "You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details."
In your case, being the OP, you should edit your question, or add a comment below the question.
2019 May 15 4:06 PM
For APPEND ... TO itab, SAP doesn't say that itab can be a functional operand position, so you have to indicate an internal table, not an expression.
EDIT: I was wrong about the two next points, cf solution by Quynh Doan Manh
2019 May 15 4:34 PM
Asking for more information does not harms others, but helps for finding the right solution.
2019 May 15 4:42 PM
Arthur Fuscella Silva Of course. I was just quoting SCN "before anwering":
2019 May 15 7:26 PM
2019 May 16 1:27 AM
Maybe you can switch the table to the left side like below:
itab_alv[ 2 ]-t_color = VALUE #( BASE itab_alv[ 2 ]-t_color ( wa_col ) ).
P/S: I looked at your code again and found out that you define wa_col as a table no a work area. you should change it cause it confused. incase its a table, you can try:
itab_alv[ 2 ]-t_color = CORRESPONDING #( BASE ( itab_alv[ 2 ]-t_color ) wa_col ).
2019 May 16 7:47 AM
Thanks, the fail ist gone 😄
I will try the first method. I forgot this alternative.
2019 May 16 4:01 PM
Hello Eric,
Instead of using APPEND, why don't you try to assign the value directly
itab_alv[ 2 ]-t_color = VALUE lvc_t_scol( ( wa_col ) ) .
Reward points if it's helpful.
KR,
Arthur Silva