Some :New values are null in compound trigger

<h4>
Hello everybody,
I use Oracle 11g R2.
My problem is: Why certain :New.values are Null in the before statement only if I have an after statement (that do nothing) ?
My test case:
</h4>
create table TEST
ID Number,
CODE char(10),
SUBJECT varchar2(60)
alter table TEST add constraint TEST_PK primary key (CODE);
insert into TEST (CODE, SUBJECT, ID) values ('AAA ', 'Subject AAA', 1);
insert into TEST (CODE, SUBJECT, ID) values ('BBB ', 'Subject BBB', 2);
commit;
<h4>My problem:</h4>
create or replace trigger Test_Trg
for insert or update on Test
compound trigger
before each row is
begin
dbms_output.put_line( 'Before Each Row, New values= Id: '||:New.Id||', Code: '||:New.Code||', Subject: '||:New.Subject );
dbms_output.put_line( 'Before Each Row, Old values= Id: '||:Old.Id||', Code: '||:Old.Code||', Subject: '||:Old.Subject );
:New.Code := Nvl(:New.Code, 'CODE'||:New.Id);
end before each row;
after statement is
begin
dbms_output.put_line( 'After Statement' );
end after statement;
end Test_Trg;
<h4>Now if I do that:</h4>
update Test set Subject = 'The New Subject' where ID = 1;
commit;
<h4>The dbms_output is :</h4>
Before Each Row, New values= Id: 1, Code: , Subject:
Before Each Row, Old values= Id: 1, Code: USER1 , Subject: The New Subject
After Statement
<h4> (You can see that in the before each row, :New.Code and :New.Subject are Null!)
And the Data are:</h4>
select * from Test where Id = 1;
Id Code Subject
1 CODE1 The New Subject
<h4>Why the column Code is changed?
Now if I change my trigger (just removing the after statement)</h4>
create or replace trigger Test_Trg
for insert or update on Test
compound trigger
before each row is
begin
dbms_output.put_line( 'Before Each Row, New values= Id: '||:New.Id||', Code: '||:New.Code||', Subject: '||:New.Subject );
dbms_output.put_line( 'Before Each Row, Old values= Id: '||:Old.Id||', Code: '||:Old.Code||', Subject: '||:Old.Subject );
:New.Code := Nvl(:New.Code, 'CODE'||:New.Id);
end before each row;
end Test_Trg;
<h4>All work perfect!
My question is: Why certain :New.values are Null in the before statement only if I have an after statement that do nothing ?
Thanks in advance,
</h4>

I've got two 11.2.0.2 environments - one where this is reproducible, one where it doesn't seem to be.
I assume it must be a bug and one of these environments is patched.
I had a quick look at metalink and couldn't see an obvious match.
I might see if I can figure out differences between environments later.
There are a number of bugs around compound triggers.
I've been bitten before with a different compound trigger bug.
http://orastory.wordpress.com/2009/01/20/beware-the-compound-trigger/
Shame - nice way to neaten up multiple triggers but too many issues.

