‎2007 Jun 12 12:18 PM
Hi,
i have this declaration:
<b>data: begin of tab1 occurs 0,
mat(18) type c,
anno(4) type n,
mese(2) type n,
tipval(3) type n,
imp(9) type p decimals 2,
qty(9) type p decimals 3,
end of tab1.</b>
How can I declare the fields <b>mat</b>, <b>anno</b> and <b>mese</b> as a key field?
thanks a lot.
C.
‎2007 Jun 12 12:28 PM
Hi,
U can't give the key fields directly for those fields.U can give in the following way:
<b>data: begin of tab1 occurs 0,
mat(18) type c,
anno(4) type n,
mese(2) type n,
tipval(3) type n,
imp(9) type p decimals 2,
qty(9) type p decimals 3,
end of tab1,
it_tab1 like table of tab1 with Unique key mat anno mese with Header Line.</b>
Regards,
Padmam.
‎2007 Jun 12 12:22 PM
Hi,
DATA itab { {TYPE tabkind OF [REF TO] type}
| {LIKE tabkind OF dobj} }
[WITH key] .
regards,
shardul shah
data : begin of itab occurs 0,
ebeln like ekpo-ebeln,
ebelp like ekpo-ebelp,
loekz like ekpo-loekz,
aedat like ekpo-aedat,
matnr like ekpo-matnr,
end of itab.
data : x_tab like table of itab with key ebeln with header line.
Message was edited by:
Shardul Shah
‎2007 Jun 12 12:23 PM
Hi
Where you wants to create/use them as key fields
in the internal table or DB table?
In the database table you can just tick the field after FIELD
there is nothing to be done for the internal table.
Reward points for useful Answers
Regards
Anji
‎2007 Jun 12 12:26 PM
Hi,
OCCURS is obsolete, you can instead use TYPE STANDARD TABLE along with WITH KEY addition to define the key.
<b>TYPES: begin of tab1,
mat(18) type c,
anno(4) type n,
mese(2) type n,
tipval(3) type n,
imp(9) type p decimals 2,
qty(9) type p decimals 3,
end of tab1.
DATA: itab type standard table of tab1 with key mat anno mese.</b>
Regards,
Sesh
/
‎2007 Jun 12 12:28 PM
Hi,
U can't give the key fields directly for those fields.U can give in the following way:
<b>data: begin of tab1 occurs 0,
mat(18) type c,
anno(4) type n,
mese(2) type n,
tipval(3) type n,
imp(9) type p decimals 2,
qty(9) type p decimals 3,
end of tab1,
it_tab1 like table of tab1 with Unique key mat anno mese with Header Line.</b>
Regards,
Padmam.
‎2007 Jun 12 12:33 PM
Hi,
Use the below code..
data: begin of tab1,
mat(18) type c,
anno(4) type n,
mese(2) type n,
tipval(3) type n,
imp(9) type p decimals 2,
qty(9) type p decimals 3,
end of tab1.
data itab like table of tab1 with unique key mat anno mese.
dont use occurs 0 method as itis obsolete and wont be supported in OO Context..
Cheers,
Hakim
Mark all useful answers..