‎2009 Mar 17 7:27 AM
Please use an informative subject in future
Hi,
Can any one pls tell me how to define internal table in OOABAP.
my requirement is , i need to define a internal table of type KNA1.
and itab1 like itab occurs 1 with header line.how to define this in OOABAP
when i defined like....itab like kna1.it is showing an error saying like should not be used in ooabap.
how should i write that.
Edited by: Matt on Mar 17, 2009 11:09 AM
‎2009 Mar 17 7:28 AM
‎2009 Mar 17 7:34 AM
Thanks for the quick response
there is a structure zstruct with 10 fields
and can i write the code as.......
data str type zstruct.
or is there any standard way
‎2009 Mar 17 7:39 AM
Use "data str type zstruct.", you will get a structure.
If you want a internal table, should write "data strtab type table of zstruct.", it will create an internal table without header line, and line structure is same as zstruct.
The loop statement should be:
DATA: ftabix TYPE i.
LOOP AT strtab INTO str.
ftabix = sy-tabix.
str-com1 = ''.....
MODIFY strtab FROM str INDEX ftabix.
ENDLOOP.
‎2009 Mar 17 7:41 AM
Hi
u can create internal table using structure
str type STANDARD TABLE OF zstruct.
eg:
types:BEGIN OF str1,
empid type zprtable-empid,
uname type zprtable-uname,
password type zprtable-password,
end of str1 .
types:
itab type STANDARD TABLE OF str1 .
Regards
Arun
‎2009 Mar 17 7:43 AM
Hi,
Just as a rule of thumb, normally we like to define it like this:
1. Type declaration
TYPES: BEGIN OF ABC
FIELD1 TYPE char01,
FIELD2 TYPE sy-uname,
END OF ABC
2. work area declaration
DATA: WA_ABC TYPE ABC
3. Internal table declaration
DATA: WA_ABC TYPE TABLE OF ABC, or
DATA: WA_ABC LIKE TABLE OF WA_ABC.
Actually there is no rigid rule for declaration.
Regards,
Lim...
‎2009 Mar 17 7:53 AM
Hi,
Data : it_struct type standard table of str,
wa_struct type str.
This is the format in OOABAP.
Thanks.
‎2009 Mar 17 7:57 AM
Hi,
Use like below,
DATA BEGIN OF gt_struct.
INCLUDE STRUCTURE sflight.
DATA rcol(4) TYPE c.
DATA colors TYPE lvc_t_scol.
DATA END OF gt_struct.Regards
Bala Krishna
‎2009 Mar 17 8:09 AM
The mainly diffirent from OOABAP and classic ABAP is that, in OOABAP, the internal table must not have the header line.
‎2009 Mar 17 7:31 AM
hi
try this..
Types: begin of i_tab ,
name1 type kna1-name1,
end of i_tab.
DATA: it_tab type standard table of i_tab.
hope this help you
Regards
Ritesh J
‎2009 Mar 17 7:33 AM
Hi,
Test the following.
DATA: it_kna1 LIKE STANDARD TABLE OF kna1, " Internal Table
wa_it_kna2 LIKE kna1. " Workarea or HeaderLineBest Regards,
Faisal
‎2009 Mar 17 7:48 AM
Hi,
Try below logic.
DATA: it_kna1 type standard table of kna1,
wa_kna1 type kna1.
Thanks,
Asit Purbey.
‎2009 Mar 17 7:53 AM
Hi, M S
Total Questions: 16 (15 unresolved)
Please Close you open Questions.
Best Regards,
Faisal
‎2009 Mar 17 9:19 AM
hi,
You can do it this way
DATA: i_KNA1 type standart table of KNA!.
Hope this will help u
Thanks and Regards
Suraj S. Niar
‎2009 Mar 17 9:22 AM
**OOABAP DO NOT ACCEPT INTERNAL TABLES WITH HEADER LINES.***
SO FIRST DECLARE
TYPES : BEGIN OF TY_TAB,
FIELD1,
END OF TY-TAB.
DATA: GT_TAB TYPE TABLE OF TY_TAB
DATA:GS_TAB LIKE LINE OF GT_TAB.
‎2009 Mar 17 9:38 AM
TYPES: BEGIN OF t_kna1 ,
kunnr TYPE kunnr,
name1 TYPE name1,
END OF t_kna1.
Data: i_kna1 TYPE STANDARD TABLE OF t_kna1.
Regards,
Joan
‎2009 Mar 17 10:09 AM
Please use an informative subject in future
Once you've got your type, why not use the full declarative statement for tables.
DATA: mytab TYPE STANDARD¦HASHED¦SORTED TABLE WITH (NON-)UNIQUE KEY key1 key2.
or
DATA: mytab TYPE STANDARD¦HASHED¦SORTED TABLE WITH (NON-)UNIQUE KEY table_line.
‎2009 Mar 17 11:49 AM
Hi In OPps u should not use occurs in internal table creation.
and u should not use include alos
like include mara.
you should crete structure and then internal table like itab type table of st
wa type st.
or else itab type standard table of mara.
Regards