2 weeks ago
hello experts,
here lt_schdx will only have only line because every time a new line is added, old ones are removed.
if I had table declared beforehand I could use BASE but it's not allowed here.
any alternative because BASE statement is not allowed, my code below:
LOOP AT lt_item ASSIGNING FIELD-SYMBOL(<ls_item>).
DATA(lt_schdx) =
VALUE cod_t_bapischdlx( ( updateflag = 'I'
itm_number = COND #( WHEN <ls_item>-posnr IS NOT INITIAL THEN 'X' )
sched_line = '0001'
req_date = COND #( WHEN <ls_item>-edatu IS NOT INITIAL THEN 'X' )
date_type = 'X'
req_qty = 'X' ) ).
ENDLOOP.
You cannot use DATA(itab) = VALUE ttyp( BASE itab ... ) just because the BASE internal table must already exist, it's just a special case to have the same itab used both in the inline declaration and after BASE that SAP didn't want to handle specifically (as far as I understand).
It's very acceptable to have explicitly a "clear" before the LOOP:
DATA(lt_schdx) = VALUE cod_t_bapischdlx( ).
LOOP AT lt_item ASSIGNING FIELD-SYMBOL(<ls_item>).
lt_schdx = VALUE #(
BASE lt_schdx
( ... = ...
... = ... ) ).
I'm not against using INSERT INTO TABLE too:
DATA(lt_schdx) = VALUE cod_t_bapischdlx( ).
LOOP AT lt_item ASSIGNING FIELD-SYMBOL(<ls_item>).
INSERT VALUE #( ... = ...
... = ... )
INTO TABLE lt_schdx.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
68 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.