2018 Sep 05 11:47 AM
Hi Experts,
DATA(lv_len) = lines( poitem ).
poitem[] = VALUE #( FOR i = 10 THEN i + 10 UNTIL i GT lv_len * 10
( po_item = i acctasscat = ‘W’ ) ) .
In the above syntax i have tried to embed corresponding so that only two fields of table poitem gets filled but was encountered with errors
DATA(lv_len) = lines( poitem ).
poitem[] = VALUE #( FOR i = 10 THEN i + 10 UNTIL i GT lines( poitem ) * 10
( po_item = i acctasscat = ‘W’ ) ) .
And also i have tried giving length regex so that it runs for number of table rows but not successful
So please can you help me in this two points
Regards,
Shiva
2018 Sep 05 1:52 PM
Hi
ad 1) You are using the constructor expression VALUE to greate a new internal table with only po_item and acctasscat filled.
Wich errors have you encountered? Coding works fine!
ad 2) There is no regex! this will add only 1 row to the table!
If you try to change the table poitem - I assume you want to do this... - you need to use some other coding and commands!
regards Domi
2018 Sep 06 1:41 AM
2018 Oct 04 3:32 PM
poitem[] has already 6 lines in it.
poitem[] = VALUE #( FOR i = 10 THEN i + 10 UNTIL i GT lines( poitem ) * 10
( po_item = i acctasscat = ‘W’ ) ) .
1)In this syntax, there was no error but ideally it should run for 6 iterations considering UNTIL i GT lines( poitem ) * 10 but it was only running for single iteration
2)Imagine there are already some fields filled in the table so they are getting wiped out and only two fields po_item and acctasscat are getting filled
So how to handle this situation
2018 Oct 04 4:20 PM
Hi Shiva, If i understand correctly, you wanted to loop the poitem based on number of line items in it and move only two fields to another poitem table.
Then you can directly loop poitem and moved what ever fields you wanted to different internal table using CORRESPONDING. Please check example.
types:
begin of ty_tab1,
matnr type matnr,
mbrsh type mbrsh,
end of ty_tab1,
tt_tab1 type standard table of ty_tab1 with default key.
data: lt_tab1 type tt_tab1.
select * from mara into table @data(lt_mara) up to 100 rows.
lt_tab1 = value tt_tab1( for wa in lt_mara ( corresponding #( wa ) ) ).
cl_demo_output=>display( lt_tab1 ).
2018 Oct 17 8:57 AM
Hi SN,
You are correct but i don't want to construct new table, but update two fields in the existing poitem table which already has records in it, one field with constant value and other with an incrementing value.
( po_item = i acctasscat = ‘W’ )
Regards,
Shiva