Similar Messages

  • Created a trigger but new values are not inserting in the backup table

    I have created a backup table and writter a trigger on a table such that after update old values and new values are to be inserted into the backup table, but new values are not inserting. I am giving the code please help me
    create or replace trigger "SUPPQUOTES_AUDIT"
    after update or delete on phsuppquotes for each row
    begin
    insert into phquotes_audit(cprc_new,suppcode,itemcode,cprc_old,negodt,validdt,userid,TRANDATE) values
    (:new.cprc,:old.suppcode,:old.itemcode,:old.cprc,:old.negodt,:old.validdt,:old.userid,SYSDATE);
    end;

    old values and new
    values are to be inserted into the backup table, butwell you have only one insert there, inserting old values with a new id (which is ok if you don't update the id column, but I don't think that :new is available for deleting ops); you should have two inserts:
    insert into
    phquotes_audit(cprc_new,suppcode,itemcode,cprc_old,negodt,validdt,userid,TRANDATE) values (:old.cprc,:old.suppcode,:old.itemcode,:old.cprc,:old.negodt,:old.validdt,:old.userid,SYSDATE);
    if (updating) then
    insert into phquotes_audit(cprc_new,suppcode,itemcode,cprc_old,negodt,validdt,userid,TRANDATE) values (:new.cprc,:new.suppcode,:new.itemcode,:new.cprc,:new.negodt,:new.validdt,:new.userid,SYSDATE);
    end if;
    gojko adzic
    http://gojko.net

  • Using MISSING FIELD VALUES ARE NULL for external table

    I want to place a null for values missing in the sub_account field. Here is my external table:
    CREATE OR REPLACE DIRECTORY INCOMING_ORDERS_log_dir
    AS 'c:\starpubs\starpubs\dataformats\logs\INCOMING_ORDERS\log';
    CREATE OR REPLACE DIRECTORY INCOMING_ORDERS_bad_dir
    AS 'c:\starpubs\starpubs\dataformats\logs\INCOMING_ORDERS\bad';
    create table ext_INCOMING_ORDERS_table (
    Account varchar(5),
    Sub_Account varchar(1),
    Override_Code varchar(1),
    Nomenclature varchar(28),
    chg_nbr varchar(3),
    quantity integer,
    U_I varchar(5),
    zipcode varchar(5),
    type_reject varchar(2)
    organization external
    type oracle_loader
    default directory user_dir
    access parameters
    records delimited by newline
    missing field values are null
    badfile INCOMING_ORDERS_bad_dir:'INCOMING_ORDERS%a_%p.bad'
    logfile INCOMING_ORDERS_log_dir:'INCOMING_ORDERS%a_%p.log'
    fields
    Account(1:5) char(5),
    Sub_Account(7:7) char(1),
    Override_Code(10:10) char(1),
    Nomenclature(11:38) char(28),
    chg_nbr(40:42) char(3),
    quantity(44:48) integer external,
    U_I(50:54) char(5),
    zipcode(56:60) char(5),
    type_reject(61:62) char(2)
    location('PTCLICK.MANUAL.NOMEN.TXT','PTCLICK.ORDERS.TXT', 'EUR_RES.TXT', 'MQ.TXT', 'BPRO.TXT')
    reject limit unlimited;
    How can I place the MISSING FIELD VALUES ARE NULL for missing values for the sub_account?

    made the change I received this error:
    SQL> select * from ext_INCOMING_ORDERS_table;
    select * from ext_INCOMING_ORDERS_table
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-00554: error encountered while parsing access parameters
    KUP-01005: syntax error: found "no": expecting one of: "comma, date_format,
    defaultif, enclosed, ltrim, lrtrim, ldrtrim, notrim, nullif, optionally, ),
    rtrim, terminated"
    KUP-01007: at line 7 column 26
    CREATE OR REPLACE DIRECTORY INCOMING_ORDERS_log_dir
    AS 'c:\starpubs\starpubs\dataformats\logs\INCOMING_ORDERS\log';
    CREATE OR REPLACE DIRECTORY INCOMING_ORDERS_bad_dir
    AS 'c:\starpubs\starpubs\dataformats\logs\INCOMING_ORDERS\bad';
    create table ext_INCOMING_ORDERS_table (
    Account varchar(5),
    Sub_Account varchar(1),
    Override_Code varchar(1),
    Nomenclature varchar(28),
    chg_nbr varchar(3),
    quantity integer,
    U_I varchar(5),
    zipcode varchar(5),
    type_reject varchar(2)
    organization external
    type oracle_loader
    default directory user_dir
    access parameters
    records delimited by newline
    badfile INCOMING_ORDERS_bad_dir:'INCOMING_ORDERS%a_%p.bad'
    logfile INCOMING_ORDERS_log_dir:'INCOMING_ORDERS%a_%p.log'
    fields
    Account(1:5) char(5),
    Sub_Account(7:7) char(1) NO PRESERVE BLANKS,
    Override_Code(10:10) char(1),
    Nomenclature(11:38) char(28),
    chg_nbr(40:42) char(3),
    quantity(44:48) integer external,
    U_I(50:54) char(5),
    zipcode(56:60) char(5),
    type_reject(61:62) char(2)
    location('PTCLICK.MANUAL.NOMEN.TXT','PTCLICK.ORDERS.TXT', 'EUR_RES.TXT', 'MQ.TXT', 'BPRO.TXT')
    reject limit unlimited;

  • Delete the records which have the Data values are NULL before load data to BPC model

    Hi Everyone,
    I am loading the data from flat file to BPC Model (10.0 Version).
    Source data (Flat file) looks like below:
    RP_Employee RPT_Currency Data
    Test                USD                   8
    Test1              USD
    Test2              USD                    6
    My user requirement is that to delete the records which have the Data values are NULL before load data to BPC model.
    So,Please let me know how can i meet to this requirement.
    I am thinking that,it is possible by using start routine BADi. If i am correct please let me know process like creation of class and BADi implementation.
    Thanks in advance!!

    Hi Nilanjan,
    Please see my source data below:
    Account      Client       Employee     Time                Data
    123              XYZ            Vishu            2014.01               300
    456                                                       2014.01
    789              ABC         Alexander      2014.02               200
    If you see the second record,
    If data value is ZULL,  then the Employee or another dimension is also NULL.
    So I want to delete second records.
    If it is Start routine please share the code and steps to do.
    Thanks in advance!!
    Regards,
    Viswanath

  • How to disappear the sub Report if the values are null from db..

    hi.
    i have one requirement ie.
    i put two sub reports at report footer section..
    sub report values are coming from the data base
    Some times  there is no values in data base at sub report two
    plz have a look on below image..it becomes empty.
    can i disappear the sub report if there is no values..
    I need your valuable suggestions..

    Hi
    In your sub reports, you also have to suppress the values (report labels,headings etc) using a formula.
    Go in Report Menu--Section Expert--Suppress -- Formula editor and write the follwoing :
    if Count({Yoursubreportfield)}) > 0 then false else true
    This will suppress your headers and footers or any other secitons which has static information.
    Now in the main report go in section expert and check 'Suppress Blank Sections'
    Also check you have applied New Page before or After for any of your sections.
    --Praveen G

  • XML into table: Why do all my insert values are NULL?

    Hello,
    I'm pretty new in XML ... then I still learn a lot by myself !!!
    I surfed to a lot of forums and examples ....
    I have a XML file. I built a XSL file in order to insert a part of my XML file into a table.
    The 2 files are loaded as CLOB into a DB table.
    I wrote a PLSQL procedure for this job.
    We are on a DB 10gR2.
    As a result, all the inserted columns are loaded with NULL !!!! ....
    I must have done something wrong ... for sure !!! but I cannot figure out.
    Here are the files and procedures:
    *<?xml version="1.0" ?>*
    *<purchaseOrder orderDate="1999-10-20">*
    *<shipTo country="US">*
    *<name>Alice Smith</name>*
    *<street>123 Maple Street</street>*
    *<city>Mill Valley</city>*
    *<state>CA</state>*
    *<zip>90952</zip>*
    *</shipTo>*
    *<billTo country="US">*
    *<name>Robert Smith</name>*
    *<street>8 Oak Avenue</street>*
    *<city>Old Town</city>*
    *<state>PA</state>*
    *<zip>95819</zip>*
    *</billTo>*
    *<comment>Hurry, my lawn is going wild!</comment>*
    *<items>*
    *<item partNum="872-AA">*
    *<productName>Lawnmower</productName>*
    *<quantity>1</quantity>*
    *<USPrice>148.95</USPrice>*
    *<comment>Confirm this is electric</comment>*
    *</item>*
    *<item partNum="926-AA">*
    *<productName>Baby Monitor</productName>*
    *<quantity>1</quantity>*
    *<USPrice>39.98</USPrice>*
    *<shipDate>1999-05-21</shipDate>*
    *</item>*
    *</items>*
    *</purchaseOrder>*
    The XLS file is :
    *<?xml version="1.0"?>*
    *<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">*
    *<xsl:output method="xml" media-type="text/xml" />*
    *<xsl:template match="/">*
    *<insert>*
    *<Table>*
    *<xsl:attribute name="source">*
    *<xsl:value-of select="'item_club'" />*
    *<!--layer=Default-->*
    *</xsl:attribute>*
    *<Columns>*
    *<Column>*
    *<xsl:attribute name="source">*
    *<xsl:value-of select="'item_code'" />*
    *<!--layer=Default-->*
    *</xsl:attribute>*
    *</Column>*
    *<Column>*
    *<xsl:attribute name="source">*
    *<xsl:value-of select="'item_name'" />*
    *<!--layer=Default-->*
    *</xsl:attribute>*
    *</Column>*
    *<Column>*
    *<xsl:attribute name="source">*
    *<xsl:value-of select="'item_price'" />*
    *<!--layer=Default-->*
    *</xsl:attribute>*
    *</Column>*
    *</Columns>*
    *<xsl:for-each select="purchaseOrder/items">*
    *<Rowset>*
    *<xsl:for-each select="item">*
    *<Row>*
    *<Column>*
    *<xsl:attribute name="source">*
    *<xsl:value-of select="'item_code'" />*
    *<!--layer=Default-->*
    *</xsl:attribute>*
    *<xsl:value-of select="@partNum" />*
    *<!--layer=Default-->*
    *</Column>*
    *<Column>*
    *<xsl:attribute name="source">*
    *<xsl:value-of select="'item_name'" />*
    *<!--layer=Default-->*
    *</xsl:attribute>*
    *<xsl:value-of select="productName" />*
    *<!--layer=Default-->*
    *</Column>*
    *<Column>*
    *<xsl:attribute name="source">*
    *<xsl:value-of select="'item_price'" />*
    *<!--layer=Default-->*
    *</xsl:attribute>*
    *<xsl:value-of select="USPrice" />*
    *<!--layer=Default-->*
    *</Column>*
    *</Row>*
    *</xsl:for-each>*
    *<!--layer=Default-->*
    *</Rowset>*
    *</xsl:for-each>*
    *<!--layer=Default-->*
    *</Table>*
    *</insert>*
    *</xsl:template>*
    *</xsl:stylesheet>*
    *<!--xsl-easyControl - (C) 2003-2007 SoftProject GmbH-->*
    *<!--Source: "purchaseOrder_clubDev.xml"|Type:"xml"-->*
    *<!--Destination: "Connexion_XSL_SCFOX.xac"|Type:"Connexion_XSL_SCFOX"-->*
    *<!--Document type: Input Driven-->*
    The XML files are successfully inserted into a CLOB colum :
    ID FILENAME XML
    24 item_club.xsl <?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.or
    25 purchaseOrder.xml <?xml version="1.0" ?> <purchaseOrder orderDate="1999-10-20">
    And the procedure is :
    CREATE OR REPLACE PROCEDURE load_xml( p_dir IN VARCHAR2
    , p_filename IN VARCHAR2) AS
    insCtx DBMS_XMLSave.ctxType;
    rows NUMBER;
    l_bfile BFILE := BFILENAME(p_dir, p_filename);
    l_clob CLOB;
    l_bfile_xsl BFILE;
    l_clob_xsl CLOB;
    begin
         dbms_output.put_line('p_filename='||p_filename);
         insCtx := DBMS_XMLSave.newContext('sipmo.item_club'); -- get the save context..!
         dbms_output.put_line('item_club.xsl context='||insCtx);
         --IMPORTANT... ignore la casse
         DBMS_XMLSave.setIgnoreCase(insCtx, 1);
         --select XSL file item_club.xsl
    l_bfile_xsl := BFILENAME(p_dir, 'item_club.xsl');
         DBMS_LOB.createtemporary (l_clob_xsl, TRUE);
         DBMS_LOB.fileopen( l_bfile_xsl, DBMS_LOB.file_readonly);
         DBMS_LOB.loadfromfile( l_clob_xsl, l_bfile_xsl, DBMS_LOB.getlength(l_bfile_xsl));
         dbms_output.put_line('item_club.xsl length='||DBMS_LOB.getlength(l_bfile_xsl));
         DBMS_LOB.fileclose(l_bfile_xsl);
         DBMS_XMLSave.SETXSLT(insCtx, l_clob_xsl);
         dbms_output.put_line('step 10');
         DBMS_XMLSave.clearUpdateColumnList(insCtx); -- clear the update settings
         DBMS_XMLSave.setUpdateColumn(insCtx,'ITEM_CODE');
         DBMS_XMLSave.setUpdateColumn(insCtx,'ITEM_NAME');
         DBMS_XMLSave.setUpdateColumn(insCtx,'ITEM_PRICE');
         -- Now insert into the table
         dbms_output.put_line('step 90');
         rows := DBMS_XMLSave.insertXML(insCtx, l_clob);
         dbms_output.put_line('step 100 rows='||rows);
         DBMS_XMLSave.closeContext(insCtx);
         DBMS_LOB.freetemporary (l_clob_xsl);
         DBMS_LOB.freetemporary (l_clob);
    END;
    The result table is like this :
    scfx>select * from item_club;
    ITEM_CODE ITEM_NAME ITEM_PRICE
    All the columns of each row are NULL !!!
    Why?
    Do you have any advice ?
    Thanks if advance,
    Olivier

    So, if I understand what you mean ... I should write something like this :
         insert into item_club
              select t2.partnum, t2.productname, to_number(replace(t2.usprice, '.', ','))
              from odab_xml_tab t
              , xmltable('*' passing t.xml.extract('purchaseOrder/items/*')
              columns partNum varchar2(35) path '@partNum'
              , productName varchar2(35) path 'productName'
              , USPrice varchar2(35) path 'USPrice'
              ) t2
    Its a change in our code.. but that looks nice !!!
    Thanks,
    Olivier

  • Some new messages are highlighted in red

    I have received 2 or 3 messages lately that show up in my inbox highlighted in fire truck red. I'm not saying the message is listed in a red font. It's like a red color label has been applied and I'm not sure how it got there. It's not as a result of an action taken by applying a rule; I don't have any rules except the one Apple put it there by default to highlight their messages. How do I disable that? Does Mail handle priority labels sent my other mail apps by applying a color label?

    William, I have limited experience of this kind of happening but I do know that my ISP can highlight any email that has possible problematic content. Here in Australia there are government regulations concerning spam & emails with certain words in the message. I've had a couple of emails coloured as a warning that I should be careful.
    I suggest you check with your ISP whether or not this is what has happened.
    Neville

  • How to convert a measure value to null when the actual measure value is 0

    Hello Gurus,
    I have year, products, measure 1, measure 2, measure 3. I am added three products into one category by using bin in the analysis i am getting zeros for some of the measure cells when it should be null values, because the actual measure values are null for indivudual product. How can i convert that 0's to null. Please advise.
    Thanks,
    RC

    To answer your immediate question, you can write this:
    CASE WHEN table.column = 0 THEN NULL ELSE table.column END
    Remember though, that any aggregations done on a record that is NULL will not yield a sum. That is why the usual case is to convert NULLs to 0s. But that may not be a concern for what you are doing. Good luck!

  • Conditionally hide a Table in template if underlying rows of table are null

    Hi Folks.
    Very new to BIP but keen to learn.
    I have successfully set up an RTF template and I can get it to run with my BIP.
    I have defined a table in the report using the Table Wizard. What I'd like to do now is wrap the table definition in the document with a condition that checks if the underlying table values are null. I.e. if the table behind that particular section has no rows then I don't want to display the column headers etc. nothing.
    I have tried adding the following before the table...
    <?if:SEQ!=''?>
    Then insert the table using the wizard..
    Then finish with
    <?end if?>
    There's no whitespace between the if, the table and the end if statements.
    I'm hoping to test that if SEQ is null then don't display the table.
    Am I missing something simple or am I wildly off-track?
    Any pointers appreciated.
    Many thanks
    Kind regards
    Dogfighter.

    Disregard last post.
    MODS feel free to purge this.
    It actually works.
    Don't know what I was doing wrong but the code I quoted in the last post does what it's supposed to.
    Just tired I guess.
    Cheers
    Dogfighter.

  • New podcasts are not marked as unplayed

    Hello,
    With the Podcasts app some new podcasts are not automatically marked as unplayed in the iPhone and iPad apps with iOS 8 and iOS 7 (there is no problem with iTunes in my mac/windows laptops).
    I have realized that it depends on the format of the date of episode. For example, if the format is something like "22 nov 0014", the new episodes won´t be marked as unplayed and I have to do it manually.
    However, if the format of the date is something like "15 of november", the new episodes will be marked as unplayed.
    I have tried to modify the format of the date of the iPhone to U.S. (I am spanish), but nothing changed.
    Do you have any idea about the reason of this behavior? Checking all the new episodes manually is very annoying.
    Thank in advance.

    I don´t know why but the problem was solved two days ago. Now, the format of the date in the app is exactly the same for all the podcasts, the "correct" one.
    I guess that apple has modified something in the database to use the same format that it was using the iTunes app of OSX.

  • Add new values to the Domain J_1BINDUS3 CFOP category of the material

    Hello Gurus
    I have a request from the business to include some new values in the domain J_1BINDUS3 CFOP category of the material.
    Since is a standard object seems to be a work Basis team, however before requesting this I would like to get some advice from the experts to understand if adding new values to this domain can cause side effects or if I should maintain other objects as result of this request.
    I know table J_1BAON has to be maintained to properly determine CFOPs for the new fields but along that is there any other one?
    Is this the right process to include new CFOP categories?
    The requirement is to properly identify Assets as Productive and Non Productive when making the PO, since this can help us to determine tax code automatically.

    Have you tried using "Map published data" in the Utilities pane, mapping the department field to the corresponding security group.
    http://codebeaver.blogspot.dk/

  • INCLUDING NEW VALUES  in materialized view log

    CREATE MATERIALIZED VIEW products_mv
    REFRESH FAST ON COMMIT
    AS SELECT SUM(list_price - min_price), category_id
    FROM product_information
    GROUP BY category_id;
    Could anybody tell me why INCLUDING NEW VALUES are necessary in materialized view log for such an aggregate materialized view?
    Thanks,
    P.

    Answer depends on your need; do you need these values on your mv log -
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/basicmv.htm#sthref545
    Best regards.

  • Dropdown values are missing while using the function module KCD_EXCEL_OLE_TO_INT_CONVERT

    Hi all,
    when i am trying to upload the excel template by using the function module " KCD_EXCEL_OLE_TO_INT_CONVERT" to an internal table some field values are missing.
    i am using the function module " KCD_EXCEL_OLE_TO_INT_CONVERT"  and i am uploading an excel template and downloading that excel data into an internal table but some field values are missing while uploading the excel template and i found that the field which contains the drop down list values those values are missing.
    And also when i am uploading the excel template by using the function module" KCD_EXCEL_OLE_TO_INT_CONVERT"  when i am coming out of this function module one pop up is coming. how can i avoid this popup, can any one please provide me the solution thanks in advance.
    FYI...it is showing the below popup screen ..
    Thanks,
    Koushik

    hi Feiyun,
    below is the code(highlighted in bold)and after coming out of the function module i am getting popup and also the drop down values are missing.
    DATA: ls_control         TYPE zsfi_fiupload_control,
             ls_header          TYPE zsfi_fiupload_header_v13,
             ls_item            TYPE zsfi_fiupload_item_v13,
             ls_trailer         TYPE zsfi_fiupload_control,
             l_line_count       LIKE zsfi_fiupload_control-rec_count,
             l_current_curr     TYPE kcde_cells-value,
             l_current_postdate TYPE kcde_cells-value,
             l_current_compcode TYPE kcde_cells-value,
             l_currentrow       TYPE kcde_cells-row,
             l_filename         LIKE rlgrap-filename.
       DATA: BEGIN OF lt_intern OCCURS 0.
               INCLUDE STRUCTURE  kcde_cells.
       DATA: END OF lt_intern.
       DATA: BEGIN OF lt_items OCCURS 0,
               a TYPE kcde_cells-value,
               b TYPE kcde_cells-value,
               c TYPE kcde_cells-value,
               d TYPE kcde_cells-value,
               e TYPE kcde_cells-value,
               f TYPE kcde_cells-value,
               g TYPE kcde_cells-value,
               h TYPE kcde_cells-value,
               i TYPE kcde_cells-value,
               j TYPE kcde_cells-value,
               k TYPE kcde_cells-value,
               l TYPE kcde_cells-value,
               m TYPE kcde_cells-value,
               n TYPE kcde_cells-value,
               o TYPE kcde_cells-value,
               p TYPE kcde_cells-value,
               q TYPE kcde_cells-value,
               r TYPE kcde_cells-value,
               s TYPE kcde_cells-value,
               t TYPE kcde_cells-value,
               u TYPE kcde_cells-value,
               v TYPE kcde_cells-value,
               w TYPE kcde_cells-value,
               x TYPE kcde_cells-value,
               y TYPE kcde_cells-value,
               z TYPE kcde_cells-value,
               aa TYPE kcde_cells-value,
               ab TYPE kcde_cells-value,
               ac TYPE kcde_cells-value,
               ad TYPE kcde_cells-value,
               ae TYPE kcde_cells-value,
               af TYPE kcde_cells-value,
               ag TYPE kcde_cells-value,
               ah TYPE kcde_cells-value,
               ai TYPE kcde_cells-value,
               AJ TYPE KCDE_CELLS-VALUE,
               AK TYPE KCDE_CELLS-VALUE,
               END OF lt_items.
       l_filename = p_flpath.
    * the file must be an xls file, not xlsx or comma seperated
       IF p_flpath NS '.xls' AND p_flpath NS '.XLS'.
         MESSAGE i261(zfi).
         g_error = 'X'.
         EXIT.
       ENDIF.
    * upload excel file to a generic table
       CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
         EXPORTING
           filename                = l_filename
           i_begin_col             = 1
           i_begin_row             = 1
           i_end_col               = 150
           i_end_row               = 65000
         TABLES
           intern                  = lt_intern
         EXCEPTIONS
           inconsistent_parameters = 1
           upload_ole              = 2
           OTHERS                  = 3.
       IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       ENDIF.
    * validate that the format is in the restatement format
    *  this is the only template to have the ledger group in cell G-2
    **  READ TABLE lt_intern WITH KEY row = '0002' col = '0007'.
    **  IF sy-subrc <> 0 OR lt_intern-value IS INITIAL.
    **    MESSAGE i260(zfi).
    **    g_error = 'X'.
    **    EXIT.
    **  ENDIF.
    * create control record values
       ls_control-rec_type = 'C'.
       ls_control-global_id = 'GLU-03000'.
       ls_control-local_id = ''.
       ls_control-rec_count = ''.
       CONCATENATE sy-datum sy-uzeit INTO ls_control-date.
       ls_control-version = '12'.
       ls_control-email = ''.
       ls_control-eor = 'X'.
       ls_trailer = ls_control.
    * open output file and add the control record
       OPEN DATASET p_unixfilename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
       TRANSFER ls_control TO p_unixfilename.
    * create header record values, will be transfered to file in the item loop
       ls_header-rec_type = 'H'.
       READ TABLE lt_intern WITH KEY row = '0017' col = '0003'.
       IF sy-subrc = 0.
         ls_header-header_txt = lt_intern-value.
       ENDIF.
       READ TABLE lt_intern WITH key row = '0020' col = '0002'.
       IF sy-subrc = 0.
         ls_header-comp_code = lt_intern-value.
       ENDIF.
    ************doc date
       READ TABLE lt_intern WITH KEY row = '0011' col = '0003'.
       IF sy-subrc = 0.
         ls_header-pstng_date = lt_intern-value.
       ENDIF.
    ************posting date
         ls_header-doc_date = sy-datum.
       READ TABLE lt_intern WITH KEY row = '0009' col = '0003'.
       IF sy-subrc = 0.
         ls_header-doc_type = lt_intern-value.
       ENDIF.
       READ TABLE lt_intern WITH KEY row = '0014' col = '0003'.
       IF sy-subrc = 0.
         ls_header-ref_doc_no = lt_intern-value.
       ENDIF.
    ************currency moved to line items
         READ TABLE lt_intern WITH KEY row = '0020' col = '0001'.
       IF sy-subrc = 0.
       ls_header-currency = lt_intern-value.
       ENDIF.
       ls_header-trans_date = ''.
       READ TABLE lt_intern WITH KEY row = '0010' col = '0003'.
       IF sy-subrc = 0.
         ls_header-period = lt_intern-value.
       ENDIF.
       READ TABLE lt_intern WITH KEY row = '0006' col = '0003'.
       IF sy-subrc = 0.
         ls_header-reason_rev = lt_intern-value.
       ENDIF.
       READ TABLE lt_intern WITH KEY row = '0007' col = '0003'.
       IF sy-subrc = 0.
         ls_header-rev_date = lt_intern-value.
       ENDIF.
    *  READ TABLE lt_intern WITH KEY row = '0002' col = '0007'.
    *  IF sy-subrc = 0.
         ls_header-ledger_grp = ''.
    *  ENDIF.
    *  READ TABLE lt_intern WITH KEY row = '0013' col = '0013'.
    *  IF sy-subrc = 0.
         ls_header-exch_rate = ''.
    *  ENDIF.
       READ TABLE lt_intern WITH KEY row = '0008' col = '0003'.
       IF sy-subrc = 0.
         ls_header-calc_tax = lt_intern-value.
       ENDIF.
       ls_header-eor = 'X'.
    * loop at the line items and append them to a table with multiple columns
       LOOP AT lt_intern WHERE row GE 20.
         IF l_currentrow <> lt_intern-row AND l_currentrow IS NOT INITIAL.
           APPEND lt_items.
           CLEAR lt_items.
         ENDIF.
         l_currentrow = lt_intern-row.
         CASE lt_intern-col.
           WHEN '0001'. lt_items-a = lt_intern-value.
           WHEN '0002'. lt_items-b = lt_intern-value.
           WHEN '0003'. lt_items-c = lt_intern-value.
           WHEN '0004'. lt_items-d = lt_intern-value.
           WHEN '0005'. lt_items-e = lt_intern-value.
           WHEN '0006'. lt_items-f = lt_intern-value.
           WHEN '0007'. lt_items-g = lt_intern-value.
           WHEN '0008'. lt_items-h = lt_intern-value.
           WHEN '0009'. lt_items-i = lt_intern-value.
           WHEN '0010'. lt_items-j = lt_intern-value.
           WHEN '0011'. lt_items-k = lt_intern-value.
           WHEN '0012'. lt_items-l = lt_intern-value.
           WHEN '0013'. lt_items-m = lt_intern-value.
           WHEN '0014'. lt_items-n = lt_intern-value.
           WHEN '0015'. lt_items-o = lt_intern-value.
           WHEN '0016'. lt_items-p = lt_intern-value.
           WHEN '0017'. lt_items-q = lt_intern-value.
           WHEN '0018'. lt_items-r = lt_intern-value.
           WHEN '0019'. lt_items-s = lt_intern-value.
           WHEN '0020'. lt_items-t = lt_intern-value.
           WHEN '0021'. lt_items-u = lt_intern-value.
           WHEN '0022'. lt_items-v = lt_intern-value.
           WHEN '0023'. lt_items-w = lt_intern-value.
           WHEN '0024'. lt_items-x = lt_intern-value.
           WHEN '0025'. lt_items-y = lt_intern-value.
           WHEN '0026'. lt_items-z = lt_intern-value.
           WHEN '0027'. lt_items-aa = lt_intern-value.
           WHEN '0028'. lt_items-ab = lt_intern-value.
           WHEN '0029'. lt_items-ac = lt_intern-value.
           WHEN '0030'. lt_items-ad = lt_intern-value.
           WHEN '0031'. lt_items-ae = lt_intern-value.
           WHEN '0032'. lt_items-af = lt_intern-value.
           WHEN '0033'. lt_items-ag = lt_intern-value.
           WHEN '0034'. lt_items-ah = lt_intern-value.
           WHEN '0035'. lt_items-ai = lt_intern-value.
           when '0036'. lt_items-aj = lt_intern-value.
           when '0037'. lt_items-ak = lt_intern-value.
         ENDCASE.
       ENDLOOP.
       APPEND lt_items.
    * sort rows by the post date, comp code, curr.
    *  SORT lt_items BY ah a ai.
    * loop at the items, creating a header record if the comp code, curr. or post date changes
       LOOP AT lt_items.
         ls_item-rec_type = 'I'.
         ls_item-post_key = lt_items-c.   "lt_items-b.
         IF lt_items-c GE '20' AND lt_items-c LE '39'.
           ls_item-vendor_no = lt_items-d.
         ELSEIF lt_items-c GE '0' AND lt_items-c LE '19'.
           ls_item-customer = lt_items-d.
         ELSEIF lt_items-c EQ '70' AND lt_items-c EQ '75'.
           ls_item-asset = lt_items-d.
         ELSE.
           ls_item-gl_account = lt_items-d.
         ENDIF.
         ls_item-asset_type = lt_items-m. "lt_items-l.
         ls_item-trans_type = lt_items-n. "lt_items-m.
         ls_item-print_flag = ''.
         ls_item-item_text = lt_items-j. "lt_items-i.
         ls_item-comp_code = lt_items-b. "lt_items-a.
         ls_item-bus_area = ''.
         ls_item-alloc_nmbr = lt_items-l. "lt_items-k.
         ls_item-tax_code = lt_items-q. "lt_items-p.
         ls_item-taxjurcode = lt_items-r. "lt_items-q.
         ls_item-profit_ctr = lt_items-g. "lt_items-f.
         ls_item-costcenter = lt_items-h. "lt_items-g.
         ls_item-orderid = lt_items-ac. "lt_items-ab.
         ls_item-wbs = lt_items-i. "lt_items-h.
         ls_item-trade_id = lt_items-o. "lt_items-n.
         ls_item-part_prctr = lt_items-p. "lt_items-o.
         ls_item-material = lt_items-t. "lt_items-s.
         ls_item-salesorg = lt_items-aa. "lt_items-z.
         ls_item-distr_chan = lt_items-ab. "lt_items-aa.
         ls_item-pmnttrms = ''.
         ls_item-pmtmthd = ''.
         ls_item-pmtmthsupl = ''.
         ls_item-alt_payee = ''.
         REPLACE ALL OCCURRENCES OF '(' IN lt_items-e WITH ''.
         REPLACE ALL OCCURRENCES OF ')' IN lt_items-e WITH ''.
         ls_item-amt_doccur = lt_items-e. "lt_items-d
         REPLACE ALL OCCURRENCES OF '(' IN lt_items-f WITH ''.
         REPLACE ALL OCCURRENCES OF ')' IN lt_items-f WITH ''.
         ls_item-loc_amt = lt_items-f. "lt_items-e
         ls_item-loc  = lt_items-k. "lt_items-j.
         ls_item-sas_revtype = lt_items-s. "lt_items-r.
         ls_item-rev_type = lt_items-u. "lt_items-t.
         ls_item-rev_chnl = lt_items-v. "lt_items-u.
         ls_item-bill_to = lt_items-x. "lt_items-w.
         ls_item-payer = lt_items-z. "lt_items-y.
         ls_item-ship_to = lt_items-y.
         ls_item-tax_amnt = lt_items-x.
         ls_item-func_area = ''.
         ls_item-expend_date = lt_items-ae. "lt_items-ad.
         ls_item-wtax_code = lt_items-af. "lt_items-ae.
         ls_item-wtax_base = lt_items-ag. "lt_items-af.
         ls_item-wtax_amount = lt_items-ah. "lt_items-ag.
         ls_item-payment_block = ''.
         ls_item-grp_amt = ''.
         ls_item-anc_amt = ''.
         ls_item-permit_payee = ''.
         ls_item-value_date = ''.
         ls_item-pernr   = ''.
         ls_item-legacy1 = ''.
         ls_item-legacy2 = ''.
         ls_item-legacy3 = ''.
         ls_item-legacy4 = ''.
         ls_item-legacy5 = ''.
         ls_item-legacy6 = ''.
         ls_item-legacy7 = ''.
         ls_item-legacy8 = ''.
         ls_item-legacy9 = ''.
         ls_item-legacy10 = ''.
         ls_item-eor = 'X'.
         TRANSLATE lt_items-ai TO UPPER CASE.
         TRANSLATE lt_items-b TO UPPER CASE.
         TRANSLATE lt_items-a TO UPPER CASE.
         TRANSLATE lt_items-aj TO UPPER CASE.
         IF l_current_curr <> lt_items-a "lt_items-ai
           OR l_current_postdate <> ls_header-pstng_date "lt_items-aj
           OR l_current_compcode <> lt_items-b.
           l_current_curr = lt_items-a.
           l_current_postdate = ls_header-pstng_date. "lt_items-aj.
           l_current_compcode = lt_items-b.
           ls_header-comp_code = l_current_compcode.
           ls_header-currency = l_current_curr.
           ls_header-pstng_date = l_current_postdate.
           ls_header-doc_date = l_current_postdate.
           TRANSFER ls_header TO p_unixfilename.
           l_line_count = l_line_count + 1.
         ENDIF.
         TRANSFER ls_item TO p_unixfilename.
         l_line_count = l_line_count + 1.
       ENDLOOP.
       ls_trailer-rec_type = 'T'.
       ls_trailer-rec_count = l_line_count.
       TRANSFER ls_trailer TO p_unixfilename.
       CLOSE DATASET p_unixfilename.
    * change the format to fixed format for the remainder of the load program
       p_fixed = 'X'.
       p_rstmnt = ''.
    Thanks,
    Koushik

  • Con Gen : Token Values are not getting replaced

    Hi All,
    We are on E-Sourcing 5.0 and whenever we are trying to generate a contract from master agreement,
    the token varibles are not getting replaced.
    I looked into contract generation logs and found that the token values are null..but while creating the contract it is able to find the various tokens and token values..
    Why token values are not getting replaced even though its value exists?
    Please guide me...
    Thanks and Regards,
    Himanshu Sharma
    Edited by: HImanshu Sharma on Apr 20, 2009 8:50 AM

    Hi Kamalakar,
    Thanks for replying..
    1. Yes I am using standard tokens like <%Agreement.EffectiveDate%>,<%Agreement.VendorName%>..
    2. I have checked that tokens have values..
    3. Attributes are not hidden..
    I am able to see values on the "Confirm contract document variable data" page but when I click next, it gives error in the "processing request" page.
    By going through the contract gen web service I found that the values are not getting passed..
    Can you please tell me what could be the reason..
    Thanks and regards,
    Himanshu Sharma
    P.S. Please tell me how to upload file.

  • Update Trigger: New Value

    Hi, I am in a strange situation, hope some one can help me. I have a BEFORE UPDATE trigger in which I have a condtion like.
    IF :new.col1 is NULL THEN
    :new.col1 := 'AA';
    END IF;
    My aim is if col1 set to NULL or col1 is not included in update statement then value 'AA' should be assigned to col1.
    This works fine in following cases
    1) If UPDATE statement set col1 to NULL explicitly
    2) If :old.col1 is NULL and col1 is not included in update statement
    But not working when
    3) :old.col1 IS NOT NULL and col1 is not included update statement.
    I want value 'AA' should assigned to col1 in case 3 also. Is there any way ?
    Thanks.

    I don't think that this can be done through the trigger alone, because the trigger cannot distinguish between the two cases where ...
    i) col1 is not mentioned in the update, and ...
    ii) col1 is mentioned but is updated from a non-null value to the same value.

