Non-persistent fields

Hi,
I would like to use toplink with objects that contains both persistent and non-persistent fields (unmapped). When I insert such an object to the database using unit-of-work, and then try to query toplink for that same object elsewhere in my program I only get the persistent fields. I've tried using checkCacheThanDatabase() which resolved the problem but this method is only available for ReadObjectQuery not for ReadAllQuery (the javadoc is not consistent with the code).
My questions:
1. For ReadObjectQuery, can I trust the cache to always have my object, or is there a risk that the cache will drop it?
2. What to do with ReadAllQuery?
3. Any other approach that can work?

You can make non-persistent attributes remain with the object in a unit of work through using a clone policy and using the postMerge event.
Your class needs to implement Cloneable and in the descriptor use clone-copy-policy. This will ensure that when a cached object is registered into the unit of work the non-persistent attributes will be maintained.
When the unit of work merges a transactional object into the session cache you need to make sure you copy the non-persistent attributes from the clone to the cached object. You can do this through a DescriptorEventListener and the postMerge event.
Example:
postMerge(DescriptorEvent event) {
String tempProperty = ((MyClass) event.getObject()).getProperty();
((MyClass) event.getOringalObject()).setProperty(tempProperty);
Note that since the attribute is non-persistent it will not be guaranteed to persist indefinitely. The non-persistent attributes duration will be dependant on your caching policy, if it gets dropped from the cache, a new instance will be built from the database the next time it is accessed.
The checkCacheThanDatabase checkCacheOnly properties should not have any effect on what you get from the cache. Reads that access the database will still maintain object identity with the cache, and you should get back the correct object.

Similar Messages

  • Updating non-persistent fields in an Entity Object

    Hi,
    I wanted to add a non-persistent field to an Entity Object to use as a temporary aggregate field for a detail entity. It appears that storing data in the field makes it look like the master entity has been updated even though the value cannot be saved in the data base. Is this the way it is supposed to work?
    I was trying to avoid putting invisible controls in the UI or creating "global" variables.
    Thanks,
    Peter

    This can be done with programmatic VOs: http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadvvo.htm#sm0341
    Sample: http://blogs.oracle.com/smuenchadf/examples/#132
    You can also opt to do this with a simple Java class and a data control based on it.
    For example: http://blogs.oracle.com/shay/2009/07/java_class_data_control_and_ad.html

  • Need to cache non-persistent field value

    Is it possible to have a non-persistent field in PC class which value will be updated by app, stored in DataCache and then can be used when PC instance will be taken from DataCache next time?
    I tried to map my field as persistence-modifier="transactional" or "none". I do see in my log that the object is taken from cache, but that transient field value is always null after object retreival.
    Thanks, Denis.

    Thanks for the hint, Abe.
    I got what I need via custom filed mapping. If anyone interested:
    public class CacheFieldMapping extends ColumnFieldMapping {
    public CacheFieldMapping(FieldMetaData meta) {
    super(meta);
    public String getMappingType() {
    return getClass().getName();
    protected int getJDBCType() {
    return Types.OTHER;
    public boolean map() {
    return true;
    public void fromMappingInfo(MappingInfo info, boolean adapt) {
    // do nothing...
    public void toMappingInfo(MappingInfo info) {
    // do nothing...
    public void refSchemaComponents() {
    // do nothing...
    public int select(Select sel, KodoStateManager sm, JDBCStoreManager store,
    JDBCFetchConfiguration fetch, int eagerMode) {
    return -1;
    public void load(KodoStateManager sm, JDBCStoreManager store,
    JDBCFetchConfiguration fetch, Result res) throws SQLException {
    // do nothing...
    public void load(KodoStateManager sm, JDBCStoreManager store,
    JDBCFetchConfiguration fetch) throws SQLException {
    sm.storeObject(getIndex(), null);
    public Object loadProjection(JDBCStoreManager store,
    JDBCFetchConfiguration fetch, Result res, Joins joins) throws SQLException
    return null;
    public Boolean isCustomInsert(KodoStateManager sm) {
    return Boolean.TRUE;
    public Boolean isCustomUpdate(KodoStateManager sm) {
    return Boolean.TRUE;
    protected void update(KodoStateManager sm, Row row) throws SQLException {
    // do nothing...
    "Abe White" <[email protected]> wrote in message
    news:[email protected]..
    No, this is not possible. The data cache acts exactly like the
    database, only storing persistent values.

  • Non-persistent field

    Hi,
    We have a need for a kodo-enhanced object to have a member field that
    should NOT be persisted in the database.
    I searched the docs several times but could not find the metadata to
    specify this option. Any help would be greatly appreciated.
    John

    We have a need for a kodo-enhanced object to have a member field that
    should NOT be persisted in the database.<field name="foo" persistence-modifier="none"/>
    or make the field transient and it won't be persistent by default.

  • Non persisted fields in entity class

    Is it possible to declare a field of an entity class such that it does not get persisted?

    Yes, use the JPA @Transient annotation (or transient field attribute).
    -- James : http://www.eclipselink.org

  • Marking a field as non-persistent?

    Hi folks,
    We've been building up a distributed data store that has a BDB at each leaf node. There are a few layers that our objects go through, and up until now we've been able to use our Entity objects directly throughout the code. They get serialized by RMI and make their way to our BDB nodes and get persisted by the DPL.
    But now we have a situation where we have a field that we want serialized (non-transient) so that it makes its way all the way through our system, but then not persistent when it reaches the DPL. (We also have a search index at each leaf, and this bit of data includes some instructions for the search engine.)
    The best solution (from my perspective!) would be simply to have an @NonPersistent annotation to make the DPL ignore a particular field. Lacking that, I came up with a couple options, neither of which I like. First, I could add a wrapper object that isn't an Entity class that contains my non-persistent data. I don't really like this idea, but it could work (makes all my objects a little larger and they get serialized a LOT). Second, I could modify readObject and writeObject to manually throw in the transient fields that I wanted to keep around. I don't really like that either (for different reasons), but it also could work.
    Any other thoughts? Is there anything I'm missing that would allow me to do this easily?
    Thanks!
    Jeff

    Hi Jeff,
    I think the addition of @NonPersistent is a reasonable request and probably the only good solution. One of the primary goals of the DPL is to be able to persist objects that are used in other ways -- RMI is a good example. In other words, the DPL intends to be a pure POJO persistence solution. However, we didn't consider the case of a field that is persistent with respect to RMI but not the DPL, or vice-versa. So I think solving this is important.
    Let us spend some time on that and we'll see if we can get this into a 3.3 dot release. This is a fairly simply addition, but we'll need to also consider the reverse situation -- a field that is persistent WRT the DPL but not RMI. In other words, we may need both @Persistent and @NonPersistent to apply to a field to override the default rules. And we'll need to encapsulate this information in the EntityModel abstraction so that it can be used without annotations.
    In the meantime, I suggest using one of the workarounds you mentioned, or perhaps even modifying the DPL source code in a way that works for you, temporarily.. If you choose the latter, note that there is only one place where field persistence is determined, which is in the getInstanceFields method of this class:
    src/com/sleepycat/persist/impl/FieldInfo.java
    See the call to Modifier.isTransient.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Single Persistent instance of a Object, Many non persistant. Same Identity on persist

    I have a persistent bean class with two Strings as member fields. (example
    below)
    I have many other classes that use it a part of they're member fields.
    I need to have only one persistant version of it (One row, to many Rows in
    different tables). But can have many non persistant versions. I can't
    control the creation of the non persistant objects.
    i.e.
    On persist, How can I configuration JDO to detect that it's the same as an
    object already in the database and use that instead?
    example:
    // Example class One
    package foo;
    public class One(){
    public String var1;
    public String var2;
    public String getVar1(){
    return this.var1;
    public void setVar1(String var1Set){
    this.var1 = var1Set
    public String getVar2(){
    return this.var2;
    public void setVar2(String var2Set){
    this.var2 = var2Set
    /// one.jdo
    <?xml version="1.0"?>
    <jdo>
    <package name="foo">
    <class name="One"/>
    </package>
    </jdo>
    ///Example Scenario
    One oneObject = new One();
    oneObject.setVar1("Value1");
    oneObject.setVar2("Value2");
    pm.makePersistent(oneObject); // one row in database
    /// Some time later, in a different thread, or since JVM shutdown and
    restart
    One oneObject = new One();
    oneObject.setVar1("Value1");
    oneObject.setVar2("Value2");
    pm.makePersistent(oneObject); // one row in database, instead of two.

    You cannot. You should either find the object by query or retrieve it
    using application identity.
    Graham Cruickshanks wrote:
    I have a persistent bean class with two Strings as member fields. (example
    below)
    I have many other classes that use it a part of they're member fields.
    I need to have only one persistant version of it (One row, to many Rows in
    different tables). But can have many non persistant versions. I can't
    control the creation of the non persistant objects.
    i.e.
    On persist, How can I configuration JDO to detect that it's the same as an
    object already in the database and use that instead?
    example:
    // Example class One
    package foo;
    public class One(){
    public String var1;
    public String var2;
    public String getVar1(){
    return this.var1;
    public void setVar1(String var1Set){
    this.var1 = var1Set
    public String getVar2(){
    return this.var2;
    public void setVar2(String var2Set){
    this.var2 = var2Set
    /// one.jdo
    <?xml version="1.0"?>
    <jdo>
    <package name="foo">
    <class name="One"/>
    </package>
    </jdo>
    ///Example Scenario
    One oneObject = new One();
    oneObject.setVar1("Value1");
    oneObject.setVar2("Value2");
    pm.makePersistent(oneObject); // one row in database
    /// Some time later, in a different thread, or since JVM shutdown and
    restart
    One oneObject = new One();
    oneObject.setVar1("Value1");
    oneObject.setVar2("Value2");
    pm.makePersistent(oneObject); // one row in database, instead of two.
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Problem creating non-persistent Child Objects

    I have the need to create a non persistable child object in the
    jdoPreStore of a parent object. I then perform some tests on the parent
    to determine if the child object needs to be persisted or not. If I leave
    the child non persistent it still writes to the database.
    I was performing the follwoing piece of code
    Class Parent {
    // The relationship is a 0 to many
    public Child createChild() {
    Child child = .....//create non persistent object
    child.setParent(this);
    getChild().add(child);
    It appears that if I remove the getChild().add(child). It does not
    persist (as desired).
    Is this correct behaviour?? I dont think that it should be, but if it is
    then I have a further problem.
    If that child object inherits from another object and you remove the
    getChild().add(child) kodo outputs an invalid object to the database. It
    doesnt insert a row to the child table. But it inserts a row to the
    childs inherited object table. This is now an invalid object and will
    fail upon loading.
    Any help on this would be appreciated.
    Thanks
    Luke.

    JDO has something called persistence by reachability. This means that
    objects do not have to explicitly be marked as to be persistent as JDO
    will traverse the object graph to ensure that all nodes are persistent.
    I think you are seeing this behavior combined with another side
    behavior: Kodo requires that both sides of a relation be set.
    Basically, keep your objects in synch (set both sides of the relation).
    And if you want to hold onto a reference to non-persistent object
    before you decide what to do with it, add a transient field or a field
    marked "persistence-modifier="none"" in your metadata and then process
    those transient fields in jdoPreStore ().
    i.e.
    if (//businessLogic is true)
    persistentField = transientField;
    Luke wrote:
    I have the need to create a non persistable child object in the
    jdoPreStore of a parent object. I then perform some tests on the parent
    to determine if the child object needs to be persisted or not. If I leave
    the child non persistent it still writes to the database.
    I was performing the follwoing piece of code
    Class Parent {
    // The relationship is a 0 to many
    public Child createChild() {
    Child child = .....//create non persistent object
    child.setParent(this);
    getChild().add(child);
    It appears that if I remove the getChild().add(child). It does not
    persist (as desired).
    Is this correct behaviour?? I dont think that it should be, but if it is
    then I have a further problem.
    If that child object inherits from another object and you remove the
    getChild().add(child) kodo outputs an invalid object to the database. It
    doesnt insert a row to the child table. But it inserts a row to the
    childs inherited object table. This is now an invalid object and will
    fail upon loading.
    Any help on this would be appreciated.
    Thanks
    Luke.
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Collection of non-persistent objects

    Greetings
    Is it possible to persist a Collection of non-persistent objects through the
    kodo externalization feature? The non-persistent objects themselves are
    externalizable, but I don't know how I would go about persisting a
    Collection of them.
    ..droo.

    If you store them in some sort of externalized form in a single column it is
    easy - just use externalization framework to ext and de-ext them to anf from
    string. Couple of caveats you need to be aware of If your collection objects
    are mutable:
    1. You need to durty your collection field so it get prsisted on commit
    2. on rollback Kodo will restore you collection content but not collection
    member content. If they are mutable you will have to make their class
    persistent with mapping "none" so they participate in transaction
    "Drew Lethbridge" <[email protected]> wrote in message
    news:BD0B44BF.544%[email protected]..
    Greetings
    Is it possible to persist a Collection of non-persistent objects throughthe
    kodo externalization feature? The non-persistent objects themselves are
    externalizable, but I don't know how I would go about persisting a
    Collection of them.
    .droo.

  • Key fields and non-key field of condition table

    Hello Gurus,
          what is key fields and non-key field of condition table?
    thanks very much!

    Key field
    Each condition table contains keys that can be used for creating dependent condition records.
    for example let take condition type PR00.
    PR00 uses access sequence PR02 .
    Access sequence PR02 has following tables associated with it namely 304, 305 & 306
    When you create a conditon record for PR00 with transaction VK11 or VK31, you have a button 'key combination' which is nothing but fields associated with tables 304, 305 & 306.
    In brief, Condition records are always created using specific keys. Condition tables are used to define the structure of the keys of a condition record.
    Non key field
    For example take condition table 144 - sales deal basic data.
    Table 144 is associated with access sequence PBUD.
    If you check the fields associated with this table (click technical view button), there are three fields at bottom which do not have 'key' check mark -KDATU, PLTYP, KSTAF
    So, when you create a condition record for PBUD, system does not propose these 3 fields in 'key combination' and hence are non key fields.
    Please reward points for good answers as this would help increase the total donation that SAP will make to the United Nations World Food Programme.

  • Problem with Non-English Fields Output to PDF by JASPER in JDev10.1.3

    I am using jsprx files(designed in i-report) to generate pdf reports out of an oracle database.
    The non-English fields are shown correctly when I output the report into an HTML or when I view it with JasperView.
    If I try making PDF files (JasperExportManager.exportReportToPdfFile) the static fields containing e.g.Arabic/Chineese characters won't be displayed and dynamic fields from the database with non-English contents will be shown as ??? or null.
    I received some suggestions about using PARAMETERS to feed the report instead of FIELDS, which I think can not be helpful in this case and in general.
    I think this should be a common problem. These are the components I am using:
    itext-1.4.7. jar
    commons-digester- 1.7.zip
    jasperreports- 1.2.8.jar
    Any comment or help is appreciated.
    Thanks
    Farbod

    I am using jsprx files(designed in i-report) to generate pdf reports out of an oracle database.
    The non-English fields are shown correctly when I output the report into an HTML or when I view it with JasperView.
    If I try making PDF files (JasperExportManager.exportReportToPdfFile) the static fields containing e.g.Arabic/Chineese characters won't be displayed and dynamic fields from the database with non-English contents will be shown as ??? or null.
    I received some suggestions about using PARAMETERS to feed the report instead of FIELDS, which I think can not be helpful in this case and in general.
    I think this should be a common problem. These are the components I am using:
    itext-1.4.7. jar
    commons-digester- 1.7.zip
    jasperreports- 1.2.8.jar
    Any comment or help is appreciated.
    Thanks
    Farbod

  • How can we protect the  ztable non key fields data in sm30 display.

    Hi experts,
         I have created tablemaintenence generator for one z table, in sm30 user has access to enter the data.
    in that maintenence i have to protect the non key field values data  like once the user saves his data.than in the edit mode it has to show the nonkey fields data  but  dont access to edit some nonkey fields... please help

    Hi
    U need to change the screen flow generated by maintenance view generator: here go to Enviroments->Modifications->Screen; doubleclick on your screen and the system take you to screen painter.
    Here go to screen flow and in PBO add new module in order to protect the field for the old records: u can use the statament LOOP AT SCREEN./ENDLOOP to do it.
    LOOP AT SCREEN.
       IF .....
         SCREEN-INPUT = 0.
         MODIFY SCREEN.
       ENDIF.
    ENDLOOP.
    Max

  • Error: "a summary has been specified on a non recurring field"

    Hi,
          I have a formula which calculates a quantity amount based on different quantity types & finally sums all the quantity to give a
    result, tis result i want to show in crystal report, This field is put in report footer, when i try to run the report i get the following error for that field 'a summary has been specified on a non recurring field' below i put my formula:
    //sum for qty type Fuel
    numberVar qtyFuel;
    if
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-THEO_ACT_IND]} = 'A' and
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-MEDIUM]} = 'GAS' and {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-QTY_TYPE]-[22O0GHO_C06-QTY_TYPE]} = '01'
    then
    qtyFuel := Sum ({2O0GHO_C06_0GHO_T06_Q0002.[Measures]-[DWQWE23XXYJCROQ978M8NX3J5]});
    //sum for qty type Inventory
    numberVar qtyInventory;
    if
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-THEO_ACT_IND]} = 'A' and
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-MEDIUM]} = 'GAS' and {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-QTY_TYPE]-[22O0GHO_C06-QTY_TYPE]} = '03'
    then
    qtyInventory := Sum ({2O0GHO_C06_0GHO_T06_Q0002.[Measures]-[DWQWE23XXYJCROQ978M8NX3J5]});
    //sum for qty type Non Sales
    numberVar qtyNonSales;
    if
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-THEO_ACT_IND]} = 'A' and
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-MEDIUM]} = 'GAS' and {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-QTY_TYPE]-[22O0GHO_C06-QTY_TYPE]} = '04'
    then
    qtyNonSales := Sum ({2O0GHO_C06_0GHO_T06_Q0002.[Measures]-[DWQWE23XXYJCROQ978M8NX3J5]});
    //sum for qty type Sales
    numberVar qtySales;
    if
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-THEO_ACT_IND]} = 'A' and
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-MEDIUM]} = 'GAS' and {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-QTY_TYPE]-[22O0GHO_C06-QTY_TYPE]} = '05'
    then
    qtySales := Sum ({2O0GHO_C06_0GHO_T06_Q0002.[Measures]-[DWQWE23XXYJCROQ978M8NX3J5]});
    //sum for qty type Enhanced Recovery
    numberVar qtyEnhancedRecovery;
    if
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-THEO_ACT_IND]} = 'A' and
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-MEDIUM]} = 'GAS' and {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-QTY_TYPE]-[22O0GHO_C06-QTY_TYPE]} = '14'
    then
    qtyEnhancedRecovery := Sum ({2O0GHO_C06_0GHO_T06_Q0002.[Measures]-[DWQWE23XXYJCROQ978M8NX3J5]});
    //sum for qty type Load Oil Sales
    numberVar qtyLdOilSales;
    if
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-THEO_ACT_IND]} = 'A' and
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-MEDIUM]} = 'GAS' and {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-QTY_TYPE]-[22O0GHO_C06-QTY_TYPE]} = '08'
    then
    qtyLdOilSales := Sum ({2O0GHO_C06_0GHO_T06_Q0002.[Measures]-[DWQWE23XXYJCROQ978M8NX3J5]});
    //sum for qty type receipt
    numberVar qtyReceipt;
    if
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-THEO_ACT_IND]} = 'A' and
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-MEDIUM]} = 'GAS' and {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-QTY_TYPE]-[22O0GHO_C06-QTY_TYPE]} = '13'
    then
    qtyReceipt := Sum ({2O0GHO_C06_0GHO_T06_Q0002.[Measures]-[DWQWE23XXYJCROQ978M8NX3J5]});
    numberVar Total_Production;
    //summing all quantity types
    Total_Production := qtyFuel + qtyInventory + qtyNonSales + qtySales + qtyEnhancedRecovery + qtyLdOilSales - qtyReceipt;
    I want to display the Total_Production in the report.
    The formula name is: Total_Gas_Production.
    kindly help me in this issue.
    Regards,
    Deepak

    is this one formula?
    have you tried to run each formula seperatly to check which is the culprit. if you search the web there are some reasons why this could be happening.
    generally you should use evaluation times on formulas
    are you using manual running totals or this is the entire formula?
    try
    MANUAL RUNNING TOTALS
    RESET
    The reset formula is placed in a group header report header to reset the summary to zero for each unique record it groups by.
    whileprintingrecords;
    Numbervar  X := 0;
    CALCULATION
    The calculation is placed adjacent to the field or formula that is being calculated.
    (if there are duplicate values; create a group on the field that is being calculated on. If there are not duplicate records, the detail section is used.
    whileprintingrecords;
    Numbervar  X := x + ; ( or formula)
    DISPLAY
    The display is the sum of what is being calculated. This is placed in a group, page or report footer. (generally placed in the group footer of the group header where the reset is placed.)
    whileprintingrecords;
    Numbervar  X;
    X

  • Error:Could not load type from assembly Culture=neutral, PublicKeyToken=null' because it contains an object field at offset 75 that is incorrectly aligned or overlapped by a non-object field.

    I got an error while I creating a structure.
    [FieldOffset(72)]
    [MarshalAs(UnmanagedType.ByValArray,SizeConst= 3)]
    public int[] DC;
    [FieldOffset(75)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
    public float[] WIN;
    [FieldOffset(83)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
    public byte[] name;
    [FieldOffset(103)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
    public byte[] SET;
    [FieldOffset(106)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)]
    public byte[] ID;
    Error as like this-->object field at offset 75 that is incorrectly aligned or overlapped by a non-object field. But here size constant is 3 so I think after 72 offset will be 75..If I change the offset to 76 it will works fine. I think reason is that
    size of int is 4. After changing that code will be like this.
    [FieldOffset(72)]
    [MarshalAs(UnmanagedType.ByValArray,SizeConst= 3)]
    public int[] DC;
    [FieldOffset(76)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
    public float[] WIN;
    [FieldOffset(84)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
    public byte[] name;
    [FieldOffset(104)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
    public byte[] SET;
    [FieldOffset(107)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)]
    public byte[] ID;
    But at that time I got the  error as object field at offset 107 that is incorrectly aligned or overlapped by a non-object field..Can anyone tell me what is the main reason behind this..
    Thanks..

    Hi,
    Please firstly take a look at this documentation:
    MarshalAsAttribute.SizeConst Field
    Indicates the number of   elements in the fixed-length array or the number of characters (not bytes) in   a string to import
    Change your code like this should work:
    [FieldOffset(72)]
    [MarshalAs(UnmanagedType.ByValArray,SizeConst= 3)]
    public int[] DC;
    [FieldOffset(84)]//72+4*3
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
    public float[] WIN;
    [FieldOffset(116)]//84+4*8
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
    public byte[] name;
    [FieldOffset(136)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
    public byte[] SET;
    [FieldOffset(139)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)]
    public byte[] ID;
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Free Good Qty as non modifiable field in the Sales Order Level

    Dear Friends,
    I have successfully done the config change for the Free Goods, But now i want make the free good line item qty as a non modifiable field in the Sales Order Level.
    How can i do this.. Please advice.
    Thank U,
    Uwanthi

    Hi
    This is a standard behaviour in the system
    kindly use the below program and user exitexit
    MV45AFZZ and use "Userexit_filed_modification"
    Regfards
    Damu

Maybe you are looking for