Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

please tell me about ztable

Former Member
0 Kudos

Hi Experts..

I need to create a ztable with 5 fields like werks meins mvgr2 etc. In this table mvgr2 (material grp should not be blank ) and plant also need not be blank. so tell me how to do it.I want mvgr2 and werks as key fields also. Then should i want to use mandt as my first field or i want to ignore it in the ztable. pls tell me the use of mandt in the table , when we should use mandt and when there is no need of mandt field in the table..can i save the ztable in zpackage or should i save in the specific package .

8 REPLIES 8

Former Member
0 Kudos

MANDT is the client field. If a table has MANDT as the first field with dataelement is MANDT then that table is clent dependent. If a table doen't have this filed then it is a client independent table.

Former Member
0 Kudos

hi,

whichever fields you want should not go blank make them your key fields.

mandt is neccesary cos it specifies client wise data.

in your table data will be stored client wise. if you login to client1 then in your table you can view all records pertaining to client1. it is very useful if there are more than 1 client on same server.

in your case make werks mvgr2 as primary key fields

keep sequence of fields as:

field key initial value

mandt x x

werks x x

mvgr2 x x

rest of fields.

Former Member
0 Kudos

Hi

steps to create a table

Go to transaction SE11. Enter name of table you want to create (beginning with Y or Z) and click on create pushbutton

Enter the delivery class and the table maintenance criteria

The delivery class controls the transport of table data when installing or upgrading, in a client copy and when transporting between customer systems .

The display/maintenance indicator specifies whether it is possible to display/maintain a table/view using the maintenance tools Data Browser (transaction SE16) and table view maintenance (transactions SM30 and SM31).

Enter the name of the table field and the data element. The

System automatically populates the technical details for

existing data elements.

So far as possible it is advisable to use existing data elements which befit the business requirements.

However, we may create data elements if need be. The same is shown in the next slide.

To create a data element simply double click on it.

Alternately create a data element by simply choosing the

data type radio button on SE11 initial screen.

Rewardif usefull

vijy_mukunthan
Active Contributor
0 Kudos

hi friend

the plant and mvrg2 can be made obligatory in syntax . It cannot be made compulasory while creating the table. only key field alone can be set. The other compulasory field has to made in the coding. You select the tick mark for the primary key fields the other compulasory fields u write code as

parameters : plant type ekko-plant OBLIGATORY,

mvrg2 type ekko-mvrg2 OBLIGATORY.

use this code

Rewards points if its helpful

Regards

vijay

Former Member
0 Kudos

Hi Madan,

In your table if you need mvgr2 and werks to be mandatory then you have to keep them as the first 2 fields in the table after Mandt.

The key fields are always declared in the begining of the table. 'mandt' makes the table client dependent.It is mandt followed by the key fields.

Make sure to select the tick boxes under key to make the particular field the key filed.

In your case it would be

field key initial values

mandt X X

mvgr2 X X

werks X X

field 3

field 4

field 5

Former Member
0 Kudos

Hi Madan,

Please reward if the post was helpful.

Former Member
0 Kudos

Hi Madan ,

Its very simple. If u give mandt means the table is client dependent ie data is maintained on basis of the client . it is always better to have mandt because this table may be used for different clients also. If u want to make werks and mvgr2 as key fields pls tick mark key field while creating the table. Further if u want to make this values not to be null then use the next field ie initial values and tick mark it. Now regarding to the package , u can store in any of the package as u wish .if u r creating more tables then create ur own package and store in it.

Regards

Shiva

prabhanjan_reddy
Participant
0 Kudos

as i have created my ztable called zbomtemp in that i have defined some fields along wid mandt

and i have defined a structure with all fileds which are defined in table except mandt.

and i have created internal table structure like

types : begin of ty_zbomtemp,

reinr type zbomtemp-reinr,

stlkn type zbomtemp-stlkn,

matnr type zbomtemp-matnr,

maktx type zbomtemp-maktx,

werks type zbomtemp-werks,

stlal type zbomtemp-stlal,

stktx type zbomtemp-stktx,

text type zbomtemp-text,

postp type zbomtemp-postp,

compcode type zbomtemp-compcode,

comptext type zbomtemp-comptext,

sortf type zbomtemp-sortf,

lgort type zbomtemp-lgort,

phflg type zbomtemp-phflg,

imein type zbomtemp-imein,

imeng type zbomtemp-imeng,

bmsch type zbomtemp-bmsch,

end of ty_zbomtemp.

as i am trying to update the table from java and directly updates the structure

and

select *

    • mandt reinr stlkn matnr maktx werks stlal stktx text postp compcode comptext sortf lgort phflg imein imeng bmsch

from zbomtemp into table it_zbomtemp where reinr = p_reinr.

sort it_zbomtemp.

delete adjacent duplicates from it_zbomtemp.

append lines of it_zbomtemp to zbomtemp_lists.

and when ever i am using this code its saying

the type of database table and work area are not unicode convertable

struucture and internal table are not mutually convertable ....

please help me in this one

Edited by: prabhanjangeevanagari on Mar 24, 2011 11:43 AM