2007 Aug 03 1:14 PM
Hello all.
Have.
DATA wa_table TYPE TABLE OF mytable WITH HEADER LINE.need appnd field to wa_table in abap.
how?
2007 Aug 03 1:17 PM
hi..
append wa_itab to itab.
in your case u have created internal table of name wa_table.
so ..
append wa_table.
Hello all.
Have.
DATA wa_table TYPE TABLE OF mytable WITH HEADER LINE.need appnd field to wa_table in abap.
how?
2007 Aug 03 1:17 PM
2007 Aug 03 1:17 PM
hi..
append wa_itab to itab.
in your case u have created internal table of name wa_table.
so ..
append wa_table.
2007 Aug 03 1:19 PM
Hi,
i think you want to add an extra field to the table wa_table.
this is not possible
but we can append the records only..
as you have already declared the structure of the internal table
you cannot change after declaring
reward points if helpful,
thanks & regards,
venkatesh
2007 Aug 03 1:22 PM
2007 Aug 03 1:39 PM
Hi.. plz check this code :
TYPES: BEGIN OF ty_ab,
include TYPE p0001,
fld1(10) TYPE c,
END OF ty_ab.
DATA: wa TYPE ty_ab.
Reward for useful answer
Regards
Pradeep
2007 Aug 03 1:23 PM
Hi Andrey,
A better way to do this is to create an internal table and work area separately:
Data : it_tab type table of mytable, * this creates internal table of type mytab
wa_tab type mytable. * Create a workarea of type mytab.
assign values to the workarea and modify the internal table using the workarea
wa_tab-field1 = 'xyz'.
wa_tab-field2 = 'abc'.
append wa_tab to it_tab.
Regards,
Sonal
<b>Reward points if helpful</b>
2007 Aug 03 1:28 PM
HI,
try this,
types: begin of t_itab.
include structure your structue.
types:
(you can include the extra fields likthis)
field1 type some dataelement
field2 type some data element 2
...
..
.
end of t_itab.
data: wa_table type standard table of t_itab.
like this you can add as many number of fields as you want
this is possible only while declaring the table
after that it will be freezed and you can not do any changes to the itab
reward points if helpful,
thanks & regards,
venkatesh
2007 Aug 03 1:28 PM
see the full code how the data is select into work area and then to your internal table .
"first example
TYPES: BEGIN OF t_bseg,
*include structure bseg.
bukrs LIKE bseg-bukrs,
belnr LIKE bseg-belnr,
gjahr LIKE bseg-gjahr,
buzei LIKE bseg-buzei,
mwskz LIKE bseg-mwskz, "Tax code
umsks LIKE bseg-umsks, "Special G/L transaction type
prctr LIKE bseg-prctr, "Profit Centre
hkont LIKE bseg-hkont, "G/L account
xauto LIKE bseg-xauto,
koart LIKE bseg-koart,
dmbtr LIKE bseg-dmbtr,
mwart LIKE bseg-mwart,
hwbas LIKE bseg-hwbas,
aufnr LIKE bseg-aufnr,
projk LIKE bseg-projk,
shkzg LIKE bseg-shkzg,
kokrs LIKE bseg-kokrs,
END OF t_bseg.
DATA: it_bseg TYPE STANDARD TABLE OF t_bseg INITIAL SIZE 0,
wa_bseg TYPE t_bseg.
SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
dmbtr mwart hwbas aufnr projk shkzg kokrs
FROM bseg
INTO wa_bseg.
APPEND wa_bseg TO it_bseg.
ENDSELECT.
"second example :
DATA : lt_bsik TYPE TABLE OF txi_bsik ,
ls_bsik LIKE LINE OF lt_bsik.
DATA : ld_cursor TYPE cursor.
OPEN CURSOR ld_cursor FOR
SELECT * FROM bsak
WHERE budat LE ls_butab-keydt
AND augdt GT ls_butab-keydt
AND bukrs = ls_butab-bukrs.
DO.
FETCH NEXT CURSOR ld_cursor
INTO CORRESPONDING FIELDS OF TABLE lt_bsik
PACKAGE SIZE txilm_package_size.
IF sy-subrc NE 0.
CLOSE CURSOR ld_cursor.
EXIT.
ENDIF.
SORT lt_bsik BY bukrs gjahr belnr.
LOOP AT lt_bsik INTO ls_bsik.
"if change in ls_bsik move to lt_bsik .
MODIFY lt_bsik FROM ls_bsik.
ENDLOOP.
ENDDO.reward points if it is usefull...
Girish
2007 Aug 03 1:30 PM
Hi Andrey,
can you please show why you want do do this?
Perhaps there is another way.
Regards, Dieter
2007 Aug 03 1:39 PM
Hi,
U want to append a field to that table.
It is possible thru creating a new type containing the wa_table structure and a requied filed. Then declre table using the new type.
Example:
TYPES:BEGIN OF TY_MYTABLE.
INCLUDE STRUCTURE <STRUCTURE OF MYTABLE>.
TYPES: <NEW FIELD1> TYPE <TYPE>.
TYPES:END OF TY_MYTABLE.
Now declare ur table:
DATA wa_table TYPE TABLE OF ty_mytable WITH HEADER LINE.
This can be useful when u need to add another field in that table in future.
Reward points if helpful,
Regards,
Rajesh