Maybe you are looking for

  • What are the Oracle Home and GRID home directory locations for Oracle 12c (12.1.0.5) release

    Hello All, I plan to install and configure Oracle 12c Cloud Control console on a single standalone server and the version is Oracle 12.1.0.5. All the databases which are installed across in the entire farm/landscape are these versions: Oracle 10.2.0.

  • INSTALLATION CS6 MAC OS 10.7

    Bonjour, Il m'est impossible de procéder l'installation de CS6 sous Mac OS 10.7.5 Le disque d'installation est évacuer avant la fin de l'installation. Que faire ? Merci

  • How to share downloaded apps with wife?

    This should be simple. I've installed apps purchased with my iTunes account on my wife's iPhone using iTunes on my computer. She wants to be able to use the apps and install music purchased with her iTunes account, but when she tries to install music

  • Lots of FEC events

    ADSL Line Status Connection Information Line state: Connected Connection time: 0 days, 19:45:42 Downstream: 8.743 Mbps Upstream: 1.098 Mbps ADSL Settings VPI/VCI: 0/38 Type: PPPoA Modulation: G.992.5 Annex A Latency type: Interleaved Noise margin (Do

  • Da old guy

    What can I do when I lost my hard drive and can't reinstall Adobe Photoshop Elements 9 on the new drive?