Extract function for xmltype replaces ~ (tilde) with ']]]'

Hi,
In 10.2.0.4 when extracting fragment using xpath and extract function is replacing ~ with ]]]. strange thing is, it happens with only one ~ though there are many ~ in the xml.
Has anyone faced similar issue with extract() function ?
Thanks,
vivek

This turned out to be a bug. It was resolved through a patch developed.

Similar Messages

  • How to pass parameter into extract function (for XMLTYPE)

    I have a table PROBLEMXML with XMLTYPE field xml_column. In this column there are several deffinitions for the problem. There is no max amount of deffinitions and it can be no definition at all. I need to return all definitions for every problem as a string wirh definitions separated by ";".
    Query
    SELECT extract(prob.Def,'/Definitions/Definition[1]/@var') || ';'|| extract(prob.Def,'/Definitions/Definition[2]/@var')
    FROM PROBLEMXML j ,
    XMLTABLE (
    '/problem'
    PASSING j.xml_column
    COLUMNS probid VARCHAR (31) PATH '/problem/@id',
    Def XMLTYPE PATH '/problem/Definitions') prob
    where PROBLEM_ID =1;
    returns exactly what I want a;m.
    But
    declare
    my_var varchar2(2000) :=null;
    n1 number;
    n2 number;
    begin
    n1:=1;
    n2:=2;
    SELECT extract(prob.Def,'/Definitions/Definition[n1]/@var') || '|'|| extract(prob.Def,'/Definitions/Definition[n2]/@var') into my_var
    FROM ETL_PROBLEMXML_STG_T j ,
    XMLTABLE (
    '/problem'
    PASSING j.xml_column
    COLUMNS probid VARCHAR (31) PATH '/problem/@id',
    Def XMLTYPE PATH '/problem/Definitions') prob
    where PROBLEM_ID =1;
    dbms_output.put_line(my_var);
    end;
    returns NULL.
    Is there is a way to pass parameter into extract function?

    I need to return all definitions for every problem as a string wirh definitions separated by ";".In XQuery, there's the handy function "string-join" for that.
    For example :
    SQL> WITH etl_problemxml_stg_t AS (
      2   SELECT 1 problem_id,
      3  xmltype('<problem id="1">
      4   <Definitions>
      5    <Definition var="var1"></Definition>
      6    <Definition var="var2"></Definition>
      7    <Definition var="var3"></Definition>
      8   </Definitions>
      9  </problem>') xml_column
    10   FROM dual
    11  )
    12  SELECT j.problem_id,
    13         prob.probid,
    14         prob.def
    15  FROM etl_problemxml_stg_t j,
    16       XMLTable(
    17        'for $i in /problem
    18         return element r
    19         {
    20          $i/@id,
    21          element d { string-join($i/Definitions/Definition/@var, ";") }
    22         }'
    23        passing j.xml_column
    24        columns
    25         probid varchar2(30)  path '@id',
    26         def    varchar2(100) path 'd'
    27       ) prob
    28  ;
    PROBLEM_ID PROBID               DEF
             1 1                    var1;var2;var3

  • Help required in extract functionality for xml with namespaces

    Hi,
    We recently upgraded our database from 9i to 10G. After the upgrade few queries are not working as expected. Below query does not fetch any results in 10G but works perfectly fine in 9i. Could you please help me with a work around.
    select XMLType.extract(xmltype('<?xml version="1.0" encoding="UTF-8"?>
    <hierarchy docVersion="1" documentID="4738800" enddate="4999-12-31T00:00:00.000" isCurrentVersion="true" isEditable="true" startdate="2007-05-21T13:06:58.737" uniqueID="4738800" xmlns="http://schema/hierarchy" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema/hierarchy http://schema/hierarchy.xsd">
    <name>tshiiiiiiiiiiii</name>
    <description>tshiiiiiiiiiiii</description>
    <find_duplicates_on_save>false</find_duplicates_on_save>
    <root href="http://node?/node/@documentID=123" label="root" type="locator"/>
    <connection to="root" type="simple"/>
    </hierarchy>
    '),'//*/@xmlns').getClobVal() as "XMLNS" from dual;
    result : http://schema/hierarchy
    We dont want to use '//*/namespace::*' in the xpath as it will give us xsi value along with xmlns. Oracle metalink says its a bug in oracle 10g version (bug 5100590) but couldnot find workaround. Please help us.
    Thanks and Regards
    Shifali

    Re: Adding report (query & workbook, templates) in roles
    Go through this thread.
    And in our Project we have created one role for accessing workbooks. in that end user can access the work book but saved one and user cannot resave or delete the work book.
    we have added Auth objects S_TCODE and S_GUI.
    in S_TCODE we have added RRMX and in S_GUI we have given 60(IMPORT) access to the users.
    So that they can just share the workbook. nothing else can be done.
    Try like this. Hope this would help you.

  • Substitute Function in Excel: Replace text with instance number in BO

    Hi,
    I have a column where data is merged from three other columns each text separated by "-". Ex: Services - Phoneline - New Customer.
    What I wanted to do is to just get the last text which is "New Customer" separated. I used "Length(<columnValue>)-Length(Replace(<columnValue),"-",""))" to get the number of instances of "-" in the text as it varies from 1 to 3.
    I use to do it in excel using substitute function where I have the facillity to use the character instance number. I don't know how to do this in Business objects.
    Please help...
    Thanks

    DDann wrote:
    =SUMIF('New Req to Capability Mapping'!$D$2:$D$148,A2,'New Req to Capability Mapping'!$I$2:$I$148)
    Col A is a list of the capabilities and the formulas are in COL B of this sheet.  [....] The problem that I am experiencing is that for some of the capabilities I am see correct count totals for some while others are not for instance, "Account
    Management" shows correct while "Security Awareness Program" is not. I have copied the text for each of the capabilities from the main sheet into Col A to reduce keystroke errors. I have also copied those strings into some of the problematic
    formulas instead of using the cell address to see if the results change.
    Good troubleshooting techniques.  Unless someone gets lucky with a wild guess, I suspect we cannot help without having the workbook to see the situation for ourselves.
    You can upload an example Excel file (devoid of any private data) that demonstrates the problem to a file-sharing website.
    Then post the "shared", "public" or "view-only" link (aka URL; http://...) in a response here.
    The following is a list of some free file-sharing websites; or use your own.
    Box.Net: http://www.box.net/files
    Windows Live Skydrive: http://skydrive.live.com
    MediaFire: http://www.mediafire.com
    FileFactory: http://www.filefactory.com
    FileSavr: http://www.filesavr.com
    RapidShare: http://www.rapidshare.com
    I suspect that the problem has to do with either a mismatch in spacing or the presence of non-breaking spaces (HTML &nbsp) or other non-printing characters, notwithstanding your efforts to eliminate that possibility with your copy-and-paste experiments.

  • Extract function (For XML)

    Hi,
    I need to extract values from the following XML block where I need to extract the value of TDEXPIRYDATE (20120707):
    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <soapenv:Body>
              <m:EEODEN01_Response xmlns:m="http://entirex/rop">
                   <TDEXPIRYDATE>20120707</TDEXPIRYDATE>
                   <TD-ISSUE-PLACE>999</TD-ISSUE-PLACE>
                   <PASSPORT-LANG>1</PASSPORT-LANG>
              </m:EEODEN01_Response>
         </soapenv:Body>
    </soapenv:Envelope>
    How can this be done , I mean what is the XPAth to be passed to the function extract?
    Thanks in advance
    Regards
    AK

    michaels>  with t as (
    select xmltype('<?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">                                                                                                                                                                                                                                                                                          
      <soapenv:Body>                                                                                                                                                                                                                                                                                                                                                                                                                                                         
        <m:EEODEN01_Response xmlns:m="http://entirex/rop">                                                                                                                                                                                                                                                                                                                                                                                                                   
          <TDEXPIRYDATE>20120707</TDEXPIRYDATE>                                                                                                                                                                                                                                                                                                                                                                                                                              
          <TD-ISSUE-PLACE>999</TD-ISSUE-PLACE>                                                                                                                                                                                                                                                                                                                                                                                                                               
          <PASSPORT-LANG>1</PASSPORT-LANG>                                                                                                                                                                                                                                                                                                                                                                                                                                   
        </m:EEODEN01_Response>                                                                                                                                                                                                                                                                                                                                                                                                                                               
      </soapenv:Body>                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    </soapenv:Envelope>
    ') xml from dual)
    select extractvalue(xml, '//TDEXPIRYDATE/text()') tdexpirydate from t t
    TDEXPIRYDATE  
    20120707 

  • How do I determine the correct part number for a replacement topecase with keyboard?

    What is the correct replacement part number for a Macbook 13" Core 2 Duo (Identifier 4,1) s/n
           W88*****0P0 ?
    <Edited by Host>

    Hi PePe
    I made the change and it worked as I wanted it. Thanks a lot.
    You say there's no need to Maintain the Responsibilities Rule. Can I ask what this section does and why it can be one or the other?
    Regards
    Declan

  • EXTRACT function and Chinese data

    Hi !
    I'm working with PL/SQL web applications, and I'm having trouble viewing it on a webpage when I use EXTRACT function for Chinese data.
    <abccompany> <department> &#20975;&#20262;·&#23041;&#24265;&#26031;&#26159;&#19968;&#23478;&#23567;&#22411;&#31038;&#21306;&#21046;&#33647;&#21378;&#30340;&#25152;&#26377;&#32773;&#65292;&#22905;&#27491;&#32771;&#34385;&#24320;&#22987;&#25552;&#20379;&#33647;&#26041;&#36882;&#36865;&#30340;&#26381;&#21153;&#65292;&#21516;&#26102;&#20063;&#24050;&#32463;&#23601;&#27492;&#20107;&#24449;&#27714;&#20102;&#20445;&#38505;&#19987;&#23478;&#40077;&#21187;·&#24067;&#26391;&#30340;&#24847;&#35265;&#12290;&#20975;&#20262;&#35810;&#38382;&#40077;&#21187;&#65292;&#38656;&#35201;&#36141;&#20080;&#21738;&#20123;&#20445;&#38505;&#12289;</department></abccompany>
    The Chinese xml data is stored as 'xmltype' in the Oracle database.
    1)
    When I run the below query, the output shown on a web page is upside down question marks like this
    select v.xtext.EXTRACT('/abccompany/department/text()').GetClobVal()
    into text
    from case_text v
    where case_identifier=inIdx;
    htp.print('<html><body>')
    htp.print(text);
    htp.print('</body></html>');
    2)
    However, the EXTRACT function works perfectly for English data.
    3)
    I also observed that, when I replace
    select v.xtext.EXTRACT('/abccompany/department/text()').GetClobVal()
    with
    to_clob(xtext)
    the web page displays the Chinese contents of the whole file and not just within the nodes <abccompany><department>.
    How can I make Extract function work with Chinese data ?
    Any help appreciated !
    -Sara

    Sara
    This normally happens when the client character set is not capable of showing chinese data. For instance on my laptop I cannot show the results of an extract() which returns chinese or japanese data in sqlplus (which cannot show chinese data on my machine) but I can in ISQL*PLUS which is web based and can show chinese data.
    THis might be a result of your NLS_LANG settings. The database translates from the database character set (I'm assuming AL32UTF8 in this case, into the client character set (as defined by NLS_LANG). Again if the characters cannot be converted this can cause this issue.

  • Search function for Product description in shopping cart

    Hi,
    We are using SRM 5.5 version. We have a problem when we are searching the Product with the Product description.
    Shop -> Create Shopping Cart -> Internal Goods/Services
    Enter a pattern between the stars such as
    *cap*
    and then Click Start.
    System is not restricting the search output with the pattern
    *cap*
    . Instead it is displaying all the Products and search is not getting restricted by the search function.
    When I was searching for an OSS note to fix this issue, i found the note(1322462) to fix a similar issue with the Product ID.
    Do we have any SAP note to fix the issue with the Product Description? Please guide me.
    With regards
    Krishna
    Edited by: krishnadasan on Nov 12, 2010 7:37 PM

    Hi Muthu,
    Current service pack  is SP 13(SAPKIBKT13).
    I believe this SAP note 1322462 can resolve the issue with search function for the "Product ID". I will implement this note and let you know the result.
    Do we have any SAP note to solve the issue with the search function for "Product Description"?
    With regards
    Krishna

  • Problem with "&#34" using PL/SQL extract function ( XMLTYPE)

    Hi,
    When I use extract function (PL/SQL), it does not transform well "&#34". Insted of returning ' " ' , it returns ' &quot '.
    I know this works changing the code replacing xml.extract for SELECT extractvalue(xml,'//A/text()') into v from dual;
    But Is there another way to do this using PL/SQL? any patch, option..?
    Regards

    Hi,
    cursor proct is select * from proc22;
    cursor proct5 is select *from proc24;
    fetch proct into proctval;
    fetch proct5 into proctval5;
    if proct.symbol=proct5.symbolThat's strange to join two tables like this. You will have chance if you enter in your if condition.
    Why not create only one cursor with this join condition on the two tables ?
    re5:=re5/proctval.previousprice5;Furthermore, what do you make with r5 variable ? It seems nothing to do. Your proc does no much job.
    What do you want to achieve exactly ?
    Nicolas.

  • Required replace BSEG with BSAK BSIK BSIS BSAS for report performance

    Hi Experts
    i m optimizing a report in which data is extracting from BSEG , 5 time so i reduses the performance of report
    so i want replace BSEG with BSAK BSIK BSIS BSAS for the same data what I am getting now . this is report of Purchase of item. code is here.
    REPORT  zmm_pur_reg_kanhe LINE-SIZE 1023.
    *& Des         :Purchase Tax Register Report for KANHE
    *& Created on  :12-07-07
    *& Suggested by:Paresh Saini(MM)
    *& Changes By: Lailu Philip
    *& Changed On: 24.09.2007
    *& Changes: New columns for G/L Code Description,VAT Amt,VAT Perc,CST Perc
    *&                         ,SHCESS Amounts,WCT G/L Acc., WCT Amt,Tax Code
    *&                          for Purchase Order,WCT tax code & Percentage.
    *& Request No:  S6DK921577
    Data Declaration
    *& changes: by Vincy on 12.01.2007
    *& changes: display purchase order with vendor type zpsr(get_zpsr)
    *& Request No:  S6DK930821
    TABLES:ekbe, lfa1, faglflexa.",j_1iexcdtl,lfa1,bkpf,bseg.
    TYPE-POOLS: slis.                                 "ALV Declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
           gd_layout    TYPE slis_layout_alv,
           gd_repid     LIKE sy-repid.
    DATA: it_sortcat   TYPE slis_sortinfo_alv OCCURS 1,
           col_pos LIKE fieldcatalog-col_pos .
    TYPES :BEGIN OF wa1_ekbe,
            belnr         TYPE ekbe-belnr,
            budat         TYPE ekbe-budat,
            menge         TYPE ekbe-menge,
            matnr         TYPE ekbe-matnr,
            ebelp         TYPE j_1iexcdtl-ritem1,
            ebeln         TYPE ekbe-ebeln,
            gjahr         TYPE ekbe-gjahr,
            lfbnr         TYPE ekbe-lfbnr,
            lfpos         TYPE ekbe-lfpos,
            bldat         TYPE ekbe-bldat,
            REEWR         TYPE REEWR,
            END OF wa1_ekbe.
    TYPES :BEGIN OF wa2_ekbe,
            belnr         TYPE ekbe-belnr,
            budat         TYPE ekbe-budat,
            menge         TYPE ekbe-menge,
            ebelp         TYPE ekbe-ebelp,
            ebeln         TYPE ekbe-ebeln,
            gjahr         TYPE ekbe-gjahr,
            lfbnr         TYPE ekbe-lfbnr,
            lfpos         TYPE ekbe-lfpos,
            bldat         TYPE ekbe-bldat,
            REEWR         TYPE REEWR,
            awkey(20)         TYPE c,
            MATNR         TYPE MATNR,
            MWSKZ         TYPE EKBE-MWSKZ,
            END OF wa2_ekbe.
    TYPES :BEGIN OF wa1_j_1iexcdtl,
            exnum         TYPE j_1iexcdtl-exnum,
            exdat         TYPE j_1iexcdtl-exdat,
            lifnr         TYPE j_1iexcdtl-lifnr,
            matnr         TYPE j_1iexcdtl-matnr ,
          maktx         TYPE j_1iexcdtl-maktx ,
          capind      TYPE j_1iexcdtl-capind,
            exbas         TYPE j_1iexcdtl-exbas,
            exbed             TYPE j_1iexcdtl-exbed,
            ecs            TYPE j_1iexcdtl-ecs,
            werks             TYPE j_1iexcdtl-werks,
            ritem1        TYPE j_1iexcdtl-ritem1,
            rdoc1             TYPE j_1iexcdtl-rdoc1,
            docyr         TYPE j_1iexcdtl-docyr,
            bedinv        type J_1IBEDINV,
            ecsinv        type J_1IECSINV,
            EXADDINV1     type J_1IEXADDINV1,
            exaddtax1    TYPE j_1iexcdtl-exaddtax1,
            rdoc2         TYPE j_1iexcdtl-rdoc2,
            ritem2        TYPE j_1iexcdtl-ritem2,
            menge         TYPE j_1iexcdtl-menge,
    ADDED FOR RUDRAPUR ON 08.03.2008 BY ASHOK.CH
    *ENDED ON 08.02.2008
            END OF wa1_j_1iexcdtl.
    TYPES :BEGIN OF wa1_lfa1,
            name1         TYPE lfa1-name1,
            ktokk         TYPE lfa1-ktokk,
            werks         TYPE lfa1-werks,
            lifnr         TYPE lfa1-lifnr,
            END OF wa1_lfa1.
    TYPES :BEGIN OF wa1_ekexclf,
            belnr         TYPE ekbe-belnr,
            budat         TYPE ekbe-budat,
            menge         TYPE ekbe-menge,
            ebelp         TYPE ekbe-ebelp,
            ebeln         TYPE ekbe-ebeln,
            gjahr         TYPE ekbe-gjahr,
            awkey(20)     TYPE c,
            exnum         TYPE j_1iexcdtl-exnum,
            exdat         TYPE j_1iexcdtl-exdat,
            lifnr         TYPE j_1iexcdtl-lifnr,
            matnr         TYPE j_1iexcdtl-matnr ,
          maktx         TYPE j_1iexcdtl-maktx ,
          capind      TYPE j_1iexcdtl-capind,
            exbas         TYPE j_1iexcdtl-exbas,
            exbed             TYPE j_1iexcdtl-exbed,
            ecs            TYPE j_1iexcdtl-ecs,
            werks             TYPE j_1iexcdtl-werks,
            ritem1        TYPE j_1iexcdtl-ritem1,
            rdoc1             TYPE j_1iexcdtl-rdoc1,
            docyr         TYPE j_1iexcdtl-docyr,
            name1         TYPE lfa1-name1,
            ktokk         TYPE lfa1-ktokk,
            exaddtax1     TYPE j_1iexcdtl-exaddtax1,
    added for rudrapur on 08.03.2008 by ASHOK.CH
            bedinv        type J_1IBEDINV,
            ecsinv        type J_1IECSINV,
            EXADDINV1     type J_1IEXADDINV1,
    END OF MODIFICATION ON 08.02.2008
            END OF  wa1_ekexclf.
    TYPES :BEGIN OF wa1_bkpf,
            bukrs TYPE bkpf-bukrs,
            belnr TYPE bkpf-belnr,
            gjahr TYPE bkpf-gjahr,
            budat TYPE bkpf-budat,
            tcode TYPE bkpf-tcode,
            awkey TYPE bkpf-awkey,
            END OF wa1_bkpf.
    TYPES :BEGIN OF wa1_bseg,
            bukrs     TYPE bseg-bukrs,
            belnr     TYPE bseg-belnr,     
            gjahr         TYPE bseg-gjahr,
            buzei     TYPE bseg-buzei,
            bschl     TYPE bseg-bschl,
            fwbas     TYPE bseg-fwbas ,     
            pswbt         TYPE bseg-pswbt,
            hkont         TYPE bseg-hkont,
            wrbtr     TYPE bseg-wrbtr,
            ktosl     TYPE bseg-ktosl,
            koart     TYPE bseg-koart,
            shkzg     TYPE bseg-shkzg,
            mwskz     TYPE bseg-mwskz,
            qsskz     TYPE bsis-qsskz,
            dmbtr     TYPE bseg-dmbtr,
            lifnr     TYPE bseg-lifnr,
            matnr     TYPE bseg-matnr,
            flag      TYPE C,
            flag_21   TYPE C,
            END OF wa1_bseg.
    TYPES :BEGIN OF wa1_tax,
            belnr         TYPE bseg-belnr,
            fi_docno      TYPE bseg-belnr,
            gjahr             TYPE bseg-gjahr,
            bukrs         TYPE bseg-bukrs,
            awkey         TYPE bkpf-awkey,
            fwbas         TYPE bseg-fwbas ,
            cst_amt       TYPE bseg-pswbt,
            vat_amt       TYPE bseg-pswbt,
            shcess_amt    TYPE bseg-pswbt,
            gl_accnt      TYPE bseg-hkont,
            gl_desc       TYPE skat-txt50,
            wctglacc      TYPE bseg-hkont,
            wctamt        TYPE bseg-dmbtr,
            taxcode       TYPE t059z-wt_withcd,
            taxperc       TYPE t059z-qsatz,
            total_value   TYPE bseg-wrbtr,
            set_off       TYPE bseg-wrbtr,
            cond_type     TYPE konv-kschl,
            description(20)   TYPE c,
            service_tax       TYPE bseg-wrbtr,
            service_ecess     TYPE bseg-wrbtr,
            service_shcess     TYPE bseg-wrbtr,      "vincy on 31.01.08
            ebelp         TYPE ekbe-ebelp,           "      on 15.04.08
            flag          TYPE c,
            mwskz     TYPE bseg-mwskz,
            END OF wa1_tax.
    DATA:BEGIN OF itab_skat,
           saknr TYPE skat-saknr,
           spras TYPE skat-spras,
           txt50 TYPE skat-txt50,
           END OF itab_skat.
    DATA: iskat LIKE itab_skat OCCURS 0,
           wa_skat LIKE itab_skat.
    DATA : BEGIN OF zbsis OCCURS 0,
             bukrs TYPE bsis-bukrs,
             hkont TYPE bsis-hkont,
             augdt TYPE bsis-augdt,
             augbl TYPE bsis-augbl,
             zuonr TYPE bsis-zuonr,
             gjahr TYPE bsis-gjahr,
             belnr TYPE bsis-belnr,
             buzei TYPE bsis-buzei,
             budat TYPE bsis-budat,
             qsskz TYPE bsis-qsskz,
            END OF zbsis.
    DATA: BEGIN OF zt059z OCCURS 0,
           land1 TYPE t059z-land1,
           witht TYPE t059z-witht,
           wt_withcd TYPE t059z-wt_withcd,
           qscod TYPE t059z-qscod,
           qsatz TYPE t059z-qsatz,
           hkont TYPE bsis-hkont,
           belnr TYPE bsis-belnr,
           END OF zt059z.
    DATA: BEGIN OF it_faglflexa OCCURS 0,      "added by vincy
          ryear TYPE faglflexa-ryear,
          docnr TYPE faglflexa-docnr,
          rldnr TYPE faglflexa-rldnr,
          rbukrs TYPE faglflexa-rbukrs,
          docln TYPE faglflexa-docln,
          prctr TYPE faglflexa-prctr,
          END OF it_faglflexa.
    Final Table***
    TYPES :BEGIN OF wa1_final,
             belnr         TYPE ekbe-belnr,
             fi_docno      TYPE bseg-belnr,
             budat         TYPE ekbe-budat,
             menge         TYPE ekbe-menge,
             rate          TYPE konv-kbetr,
             ebelp         TYPE ekbe-ebelp,
             ebeln         TYPE ekbe-ebeln,
             mwskz         TYPE bseg-mwskz,
             gjahr         TYPE ekbe-gjahr,
             awkey(20)     TYPE c,
             exnum         TYPE j_1iexcdtl-exnum,
             exdat         TYPE j_1iexcdtl-exdat,
             lifnr         TYPE j_1iexcdtl-lifnr,
             matnr         TYPE j_1iexcdtl-matnr ,
           maktx         TYPE j_1iexcdtl-maktx ,
             capind       TYPE string,
             exbas         TYPE j_1iexcdtl-exbas,
             exbed       TYPE j_1iexcdtl-exbed,
             ecs             TYPE j_1iexcdtl-ecs,
             werks       TYPE j_1iexcdtl-werks,
             ritem1        TYPE j_1iexcdtl-ritem1,
             rdoc1       TYPE j_1iexcdtl-rdoc1,
             docyr         TYPE j_1iexcdtl-docyr,
             name1         TYPE lfa1-name1,
             ktokk         TYPE lfa1-ktokk,
             fwbas         TYPE bseg-fwbas ,
             vat_per       TYPE konv-kbetr,
             vat_amt       TYPE bseg-pswbt,
             cst_per       TYPE konv-kbetr,
             cst_amt       TYPE bseg-pswbt,
             shcess_amt    TYPE bseg-pswbt,
             gl_accnt      TYPE bseg-hkont,
             gl_desc       TYPE skat-txt50,
             wctglacc      TYPE bseg-hkont,
             wctamt        TYPE bseg-dmbtr,
             taxcode       TYPE t059z-wt_withcd,
             taxperc       TYPE t059z-qsatz,
             total_value   TYPE bseg-wrbtr,
             total_value1 TYPE bseg-wrbtr,
             excise_tax    TYPE bseg-wrbtr,
             excise  TYPE bseg-wrbtr,
             set_off       TYPE bseg-wrbtr,
             inventorised  TYPE konv-kawrt,
             cond_type     TYPE konv-kschl,
             cond_type2    TYPE konv-kschl,
             description(20)   TYPE c,
             service_tax       TYPE bseg-wrbtr,
             service_ecess     TYPE bseg-wrbtr,
             service_shcess    TYPE bseg-wrbtr,            "vincy on 31.01.08
            END OF wa1_final.
    DATA :it2_ekbe        TYPE TABLE OF wa1_ekbe WITH HEADER LINE,
           it_ekbe        TYPE TABLE OF wa1_ekbe WITH HEADER LINE,
           it1_ekbe       TYPE TABLE OF wa2_ekbe WITH HEADER LINE WITH KEY ebelp ebeln,
           it_j_1iexcdtl  TYPE TABLE OF wa1_j_1iexcdtl WITH HEADER LINE WITH KEY rdoc1 ritem1,
           it_lfa1        TYPE TABLE OF wa1_lfa1 WITH HEADER LINE WITH KEY lifnr,
           it_lfa2        TYPE TABLE OF wa1_lfa1 WITH HEADER LINE WITH KEY lifnr,
           it_bkpf        TYPE TABLE OF wa1_bkpf WITH HEADER LINE,
           it_bseg        TYPE TABLE OF wa1_bseg WITH HEADER LINE WITH  KEY
                                        bukrs belnr gjahr ktosl shkzg koart,
           it1_bseg        TYPE TABLE OF wa1_bseg WITH HEADER LINE WITH  KEY
                                        bukrs belnr gjahr ktosl shkzg koart,
           it_tax         TYPE TABLE OF wa1_tax WITH HEADER LINE WITH KEY awkey ,
           it_ekexclf     TYPE TABLE OF wa1_ekexclf WITH HEADER LINE,
           it_final       TYPE TABLE OF wa1_final WITH HEADER LINE,
           it_final1      TYPE TABLE OF wa1_final WITH HEADER LINE,         "vincy
           wa_ekbe       TYPE wa1_ekbe,
           wa1_ekbe      TYPE wa2_ekbe,
           wa_j_1iexcdtl TYPE wa1_j_1iexcdtl,
           wa_lfa1       TYPE wa1_lfa1,
           wa_lfa2       TYPE wa1_lfa1,
           wa_bkpf       TYPE wa1_bkpf,
           wa_bseg       TYPE wa1_bseg,
           wa_tax        TYPE wa1_tax,
           wa_ekexclf    TYPE wa1_ekexclf,
           PLANT TYPE WERKS_D,
           wa_final      TYPE wa1_final.
    DATA: it_konv TYPE konv OCCURS 0 WITH HEADER LINE ,
           wa_konv TYPE konv,
           invent TYPE p DECIMALS 4,
           invent1 TYPE konv-kawrt.
    DATA:d1 TYPE konv-kposn,
          d2 TYPE ekbe-ebelp.
    DATA: v_belnr TYPE ekbe-belnr,
           v_gjahr TYPE ekbe-gjahr,
           v_awkey(20) TYPE c,
           idx TYPE sy-tabix.
    **********by vincy on 12.01.07***********
    DATA: BEGIN  OF it_ekko OCCURS 0,
           ebeln LIKE ekko-ebeln,
           bukrs LIKE ekko-bukrs,
           bsart LIKE ekko-bsart,
           lifnr LIKE ekko-lifnr,
           belnr LIKE ekbe-belnr,
           END OF it_ekko.
    DATA: BEGIN  OF it_ekpo OCCURS 0,
           ebeln LIKE ekpo-ebeln,
           ebelp LIKE ekpo-ebelp,
           txz01 LIKE ekpo-txz01,
           END OF it_ekpo.
    DATA: BEGIN  OF it_lfa1v OCCURS 0,
           lifnr LIKE lfa1-lifnr,
           name1 LIKE lfa1-name1,
           END OF it_lfa1v.
    DATA: BEGIN  OF s_prctr OCCURS 0,
           low LIKE faglflexa-prctr,
           END OF s_prctr.
    DATA: it_bsegv TYPE TABLE OF wa1_bseg WITH HEADER LINE.
    DATA: it_konv1 LIKE konv OCCURS 0 WITH HEADER LINE.
    DATA:cnt TYPE i,
          awkey1(250).
    DATA: LIFNR TYPE LIFNR,
          NAME TYPE NAME1_GP,
          MTART TYPE MARA-MTART,
          MAKTX TYPE MAKTX,
          TAX_TOT TYPE KWERT.
    ***********end of changes by vincy ************
    Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_werks1 FOR ekbe-werks,
                     s_budat1 FOR ekbe-budat,
                     s_fiscal FOR  ekbe-gjahr,
                     s_lifnr FOR lfa1-lifnr.
    SELECTION-SCREEN END OF BLOCK b1.
    **"changes being by nahid on 16.04.2008
    PARAMETERS : excel AS CHECKBOX DEFAULT 'X'.
    PARAMETERS: infile LIKE rlgrap-filename.
    DATA : zfile TYPE string.
    **"changes ended by nahid on 16.04.2008
    AT SELECTION-SCREEN.
       IF s_werks1 IS INITIAL.
         MESSAGE 'Please Enter Plant details' TYPE 'E'.
       ENDIF.
       IF s_budat1 IS INITIAL.
         MESSAGE 'Please Enter Posting date' TYPE 'E'.
       ENDIF.
       IF s_fiscal IS INITIAL.
         MESSAGE 'Please Enter Fiscal Year' TYPE 'E'.
       ENDIF.
    *start change by nahid on 16.4.08
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR infile.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        CHANGING
          file_name     = infile
        EXCEPTIONS
          mask_too_long = 1
          OTHERS        = 2.
    zfile = infile.
    *end change by nahid on 16.4.08
    START-OF-SELECTION.
    plant = s_werks1-low.
    MODIFIED FOR RUDRAPUR BY ASHOK.CH ON 13.03.2008
    IF PLANT NE 'RD01'.
       PERFORM get_data.
       PERFORM get_zpsr.                        "vincy
    ENDIF.
    IF PLANT EQ 'RD01'.
        PERFORM get_data1.
    ENDIF.
    *END OF MODIFICATION ON 13.03.2008
       PERFORM build_fieldcatalog.
       PERFORM build_layout.
       PERFORM display_alv_report.
    *start chng by nahid on 16.4.08
    IF excel = 'X'.
        IF NOT infile IS INITIAL.
          PERFORM excel_data.
        ELSE.
          MESSAGE e000(0) WITH 'Please Enter the File Path'.
        ENDIF.
      ENDIF.
    *end by nahid on 16.4.08
    *&      Form  get_data
    FORM get_data .
       SELECT belnr budat menge matnr ebelp ebeln gjahr lfbnr lfpos bldat  REEWR FROM ekbe INTO
       TABLE it_ekbe
       WHERE werks IN s_werks1 AND
            (bewtp EQ 'Q' OR bewtp EQ 'N')     AND
             bewtp IN ('Q' , 'N') AND                 "added N  by vincy on 6.07.2008
             budat IN s_budat1 AND
             gjahr IN s_fiscal .
       IF sy-subrc = 0.               "for 1st ekbe
         IF it_ekbe[] IS NOT INITIAL.
         SELECT exnum exdat lifnr matnr maktx capind exbas exbed ecs werks
         ritem1 rdoc1 docyr bedinv ecsinv EXADDINV1 exaddtax1  rdoc2 ritem2 menge
                FROM j_1iexcdtl INTO TABLE it_j_1iexcdtl FOR ALL ENTRIES IN it_ekbe
                WHERE rdoc1  = it_ekbe-ebeln
                AND ritem1 =  it_ekbe-ebelp AND
                lifnr IN s_lifnr.
         ENDIF.
           IF it_j_1iexcdtl[] IS NOT INITIAL.
           SELECT name1 ktokk werks lifnr FROM lfa1 INTO
                            TABLE it_lfa1 FOR ALL ENTRIES IN it_j_1iexcdtl
                             WHERE lifnr = it_j_1iexcdtl-lifnr.
          ENDIF.
           LOOP AT it_ekbe INTO wa_ekbe.
             wa1_ekbe-belnr        = wa_ekbe-belnr.
             wa1_ekbe-budat        = wa_ekbe-budat.
             wa1_ekbe-menge        = wa_ekbe-menge.
             wa1_ekbe-ebelp        = wa_ekbe-ebelp.
             wa1_ekbe-ebeln        = wa_ekbe-ebeln.
             wa1_ekbe-gjahr        = wa_ekbe-gjahr.
             wa1_ekbe-matnr        = wa_ekbe-matnr.
             wa1_ekbe-lfbnr        = wa_ekbe-lfbnr.
             wa1_ekbe-lfpos        = wa_ekbe-lfpos.
             wa1_ekbe-bldat        = wa_ekbe-bldat.
             v_belnr = wa_ekbe-belnr.
             v_gjahr = wa_ekbe-gjahr.
             CONCATENATE v_belnr v_gjahr INTO v_awkey.
             wa1_ekbe-awkey        = v_awkey.
             APPEND wa1_ekbe TO it1_ekbe.
             CLEAR :wa_ekbe.
           ENDLOOP.
    ************changes by vincy on 29.05.08 for 'FB08' and 'FB60'**************
           LOOP AT s_werks1.
             IF s_werks1-low = 'KN01'.
                s_prctr-low  = 'MUKNHSTM'.
             ELSEIF
              s_werks1-low = 'NS01'.
                s_prctr-low  = 'MUNSKSTM'.
             ELSEIF
              s_werks1-low = 'RD01'.
                s_prctr-low  = 'MURDPSTM'.
             ENDIF.
             APPEND s_prctr.
           ENDLOOP.
           SELECT bukrs belnr gjahr budat tcode awkey FROM bkpf INTO TABLE it_bkpf
                          WHERE bukrs = 'MU51'    AND
                          gjahr IN s_fiscal       AND
                          budat IN s_budat1       AND
                          ( tcode = 'FB60' OR  tcode = 'FB08' ).
          IF it_bkpf[] IS NOT INITIAL.
          SELECT ryear docnr rldnr rbukrs docln prctr FROM faglflexa INTO TABLE it_faglflexa
          FOR ALL ENTRIES IN it_bkpf WHERE rbukrs = 'MU51'   AND
                                           ryear  = it_bkpf-gjahr AND
                                           docnr  = it_bkpf-belnr.
          ENDIF.
          LOOP AT it_faglflexa.
            READ TABLE s_prctr WITH KEY low = it_faglflexa-prctr.
            IF sy-subrc <> 0.
            DELETE it_faglflexa.
            ENDIF.
            CLEAR: it_faglflexa, s_prctr.
          ENDLOOP.
    **************************end of change*************************************
           IF it1_ekbe[] IS NOT INITIAL.
           SELECT bukrs belnr gjahr budat tcode awkey FROM bkpf APPENDING
           TABLE it_bkpf FOR ALL ENTRIES IN it1_ekbe
                          WHERE bukrs = 'MU51'    AND
                          gjahr IN s_fiscal AND
                          awkey = it1_ekbe-awkey.
           ENDIF.
           IF sy-subrc = 0.       "bkpf
             IF it_bkpf[] IS NOT INITIAL.
             SELECT bukrs belnr gjahr buzei bschl fwbas pswbt hkont wrbtr  ktosl koart shkzg mwskz qsskz dmbtr lifnr matnr
                          FROM bseg INTO TABLE it1_bseg FOR ALL ENTRIES IN it_bkpf
                           WHERE belnr = it_bkpf-belnr AND
                                 gjahr = it_bkpf-gjahr AND
                                 bukrs = it_bkpf-bukrs AND
                                 ( bschl = '21' ) AND
                                 lifnr IN s_lifnr.                      "added 21 for miro cancelation
              IF it1_bseg[] IS NOT INITIAL.
              SELECT bukrs belnr gjahr buzei bschl fwbas pswbt hkont wrbtr  ktosl koart shkzg mwskz qsskz dmbtr lifnr matnr
                          FROM bseg INTO TABLE it_bseg FOR ALL ENTRIES IN it1_bseg
                           WHERE belnr = it1_bseg-belnr AND
                                 gjahr = it1_bseg-gjahr AND                    "changed it_bkpf to it1_bseg
                                 bukrs = it1_bseg-bukrs .
              LOOP AT it_bseg.
              it_bseg-wrbtr = it_bseg-wrbtr * -1.
              it_bseg-fwbas = it_bseg-fwbas * -1.
              it_bseg-pswbt = it_bseg-pswbt * -1.
              it_bseg-flag_21 = 'X'.
              MODIFY it_bseg.
              CLEAR it_bseg.
              ENDLOOP.
             SELECT name1 ktokk werks lifnr FROM lfa1 INTO
             TABLE it_lfa2 FOR ALL ENTRIES IN it1_bseg
                          WHERE lifnr = it1_bseg-lifnr.
             ENDIF.
             REFRESH it1_bseg.
             SELECT bukrs belnr gjahr buzei bschl fwbas pswbt hkont wrbtr  ktosl koart shkzg mwskz qsskz dmbtr lifnr matnr
                          FROM bseg INTO TABLE it1_bseg FOR ALL ENTRIES IN it_bkpf
                           WHERE belnr = it_bkpf-belnr AND
                                 gjahr = it_bkpf-gjahr AND
                                 bukrs = it_bkpf-bukrs AND
                                 ( bschl = '31' ) AND                      "added bschl and lifnr by vincy
                                 lifnr IN s_lifnr.
             IF it1_bseg[] IS NOT INITIAL.
             SELECT name1 ktokk werks lifnr FROM lfa1 APPENDING
             TABLE it_lfa2 FOR ALL ENTRIES IN it1_bseg
                          WHERE lifnr = it1_bseg-lifnr.
             SELECT bukrs belnr gjahr buzei bschl fwbas pswbt hkont wrbtr  ktosl koart shkzg mwskz qsskz dmbtr lifnr matnr
                          FROM bseg APPENDING TABLE it_bseg FOR ALL ENTRIES IN it1_bseg
                           WHERE belnr = it1_bseg-belnr AND
                                 gjahr = it1_bseg-gjahr AND                    "changed it_bkpf to it1_bseg
                                 bukrs = it1_bseg-bukrs AND
                                 bschl <> '35'.                                "added bschl to avoid vendor paymnt
            ENDIF.
            SELECT bukrs belnr gjahr buzei bschl fwbas pswbt hkont wrbtr  ktosl koart shkzg  mwskz qsskz dmbtr lifnr
                          FROM bseg APPENDING CORRESPONDING FIELDS OF TABLE it_bseg
                          FOR ALL ENTRIES IN it_bkpf
                          WHERE belnr = it_bkpf-belnr AND
                          gjahr = it_bkpf-gjahr AND
                          lifnr IN s_lifnr AND
                          bukrs = it_bkpf-bukrs AND qsskz IN ('WI', 'WJ').
            ENDIF.
          ENDIF.
           SORT it_bseg BY belnr buzei.
           IF NOT it_bseg[] IS INITIAL.
             SELECT saknr spras txt50 FROM skat
                              INTO TABLE iskat
                              FOR ALL ENTRIES IN it_bseg
                              WHERE saknr = it_bseg-hkont AND spras = 'EN'.
             SELECT  bukrs hkont augdt augbl zuonr gjahr belnr buzei budat qsskz FROM bsis
                               INTO TABLE zbsis
                               FOR ALL ENTRIES IN it_bseg
                               WHERE bukrs = 'MU51' AND hkont = it_bseg-hkont
                               AND belnr = it_bseg-belnr AND gjahr = s_fiscal
                               AND budat IN s_budat1.
           ENDIF.
           LOOP AT it_bseg.
             READ TABLE zbsis WITH KEY hkont = it_bseg-hkont.
             IF sy-subrc = 0.
               it_bseg-qsskz = zbsis-qsskz.
               MODIFY it_bseg.
             ENDIF.
             CLEAR: it_bseg,zbsis.
           ENDLOOP.
           LOOP AT zt059z.
             LOOP AT it_bseg WHERE qsskz = zt059z-wt_withcd.
               zt059z-hkont = it_bseg-hkont.
               zt059z-belnr = it_bseg-belnr.
               MODIFY zt059z.
               CLEAR: it_bseg,zt059z.
             ENDLOOP.
           ENDLOOP.
           CLEAR: wa_bkpf.
    *******Filling Wa.
          LOOP AT it_bkpf INTO wa_bkpf.                     "changes by vincy on 14.04.2008
            LOOP AT it1_ekbe INTO wa1_ekbe .
            READ TABLE it_bkpf INTO wa_bkpf
            WITH KEY awkey = wa1_ekbe-awkey.
             wa_tax-belnr     =    wa_bkpf-belnr.
             wa_tax-gjahr     =    wa_bkpf-gjahr.     
             wa_tax-bukrs     =    wa_bkpf-bukrs.
             wa_tax-awkey     =    wa_bkpf-awkey.
             wa_tax-ebelp     =    wa1_ekbe-ebelp.
             CLEAR: wa_bseg,wa_skat.
             READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
                                         belnr = wa_bkpf-belnr
                                         gjahr = wa_bkpf-gjahr  INTO wa_bseg.
             IF sy-subrc = 0.
               wa_tax-fi_docno  =    wa_bseg-belnr.
               wa_tax-mwskz     =    wa_bseg-mwskz.
             CLEAR: wa_bseg.
             READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
                                           belnr = wa_bkpf-belnr
                                           gjahr = wa_bkpf-gjahr
                                           flag = ''
                                           ktosl = 'JP4' INTO wa_bseg.
             IF sy-subrc = 0.
               wa_bseg-flag = 'X'.
               MODIFY it_bseg INDEX sy-tabix FROM wa_bseg.
               wa_tax-gl_accnt    =  wa_bseg-hkont.
               READ TABLE iskat INTO wa_skat WITH KEY saknr = wa_bseg-hkont.
               IF sy-subrc = 0.
                 wa_tax-gl_desc = wa_skat-txt50.
               ENDIF.
               wa_tax-set_off     =  wa_bseg-wrbtr.
               wa_tax-fwbas       =  wa_bseg-fwbas.
               wa_tax-cst_amt     =  wa_bseg-pswbt.
               wa_tax-description = 'CST CG Sett off'.
               wa_tax-cond_type   =  'JVCS'.
             ENDIF.
             READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
                                           belnr = wa_bkpf-belnr
                                           gjahr = wa_bkpf-gjahr
                                           flag = ''
                                           ktosl = 'VS1' INTO wa_bseg.
             IF sy-subrc = 0.
               wa_bseg-flag = 'X'.
               MODIFY it_bseg INDEX sy-tabix FROM wa_bseg.
               wa_tax-fwbas       =  wa_bseg-fwbas.
             ENDIF.
             READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
                                            belnr = wa_bkpf-belnr
                                            gjahr = wa_bkpf-gjahr
                                            flag = ''
                                            ktosl = 'JP7' INTO wa_bseg.
             IF sy-subrc = 0.
               wa_bseg-flag = 'X'.
               MODIFY it_bseg INDEX sy-tabix FROM wa_bseg.
               wa_tax-gl_accnt    =  wa_bseg-hkont.
               READ TABLE iskat INTO wa_skat WITH KEY saknr = wa_bseg-hkont.
               IF sy-subrc = 0.
                 wa_tax-gl_desc = wa_skat-txt50.
               ENDIF.
               wa_tax-set_off     =  wa_bseg-wrbtr.
               wa_tax-fwbas       =  wa_bseg-fwbas.
               wa_tax-vat_amt     =  wa_bseg-pswbt.
               wa_tax-description = 'VAT CG Sett off'.
               wa_tax-cond_type   =  'JVCD'.
             ENDIF.
             CLEAR wa_bseg.
            READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
                                       belnr = wa_bkpf-belnr
                                       gjahr = wa_bkpf-gjahr
                                       flag = ''
                                       ktosl = 'JP5' INTO wa_bseg.
              READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
                                        belnr = wa_bkpf-belnr
                                        gjahr = wa_bkpf-gjahr
                                        hkont = '0002868001' INTO     wa_bseg.       "vat changed for V0 tax code
             IF sy-subrc = 0.
               wa_bseg-flag = 'X'.
               MODIFY it_bseg INDEX sy-tabix FROM wa_bseg.
               wa_tax-gl_accnt  =  wa_bseg-hkont.
               READ TABLE iskat INTO wa_skat WITH KEY saknr = wa_bseg-hkont.
               IF sy-subrc = 0.
                 wa_tax-gl_desc = wa_skat-txt50.
               ENDIF.
               wa_tax-vat_amt   =  wa_bseg-pswbt.
               wa_tax-set_off   =  wa_bseg-wrbtr.
               wa_tax-cond_type =  'JVRD'.
               wa_tax-fwbas     =  wa_bseg-fwbas.
               wa_tax-description        = 'VAT RM Set off'.
             ENDIF.
             CLEAR: wa_bseg,wa_skat.
             READ TABLE it_bseg WITH KEY     bukrs = wa_bkpf-bukrs
                                             belnr = wa_bkpf-belnr
                                             gjahr = wa_bkpf-gjahr
                                             shkzg = 'H'
                                             koart = 'K'
                                             INTO     wa_bseg.
             IF sy-subrc = 0.
               wa_tax-total_value =  wa_bseg-wrbtr.
             ENDIF.
          START OF MODIFICATION BY ASHOK.CH ON 08.02.2008
            service_tax
             CLEAR wa_bseg.
             READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
                                        belnr = wa_bkpf-belnr
                                        gjahr = wa_bkpf-gjahr
                                        flag = ''
                                        ktosl = 'VS8'  INTO     wa_bseg.
             IF sy-subrc = 0.
               wa_bseg-flag = 'X'.
               MODIFY it_bseg INDEX sy-tabix FROM wa_bseg.
               wa_tax-gl_accnt  =    wa_bseg-hkont.
               READ TABLE iskat INTO wa_skat WITH KEY saknr = wa_bseg-hkont.
               IF sy-subrc = 0.
                 wa_tax-gl_desc = wa_skat-txt50.
               ENDIF.
               wa_tax-service_tax =  wa_bseg-wrbtr.
               wa_tax-description = 'Service Tax'.
               wa_tax-cond_type =  'JSRT'.
             ENDIF.
         service_ecess
             CLEAR: wa_bseg,wa_skat.
             READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
                                        belnr = wa_bkpf-belnr
                                        gjahr = wa_bkpf-gjahr
                                        flag = ''
                                        ktosl = 'VS9'  INTO  wa_bseg.
             IF sy-subrc = 0.
               wa_bseg-flag = 'X'.
               MODIFY it_bseg INDEX sy-tabix FROM wa_bseg.
               wa_tax-service_ecess =  wa_bseg-wrbtr.
             ENDIF.
    **********changes by vincy on 31.01.08*********************
        service_shcess
             CLEAR: wa_bseg.
             READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
                                        belnr = wa_bkpf-belnr
                                        gjahr = wa_bkpf-gjahr
                                        flag = ''
                                        ktosl = 'VSE'  INTO  wa_bseg.
             IF sy-subrc = 0.
               wa_bseg-flag = 'X'.
               MODIFY it_bseg INDEX sy-tabix FROM wa_bseg.
               wa_tax-service_shcess =  wa_bseg-wrbtr.
             ENDIF.
    *************************end of changes***********************
    END OF MODIFICATION ON 08.02.2008
             APPEND wa_tax TO it_tax.
             ENDIF.
             CLEAR :wa_tax,wa_bseg,wa_bkpf,wa_skat.
           ENDLOOP.
           CLEAR wa1_ekbe.
           LOOP AT it1_ekbe INTO wa1_ekbe.
            READ TABLE it_j_1iexcdtl INTO wa_j_1iexcdtl
                                    WITH KEY  rdoc1  = wa1_ekbe-ebeln
                                    ritem1 = wa1_ekbe-ebelp.
    *New query added by Nilesh
            READ TABLE it_j_1iexcdtl INTO wa_j_1iexcdtl
                                    WITH KEY  rdoc1  = wa1_ekbe-lfbnr
                                    ritem2 = wa1_ekbe-lfpos.
             READ TABLE it_bkpf INTO wa_bkpf
             WITH KEY awkey = wa1_ekbe-awkey.
             IF sy-subrc = 0.
             READ TABLE it_bseg WITH KEY bukrs = wa_bkpf-bukrs
                                        belnr = wa_bkpf-belnr
                                        gjahr = wa_bkpf-gjahr.
              IF sy-subrc = 0.
               wa_ekexclf-belnr  =       wa1_ekbe-belnr.
               wa_ekexclf-budat  =       wa1_ekbe-budat.
               wa_ekexclf-menge  =       wa1_ekbe-menge.
               wa_ekexclf-ebelp  =       wa1_ekbe-ebelp.
               wa_ekexclf-ebeln  =       wa1_ekbe-ebeln.
               wa_ekexclf-gjahr  =       wa1_ekbe-gjahr.
               wa_ekexclf-awkey  =       wa1_ekbe-awkey.
               wa_ekexclf-lifnr  =       it_bseg-lifnr.
               wa_ekexclf-matnr  =       it_bseg-matnr .
            READ TABLE it_j_1iexcdtl INTO wa_j_1iexcdtl                 "for records for which either rdoc1 or matnr
                                    WITH KEY  rdoc2  = wa1_ekbe-lfbnr   "not maintained in ekbe by vincy on 16.06.08
                                              menge  = wa1_ekbe-menge.
            IF sy-subrc <> 0 .
            READ TABLE it_j_1iexcdtl INTO wa_j_1iexcdtl
                                    WITH KEY  rdoc1  = wa1_ekbe-ebeln
                                              exdat  = wa1_ekbe-bldat
                                              matnr  = wa1_ekbe-matnr
                                              menge  = wa1_ekbe-menge.
            ENDIF.
             READ TABLE it_j_1iexcdtl INTO wa_j_1iexcdtl
                                     WITH KEY  rdoc1  = wa1_ekbe-ebeln
                                               ritem1 = wa1_ekbe-ebelp.
             IF sy-subrc = 0.
              wa_ekexclf-belnr  =       wa1_ekbe-belnr.
              wa_ekexclf-budat  =       wa1_ekbe-budat.
              wa_ekexclf-menge  =       wa1_ekbe-menge.
              wa_ekexclf-ebelp  =       wa1_ekbe-ebelp.
              wa_ekexclf-ebeln  =       wa1_ekbe-ebeln.
              wa_ekexclf-gjahr  =       wa1_ekbe-gjahr.
              wa_ekexclf-awkey  =       wa1_ekbe-awkey.
               wa_ekexclf-exnum  =       wa_j_1iexcdtl-exnum.
               wa_ekexclf-exdat  =       wa_j_1iexcdtl-exdat.
               wa_ekexclf-lifnr  =       wa_j_1iexcdtl-lifnr.
               wa_ekexclf-matnr  =       wa_j_1iexcdtl-matnr .
               wa_ekexclf-maktx  =       wa_j_1iexcdtl-maktx .
               wa_ekexclf-capind =        wa_j_1iexcdtl-capind.
               wa_ekexclf-exbas  =        wa_j_1iexcdtl-exbas.
              wa_ekexclf-exbed  =        wa_j_1iexcdtl-exbed.
              wa_ekexclf-ecs    =        wa_j_1iexcdtl-ecs.
               wa_ekexclf-werks  =        wa_j_1iexcdtl-werks.
               wa_ekexclf-ritem1 =       wa_j_1iexcdtl-ritem1.
               wa_ekexclf-rdoc1  =         wa_j_1iexcdtl-rdoc1.
               wa_ekexclf-docyr  =       wa_j_1iexcdtl-docyr.
              wa_ekexclf-exaddtax1  = wa_j_1iexcdtl-exaddtax1.
               IF it_bseg-flag_21 = 'X'.
               wa_ekexclf-exbas  = wa_ekexclf-exbas * -1.
               ENDIF.
    MODIFIED BY ASHOK.CH ON 08.03.2008
          IF wa_j_1iexcdtl-WERKS NE 'RD01' .
               wa_ekexclf-exbed  =        wa_j_1iexcdtl-exbed.
               wa_ekexclf-ecs    =        wa_j_1iexcdtl-ecs.
               wa_ekexclf-exaddtax1  = wa_j_1iexcdtl-exaddtax1.
               IF it_bseg-flag_21 = 'X'.
                 wa_ekexclf-exbed  =        wa_ekexclf-exbed * -1.
                 wa_ekexclf-ecs    =        wa_ekexclf-ecs * -1.
                 wa_ekexclf-exaddtax1  = wa_ekexclf-exaddtax1 * -1.
               ENDIF.
         ELSE.
               wa_ekexclf-exbed  =        wa_j_1iexcdtl-BEDINV.
               wa_ekexclf-ecs    =        wa_j_1iexcdtl-ecsINV.
               wa_ekexclf-exaddtax1  = wa_j_1iexcdtl-exaddINV1.
         ENDIF.
    END IF MODIFICATION ON 08.03.2008
              APPEND wa_ekexclf TO it_ekexclf.
              CLEAR :wa_lfa1,wa_j_1iexcdtl,wa1_ekbe.
             ENDIF.
               READ TABLE it_lfa2 INTO wa_lfa2
               WITH KEY lifnr = wa_ekexclf-lifnr.
               IF sy-subrc = 0.
                 wa_ekexclf-name1  =        wa_lfa2-name1.
                 wa_ekexclf-ktokk  =        wa_lfa2-ktokk.
               ENDIF.
               APPEND wa_ekexclf TO it_ekexclf.
             ENDIF.
             ENDIF.
               CLEAR :wa_lfa1,wa_j_1iexcdtl,wa1_ekbe,wa_lfa2,wa_ekexclf.
           ENDLOOP.
           CLEAR wa_ekexclf.
           LOOP AT it_ekexclf INTO wa_ekexclf.
             wa_final-belnr     =       wa_ekexclf-belnr.
             wa_final-budat     =       wa_ekexclf-budat.
             wa_final-menge     =       wa_ekexclf-menge.
             wa_final-ebelp     =       wa_ekexclf-ebelp.
             wa_final-ebeln     =       wa_ekexclf-ebeln.
             wa_final-gjahr     =       wa_ekexclf-gjahr.
             wa_final-awkey     =       wa_ekexclf-awkey.
             wa_final-exnum     =       wa_ekexclf-exnum.
             wa_final-exdat     =       wa_ekexclf-exdat.
             wa_final-lifnr     =       wa_ekexclf-lifnr.
             wa_final-matnr     =       wa_ekexclf-matnr .
             wa_final-maktx     =       wa_ekexclf-maktx .
             wa_final-shcess_amt = wa_ekexclf-exaddtax1.
             IF  wa_ekexclf-capind = 'C'.
               wa_final-capind    =  'Consumables'.
             ENDIF.
             IF  wa_ekexclf-capind = 'A'.
               wa_final-capind    =  'Assets'.
             ENDIF.
             IF  wa_ekexclf-capind = 'T'.
               wa_final-capind    =   'Tools'.
             ENDIF.
             IF  wa_ekexclf-capind = ''.
               wa_final-capind    =   'Raw Material'.
             ENDIF.
             IF  wa_ekexclf-capind = 'N'.
               wa_final-capind    =  'Non Cenvatable'.
             ENDIF.
             IF  wa_ekexclf-capind NE 'C' AND wa_ekexclf-capind NE 'A' AND
                 wa_ekexclf-capind NE '' AND wa_ekexclf-capind NE 'N'.
               wa_final-capind    = wa_ekexclf-capind.
             ENDIF.
             wa_final-exbas     =       wa_ekexclf-exbas.
             wa_final-exbed     =       wa_ekexclf-exbed.
             wa_final-ecs       =       wa_ekexclf-ecs.
             wa_final-werks     =       wa_ekexclf-werks.
             wa_final-ritem1    =       wa_ekexclf-ritem1.
             wa_final-rdoc1     =       wa_ekexclf-rdoc1.
             wa_final-docyr     =       wa_ekexclf-docyr.
             wa_final-name1     =       wa_ekexclf-name1.
             wa_final-ktokk     =       wa_ekexclf-ktokk.
             wa_final-excise    =       wa_final-exbas + wa_final-exbed + wa_final-ecs + wa_final-shcess_amt.
             CLEAR :wa_tax.

    Hi ,
    I think you are using the redundant selects to fetch the data from BSEG.
    First select all the data into an internal table based on  bkpf.
    Now you can distribute the data into whatever tables you want using the loop,read-binary search and append statements..
    Loop at it_bseg.
    read it_bseg where
                        xxxxx
                        xxxxx
                        binary search.
    append wa to it2_bseg.
    endloop              
    This avoid several database fetches..
    Thank you..

  • Extract function not working with tag attributes

    Hi all,
    I have an xml document stored in the db as an xmlType. I am trying to use the extract function to retrieve values. The extract will work fine on tags without attributes. Any tags with attributes or tags beyond the tags with attributes will not be accessible.
    <tag1>
    <tag2>hi</tag2>
    <tag3 att="hello">bye</tag3>
    <tag4> hi again </tag4>
    </tag1>
    In the example above I can extract tag2 values but not tag3 or tag4 values.
    here is my select statement
    works
    select e.xmlval.extract('/tag1/tag2').getStringval()
    from test_xml e;
    does not work
    select e.xmlval.extract('/tag1/tag2/tag3').getStringval()
    from test_xml e;
    does not work
    select e.xmlval.extract('/tag1/tag2/tag3/tag4').getStringval()
    from test_xml e;
    Any ideas?

    Hi all,
    Found the issue. The problem was that I was not specifying the second argument to the extract function.
    The tag attribute that I was not handling was xmlns="".
    I used this atttribute as the second argument in the extract function and now I am off and running.
    Hope this helps someone.
    Cheers

  • Oracle.xdb.XMLType extract function

    I have an external java program that connect to the database using a thick connection so I can use the methods extract and existsNode available with the XMLType from oracle.xdb.XMLType.
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    conn = DriverManager.getConnection(jdbc:oracle:oci8:@,"user","pwd");
    It works fine from the program. When I load the java function in the SQL database I use the default connection
    conn = DriverManager.getConnection("jdbc:default:connection:");
    and the extract function gives the error java.sql.SQLException.
    Is there a way to define the native connection as thin or thick because that was the error I was getting from the client program when I was using thin connection
    Thanks
    Mirette

    Please try and avoid duplicate posts...

  • How to assign to variable from XML type values with extract function?

    Hi ,
    I have XMLTYPE variable LeXml having below record
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <AddListing xmlns="http://www.christielites.com/">
    <sComCode>string</sComCode>
    <sLocCode>string</sLocCode>
    <dStart>dateTime</dStart>
    <dEnd>dateTime</dEnd>
    <sEcode>string</sEcode>
    <iAvail>int</iAvail>
    <iOwned>int</iOwned>
    <sPostTrans>string</sPostTrans>
    </AddListing>
    </soap:Body>
    </soap:Envelope>
    I want to get sEcode value string into one varialbe using extract function or alternate?
    can any one give me syntax fro it?
    I tried with Mstring:=LeXml.extract('AddListing/scomcode/text()').getStringval(); but iam getting error
    ERROR at line 1:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00601: Invalid token in: 'soap:Envelope/text()'
    ORA-06512: at "SYS.XMLTYPE", line 111
    ORA-06512: at "BLUEWATER.CREATELERESPONSELOG", line 12
    ORA-06512: at line 1
    Please guide Me..

    Hi Ravi kumar,
    I have similar type of problem like above . My xml file is like below:
    <doSingleRecordResponse xmlns="urn:mdWebService">
    <doSingleRecordResult xsi:type="ResponseRecord" id="1" version="2.30" action="Response" timeout="10" timestamp="12-17-2009" transmissionReference="ABCDEF" TimeToProcess="31.25" xmlns:xsi="http://www
    .w3.org/2001/XMLSchema-instance">
    <CustomerCredentials>
    <CustomerID>111111</CustomerID>
    </CustomerCredentials>
    <ServiceResult>
    <ErrorCode> </ErrorCode>
    <ErrorDesc>OK;</ErrorDesc>
    </ServiceResult>
    <Address version="2.30">
    <Faults count="0"/>
    <Result>
    <ErrorCode> </ErrorCode>
    <ErrorDesc>OK</ErrorDesc>
    <StatusCode>9</StatusCode>
    <StatusD
    esc>(U.S.) The address was fully coded.</StatusDesc>
    </Result>
    <Company/>
    <Urbanization>
    <Name/>
    <Code/>
    </Urbanization>
    <Type>
    <String>Highrise</String>
    <Code>H</Code>
    </Type>
    <Street>XXXXXXXXXXXXX</Street>
    <Street2/>
    <Suite/>
    <PrivateMailBox/>
    <CarrierRoute>C048</CarrierRoute>
    <Lacs> </Lacs>
    <LacsLink>
    <LacsStatusCode/>
    <LacsReturnCode/>
    </LacsLink>
    <DeliveryPointCode>99</DeliveryPointCode>
    <DeliveryPointCheckDigit>6</DeliveryPointCheckDigit>
    <DPV>
    <Footnotes/>
    <CMRA/>
    <AddressStatus/>
    </DPV>
    <DeliveryIndicator>
    <Code/>
    </DeliveryIndicator>
    <City>
    <Name>String</Na
    me>
    <Abbreviation>Memphis</Abbreviation>
    </City>
    <County>
    <Name>String</Name>
    <Fips>41111</Fips>
    </County>
    <State>
    <Name>Tennessee</Name>
    <Abbreviation>TN</Abbreviation>
    </State>
    <Zip>
    <Type> </Type>
    <Zip5>38111</Zip5>
    <Plus4>1111</Plus4>
    </Zip>
    <GeoCode>
    <Latitude/>
    <Longitude/>
    </GeoCode>
    <TimeZone>
    <Name/>
    <Code/>
    </TimeZone>
    <Msa>
    <Code/>
    </Msa>
    <Pmsa>
    <Code/>
    </Pmsa>
    <Census>
    <Block/>
    <Tract/>
    </Census>
    <CongressionalDistrict>
    <Code/>
    </CongressionalDistrict>
    <Parsed>
    <StreetName/>
    <AddressRange/>
    <Suffix/>
    <Direction>
    <Post/>
    <Pre/>
    </Direction>
    <Suite>
    <Name/>
    <Range/>
    </Suite>
    <PrivateMailBox>
    <Name/>
    <Range/>
    </PrivateMailBox>
    <Garbage/>
    </Parsed>
    <Country>
    <Abbreviation>US</Abbreviation>
    <Name>United St
    ates of America</Name>
    </Country>
    </Address>
    <Telephone version="" action="">
    <Result>
    <ErrorCode/>
    <ErrorDesc/>
    <StatusCode/>
    <StatusDesc/>
    </Result>
    <Number/>
    <PhoneAreaCode/>
    <NewAreaCode/>
    <Prefix/>
    <Suffix/>
    <Extension/>
    <City>
    <Name/>
    </City>
    <State>
    <Name/>
    <Abbreviation/>
    </State>
    <GeoCode>
    <Latitude/>
    <Longitude/>
    </GeoCode>
    <TimeZone>
    <Name/>
    <Code/>
    </TimeZone>
    <Msa>
    <Code/>
    </Msa>
    <Pmsa>
    <Code/>
    </Pmsa>
    <County>
    <Name/>
    <Fips/>
    </County>
    <Country>
    <Abbreviation/>
    <Name/>
    </Country>
    </Telephone>
    <Name version="" action="">
    <Result>
    <ErrorCode/>
    <ErrorDesc/>
    <StatusCode/>
    <StatusDesc/>
    </Result>
    <Company/>
    <Prefix/>
    <Suffix/>
    <Full/>
    <First/>
    <Middle/>
    <Last/>
    <Gender/>
    </Name>
    </doSingleRecordResult>
    </doSingleRecordResponse>
    This is the response i got from a webservice , from this i need to extract customer id .
    I tried like this :
    response := UTL_DBWS.invoke ( l_call,request);
    if RESPONSE.extract('/doSingleRecordResponse/doSingleRecordResult/CustomerCredentials/CustomerID/text()','xmlns:xsi="http://www
    .w3.org/2001/XMLSchema-instance" xmlns="urn:mdWebService"') is not NULL
    then
    errorcode :=RESPONSE.extract('/doSingleRecordResponse/doSingleRecordResult/CustomerCredentials/CustomerID/text()','xmlns:xsi="http://www
    .w3.org/2001/XMLSchema-instance" xmlns="urn:mdWebService"').getStringVal;
    end if;
    I am getting null value into errorcode,
    Can youplease let me know what i am doing wrong?
    Thanks

  • Problem using extract function (PL/SQL) with "&#34"

    Hi,
    When I use extract function (PL/SQL), it does not transform well "&#34". Insted of returning ' " ' , it returns ' &quot '.
    I know this works changing the code replacing xml.extract for SELECT extractvalue(xml,'//A/text()') into v from dual;
    But Is there another way to do this using PL/SQL? any patch, option..?
    Regards

    Had to use my website to demonstrate the code...
    As said, whatever I try here the code gets automatically converted...
    See for answer on your question: http://www.liberidu.com/blog/?p=635

  • Fix for WebHelp output issues with IE 11 breaks Search function

    I use RoboHelp HTML 9 and have been having issues with generated WebHelp in IE 11. The TOC was totally blank and the Search tab looked fine but did not function. Everything worked fine in Firefox. After much experimenting and online research in these forums and elsewhere, I have been able to get the TOC to display properly in IE 11 (and Firefox) but the fix has caused the Search tab to stop functioning as per this other forum post RH9 Webhelp Search function is not working properly.
    I need to have BOTH TOC and Search displayed and functioning properly but in order to get the TOC displayed properly I had to change the Preferred Format setting to "Pure HTML" and, according to the post mentioned above, that is what messes up the Search function. Is there a solution that will allow both TOC and Search to function properly?
    Here is a summary of the steps I have taken to get to this point:
    Tested WebHelp output from two different projects of my own as well as the Salesbuilder starter project - all would display/function properly in Firefox but not in IE 11 (blank TOC and non-functioning Search).
    Found a "patch" for RH10 for the exact problem I was having with RH9 but was not able to find a version for RH9. Since the patch included 2 files (whutils.js and whver.js) only, I backed up these files in the RoboHTML\WebHelp5Ext\template_stock directory and replaced them with the new ones.
    Regenerated one of my RoboHelp projects - still didn't work in IE 11 and now didn't work in Firefox either!
    Tried turning on Mark of the Web but this did not help and would not allow opening PDF's which is necessary to one of the projects so I turned it off again.
    Changed Preferred Format setting to "Pure HTML" instead of "DHTML" and the TOC displayed and functioned properly in IE 11 and Firefox! Hurray!!
    Celebrated for 10 seconds until I clicked on Search tab and saw the input box filled with letters of the alphabet with other random letters, words, numbers below. It looks almost like an index but neither of my projects uses an index and I have not generated one in either project.
    Found the post mentioned above which states that the solution is to change the Preferred Format setting back to DHTML but when I do that I am back to blank TOC and proper-looking but non-functioning Search!!!
    I have now removed the Search tab from the output of one of the projects since it is not really necessary but I need to find a fix for this for my other project.
    Both of my projects are run locally - one is release documentation that is distributed on a CD and the other is CSH which is loaded on the local server with the software for which it was created.
    Dorothy
    Note to Administrators: Sorry, but I originally posted this as a reply to a previous post - Contents, Index, & Search do not display in generated help... - so perhaps it should be removed from that thread to avoid confusion.

    The "preliminary" fix provided has worked perfectly! All versions of my WebHelp project now display TOC properly and I was able to change the Preferred Format setting back to DHTML so the Search tab both displays and functions as it should. I am very grateful to William for providing this fix which works in both IE 11 and Firefox. Someday I will pursue the fixes to make it work in Chrome as well.

Maybe you are looking for