SQL - Duplicate Accounts Report

I have some SQL, for which i have greatly simplified for the purposes of this post
It does some matching to determine accounts which potentially could be duplicated.
The SUBSTR(LOWER(... clause is used but in the results produces duplicates of the same account as shown in the results below, i know why its doing this but not sure if it is possible to solve the problem, can anyone help?
SELECT
acc_a.accnt_code "Original Account",
acc_b.accnt_code "Duplicate Account"
FROM ssrfacc acc_a,
ssrfacc acc_b,
ssrfadd add_a,
ssrfadd add_b
where acc_a.accnt_code <> acc_b.accnt_code
and acc_a.accnt_type = acc_b.accnt_type
and acc_a.accnt_code = add_a.add_code
and acc_b.accnt_code = add_b.add_code
and SUBSTR(LOWER(trim(acc_a.accnt_name)),1,20) = SUBSTR(LOWER(trim(acc_b.accnt_name(+))),1,20)
--and add_a.lookup = add_b.lookup
Original Account Duplicate Account
20CAM147 20CAM083
20CAM083 20CAM147
20NAN054 20NAN047
20MAC119 20MAC068

Sorry i made a mistake in the original code is pasted
where acc_a.accnt_code <> acc_b.accnt_code
SELECT
acc_a.accnt_code "Original Account",
acc_b.accnt_code "Duplicate Account"
FROM ssrfacc acc_a,
ssrfacc acc_b,
ssrfadd add_a,
ssrfadd add_b
where acc_a.accnt_code <> acc_b.accnt_code
and acc_a.accnt_type = acc_b.accnt_type
and acc_a.accnt_code = add_a.add_code
and acc_b.accnt_code = add_b.add_code
and SUBSTR(LOWER(trim(acc_a.accnt_name)),1,20) = SUBSTR(LOWER(trim(acc_b.accnt_name(+))),1,20)
--and add_a.lookup = add_b.lookup                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Aging - 7 Buckets - By Account Report

    Hi All,
    I need sql script to get the same output of Oracle Standard Report 'Aging - 7 Buckets - By Account Report' as i am gone through the data model but the query is written in Dynamically and using Dual table.
    Can anyone tell me how to write the sql script for this Oracle standard report.
    Regards,
    Sushant

    Hi,
    Oracle Standard Report 'Aging - 7 Buckets Report' giving output of Customer Name and Customer Number with Outstanding Amount of aging between 7 bucket(0-30 days, 31-45 days, 46-60 days, 61-90 days, 91-120 days, 121-150 days, 151-99999 days)
    As i an able to get the aging colum by below query.
    select a.*, b.*
    from AR_AGING_BUCKETS a,
    AR_AGING_BUCKET_LINES b
    where a.aging_bucket_id=b.AGING_BUCKET_ID
    and a.AGING_BUCKET_ID=1003
    but how to relate the customer name ,customer no (RA_CUSTOMER table) and outstanding amount with this aging bucket table.
    so i need to develop a report customer wise aging 7 bucket and their outstanding amount.
    Please give me idea how to proceed .
    if you need more information please update the forums.
    Regards,
    Sushant
    Edited by: user605933 on Jun 11, 2009 9:17 AM

  • Sql Server 2008 Reporting Security issue ( added name to Server, some how cannot acces the report ) getting error message

    have added name to Sql server , users cannot access the report, getting error message ,
    I have give all the permission to this users, so why this users still cannot look at the report,
    and getting error message,
    An error has occurred during report processing.
    cannot create a connection to data source Ax live
    for more information about this error navigate to the report server on the local server machine or enable remote errors.
    can some please help me what this message means,
    I really appreciate it
    thanks In advance

    If "Credentials supplied by the user running the report" is selected, when the report is run, the user will be prompted to provide credentials.  They would need to provide credentials that have the appropriate permissions (e.g., read, execute) to the
    database.  This prevents the double hop.
    If "Credentials stored securely in the report server" is selected, you have to enter the username and password of a user (or service account) that has the appropriate permissions (e.g., read, execute) to the database. When the report is run, SSRS will use
    these stored credentials each time to authenticate to the database engine and query the data.  Users running the report are not prompted to provide credentials.  With this option you can use an Active Directory or SQL Server account.
    In order to access/run the report, a user will need to authenticate to SSRS.  There are options here as well. You can provide them the link to the report manager and they can authenticate, navigate to, and run the report.  You can also provide
    direct links to reports that users click in a document or application.  At this point the user is typically still prompted to authenticate to SSRS.  You can also programmatically call the report using API's and essentially build a proxy that authenticates
    to SSRS and open the report.
    Not sure if that answers your question.

  • VCM installation help needed on SQL DB and Reporting server

    Hi All,
    I'm new to VCM and now i got stuck at the SQL DB and Report server portion.
    I'm running the vcm server on VM and the SQL is a physical server, both are sitting on the same LAN.
    I have create the SQL DB but VCM just fail to validate the DB and report server.
    I login to VCM using a Domain account for installation, and i tried to testing the DB using ODBC from the window, result fail.
    Error message as attach.
    I'm now totally lost on SQL portion.
    My Question:
    Is there any configuration needed on SQL DB?
    How to get the reporting server to working?
    What port is needed to it all working??
    VCM server Ms Win2012.
    SQL version 2012.
    Many thanks to all who reply.

    Hi Simonhoo79,
    For SSRS,   first check whether the report server link is accessible from your browser : "http://s01-fes-vcm1:80/ReportServer" . If you continue to get 404 error there also, then you need to reconfigure you report server first before proceeding to vcm installation. Follow the steps on below link on how to reconfigure report server using report services configuration Manager for 404 error.
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/75910bcb-a879-4eb7-9757-acc45201fa3a/can-not-connect-to-reportserver-http-404-file-not-found?forum=sqlexpress
    For SQL server ODBC connection,
    Dont create ODBC connection for SQL Native Client. Create ODBC connection for SQL Server.
    1. Open ODBC Data Source Administrator
    2. Click User DSN tab and Click Add button.
    3. Select SQL server and click finish
    4. Give name and description and Give the SQL server name (with instance name if your using named instance) or IP in the Server text box.
    5. Click Next and select either Windows authentication or sql authentication based on your SQL server authentication mode and click next.
    6. If the details given are correct then it will proceed further and  check "Change the dafault database to" to your VCM database
    7. Click next and finish and try test data source.
    VCM 5.7.2 and below will support installation only on windows server 2008 R2  and it doesn't support windows server 2012  but it support both 2008 and 2012 sql servers.

  • Possible APEX BUG - Export to CSV from SQL Query (updateable report)

    I'm getting a the following sql error - just by enabling the Export to a CSV file from a SQL Query (updateable report) and selecting the export link - anyone have an idea what I could as a workaround?
    ORA-06550: line 1, column 45: PLS-00103: Encountered the symbol "1" when expecting one of the following: begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe
    Error ERR-1000 Unable to determine LOV from "declare function x return varchar2 is begin 1 Not Checked;1 Not Checked,2 Review Passed;2 Review Passed,3 Reviewed w/ Issues;3 Reviewed w/ Issues,4 Not Applicable;4 Not Applicable return null; end; begin wwv_flow_utilities.g_query := x; end;".
    OK
    report error:
    ORA-20001: Error fetching column value: ORA-20001: Query must begin with SELECT or WITH

    Frank,
    I received your email with this same question so I'll just respond here. Our internet-facing hosted site apex.oracle.com allows you to request a workspace and, after the request is approved and the workspace provisioned, to develop applications there. If you already have an application that you need some help with, you can import/install it into your workspace on apex.oracle.com. This makes it easy to demonstrate problems to others who might be able to help.
    Sometimes it will be necessary for you to create developer accounts in your workspace in order for others to use your Application Builder. You can post usernames/passwords here or you can convey those privately to those offering their services. In either case, you'd want to remove or disable those accounts as soon as the problem is resolved. For problems that I ask to see demonstrated on apex.oracle.com, it is not necessary for you to create an account for me. I can do that as our group runs the site. I just need to know your workspace name and application ID.
    Scott

  • Can we use Dynamic SQL in Oracle Reports ?

    Hi ,
    Can we use Dynamic SQL in Oracle Reports ?
    If yes please give some examples .
    Thanx
    srini

    I believe the built-in package SRW.Do_Sql is what you are looking for
    Example from the document:
    /* Suppose you want to create a "table of contents" by getting the
    ** first character of a columns value, and page number on which its
    ** field fires to print. Assume that you want to put the "table of
    contents"
    ** into a table named SHIP. You could write the following construct:
    DECLARE
    PAGE_NO NUMBER;
    PAGE_FOR INDEX NUMBER;
    SORT_CHAR CHAR(1);
    CMD_LINE CHAR(200);
    BEGIN
    SORT_CHAR := :SORT_NAME ;
    IF :CALLED = Y THEN
         SRW.GET_PAGE_NUM(PAGE_FOR_INDEX);
         SRW.USER_EXIT(RWECOP PAGE_FOR_INDEX
         P_START_PAGENO);
         SRW.MESSAGE(2,TO_CHAR(:P_START_PAGENO));
    END IF;
    SRW.GET_PAGE_NUM(PAGE_NO);
    CMD_LINE := INSERT INTO SHIP VALUES
                          (||SORT_CHAR||,||TO_CHAR(PAGE_NO)||);
    SRW.MESSAGE(2,CMD_LINE);
    SRW.DO_SQL(CMD_LINE);
    COMMIT;
    EXCEPTION
      WHEN DUP_VAL_ON_INDEX THEN
            NULL;
      WHEN SRW.DO_SQL_FAILURE THEN
            SRW.MESSAGE(1,FAILED TO INSERT ROW INTO SHIP TABLE);
      WHEN OTHERS THEN
           COMMIT;
    END;

  • PL/SQL Ad-hoc Reporting Implementation Questions

    Recently, I have been put on a development team that is developing a small reporting module for one of our applications.
    I'm trying to mask the underlying structure from the application by having the application run PL/SQL procedures which return REF CURSORS to the client with the requested data. Right now I'm struggling with how to implement the PL/SQL in the best fashion.
    Since this is a reporting tool the user has many combinations of selections. For example at a high level this application has a combination of multiple dropdowns (4-6), radio buttons, and check boxes. As you can see this results in a high amount of possible combinations that have to be sent to the database.
    Basically, the user chooses the following:
    1. Columns to receive (ie different SELECT lists in the PL/SQL)
    2. Specific conditions (ie different WHERE clauses in the PL/SQL)
    3. Aggregate functions (SUMS, TOTALS, AVERAGES based on #1 and #2)
    4. Trends based on #3.
    So... with that said I see two possibilities:
    1. Create a static query for each combination of parameters (in this case that would most likely result in at least 300 queries that would have to be written, possibly 600+).
    The problem I see with this is that I will have to write a significant amount of queries. This is a lot of front end work that, while is tedious, could result in a better performing system because it would be a parse once, execute many scenario which is scalable.
    The downside though is that if any of the underlying structure changes I have to go through and change tens of queries.
    2. Use DBMS_SQL and dynamically generate the queries based on input conditions.
    This approach (possibly) sacrifices performance (parse once, execute once situation), but has increased maintainability because it is more likely that I'll have to make one change vice a number of changes in scenario 1.
    A downside to this is that, it may be harder to debug (and hence maintain) because the SQL is generated on the fly.
    My questions to all is:
    1. Which is the approach that would best manage maintainability / performance?
    2. Is there any other approaches to using PL/SQL as a reporting tool that I am not thinking of?
    The database is 10.2.0.3, and the 'application' is PHP 5.1 running on IIS 6.
    If you need me to provide any additional information please let me know.
    Thanks!

    Ref cursors are an ugly solution (different though in 11g).
    You build a dynamic SQL. It must/should have bind variables. But a ref cursor does not allow you to dynamically bind values to bind variables. You need to code the actual bind variables into the code as part of the open cursor command. And at coding time you have no idea how many bind variables there will be in that dynamic SQL for the ref cursor.
    The proper solution is DBMS_SQL as it allows exactly this. Also one of the reasons why APEX uses this for its report queries.
    The only sensible way to implement this type of thing in PL/SQL is by not trying to make it generic (as one could with DBMS_SQL). Instead use polymorphisms and have each procedure construct the appropriate ref cursor with bind variables.
    E.g.
    SQL> create or replace package query as
    2 procedure Emp( c in out sys_refcursor );
    3 procedure Emp( c in out sys_refcursor, nameLike varchar2 );
    4 procedure EMp( c in out sys_refcursor, deptID number );
    5 end;
    6 /
    Package created.
    SQL>
    SQL> create or replace package body query as
    2
    3 procedure Emp( c in out sys_refcursor ) is
    4 begin
    5 open c for select * from emp order by 1;
    6 end;
    7
    8 procedure Emp( c in out sys_refcursor, nameLike varchar2 ) is
    9 begin
    10 open c for select * from emp where ename like nameLike order by 1;
    11 end;
    12
    13 procedure EMp( c in out sys_refcursor, deptID number ) is
    14 begin
    15 open c for select * from emp where deptno = deptID order by sal;
    16 end;
    17 end;
    18 /
    Package body created.
    SQL>
    SQL> var c refcursor
    SQL> exec query.Emp( :c, 'S%' )
    PL/SQL procedure successfully completed.
    SQL>
    SQL> print c
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7369 SMITH CLERK 7902 1980-12-17 00:00:00 800 20
    7788 SCOTT ANALYST 7566 1987-04-19 00:00:00 3000 20
    SQL>

  • Is there a simple way to refresh a SQL Query (Updatable report) region

    I have a page in APex 4.1 that has many regions. I would like to be able to refresh a single region.
    Currently, I have the following
    Region (sql query updateable report).
    STATIC ID = LANDINGS
    in the region footer, I have:
    <script type="text/javascript">
    $s('P110_LANDINGS_REGION_ID','#REGION_STATIC_ID#');
    </script>
    P110_LANDINGS_REGION_ID is a hidden field.
    I use javascript to refresh....but it does not seem to be working. Previously, we had hard-coded the region id ( $a_report('1363338167540162011','1','100','100');) ...but that ID was somehow corrupted, which has lead me to the 'OMG...there must be an easier way!' lament.
    the javascript is:
    $a_report('P110_LANDINGS_REGION_ID','1','100','100');
    thanks!
    Karen
    ps. could I just directly reference the static id in my javascript...
    $a_report('LANDINGS','1','100','100');

    Karen,
    First off: please post code in &#123;code&#125;...&#123;code&#125; tags!
    function AddFavoriteSpecies()
    get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=favorite_species_collection',0);
    gReturn = get.get();
    rowCount = rowCount + parseInt(gReturn);
    pHMS_add = '&G_HMS_FLAG.';
    $a_report('1363338167540162011','1','100','100');
    //$a_report($x('P110_LANDINGS_ID').value,'1','15','15');the statement:
    $a_report('1363338167540162011','1','100','100'); works, but the statement $a_report($x('P110_LANDINGS_ID').value,'1','15','15'); does not.
    Can anyone help.
    I am assigning the page field P110_LANDINGS_ID in the footer of a region with a static id = LANDINGS.
    <script type="text/javascript">
    $s('P110_LANDINGS_ID','#REGION_STATIC_ID#');
    </script>
    Well, let's start by dumping $a_report. This is undocumented code, and it has long been replaced by triggering a refresh.
    Next, don't use $x(pNode).value to retrieve a value. Rather use $v(pNode) to do this.
    function AddFavoriteSpecies()
       get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=favorite_species_collection',0);
       gReturn = get.get();
       rowCount = rowCount + parseInt(gReturn);
       pHMS_add = '&G_HMS_FLAG.';
       //get the region id from the item
       //use it in a jQuery selector to get the region
       //trigger the refresh event on this object
       $("#" + $v('P110_LANDINGS_ID')).trigger('apexrefresh');
    }Now if you want to make sure that P110_LANDINGS_ID contains a value, add an alert with its value before you use it.
    alert('P110_LANDINGS_ID value: '+$v('P110_LANDINGS_ID'))

  • Restricting the pl/sql error in report region(sql report)

    Hi,
    Is there any way to hiding pl/sql error in report region when we use generic column names*(Use Generic Column Names (parse query at runtime only)*
    ). and type is sql query else displaying alternative error message on that particular report region
    I am using apex 4.1 and 11g database
    Thanks
    Sagar.

    What kind of pl/sql error you are talking about?

  • SQL Query (updateable report) Region - Conditionally Hide and Set Values

    SQL Query (updateable report) Region - Conditionally Hide and Set Values
    Outline of requirement :-
    Master / Detail page with Detail updated on same page using SQL Query (updateable report).
    The detail region has the following source
    SELECT item_id,
           contract_id,
           CASE WHEN hardware_id IS NOT NULL THEN
                   'HA'
                WHEN backup_dev_id IS NOT NULL THEN
                   'BD'
                WHEN hardware_os_id IS NOT NULL THEN
                   'HS'
           END item_type,
           hardware_id,
           backup_dev_id,
           hardware_os_id
    FROM   "#OWNER#".support_items
    WHERE  contract_id = :P26_CONTRACT_IDThe table support_items implements arced relationships and has the following columns
    CREATE TABLE SUPPORT_ITEMS
      ITEM_ID         NUMBER                        NOT NULL,
      CONTRACT_ID     NUMBER                        NOT NULL,
      HARDWARE_ID     NUMBER,
      BACKUP_DEV_ID   NUMBER,
      HARDWARE_OS_ID  NUMBER
    )A check type constaint on support_items ensures that only one of the fk's is present.
          (    hardware_id    IS NOT NULL
           AND backup_dev_id  IS NULL
           AND hardware_os_id IS NULL
    OR    (    hardware_id    IS NULL
           AND backup_dev_id  IS NOT NULL
           AND hardware_os_id IS NULL
    OR    (    hardware_id    IS NULL
           AND backup_dev_id  IS NULL
           AND hardware_os_id IS NOT NULL
          )    Hardware_Id is a FK to Hardware_Assets
    Backup_dev_id is a FK to Backup_Devices
    Hardware_os_id is a FK to Hardware_op_systems
    The Tabular Form Element based on item_type column of SQL query is Displayed As Select List (based on LOV) referencing a named list of values which have the following properties
    Display Value     Return Value
    Hardware Asset    HA
    Backup Device     BD
    Computer System   HSThe Tabular Form Elements for the report attributes for hardware_id, backup_dev_id and hardware_os_id are all Displayed As Select List (Based on LOV).
    What I want to do is only display the Select List for the FK depending on the value of the Select List on Item Type, e.g.
    Item_Type is 'HA' then display Select List for hardware_id, do not display and set to NULL the Select Lists for backup_dev_id and hardware_os_id.
    Item_Type is 'BB' then display Select List for backup_dev_id, do not display and set to NULL the Select Lists for hardware_id and hardware_os_id.
    Item_Type is 'HS' then display Select List for hardware_os_id, do not display and set to NULL the Select Lists backup_dev_id and hardware_id.
    There are properties on elements to conditionally display it but how do we reference the values of the SQL query Updateable region? they are not given a page item name?
    Also on the Tabular For Elements there is an Edit tick against a report item - however when you go to the Column Attributes there is not a property with which you can control the Edit setting.
    What's the best way of implementing this requirement in APEX 3.1?
    Thanks.

    >
    Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "user13515136".
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
    I have a multi-row region that displays values and allows entries in a number of fields.Provide exact details of how this has been implemented. (An example on apex.oracle.com is always a good way to do this.)
    I should like the fields to be conditional in that they do not permit entry, but still display, if certain conditions apply (e.g. older rows greyed out). Can this be done? Almost anything can be done, often in multiple ways. Which are appropriate may be dependent on a particular implementation, the skills available to implement it, and the effort you're willing to expend on it. Hence it's necessary to provide full details of what you've done so far...

  • Sql server 2005 reports with sql server 2014

    Can i upload SSRS 2005 reports as it is on SSRS 2014 and use it without doing anything extra or without changing anything ??
    I can use SSRS 2005 reports as it is with SSRS 2012. But for SSRS 2014 not sure.
    h2007

    You can upgrade the the RDL schema will be upgraded.
    Report definition (.rdl) files are automatically upgraded in the following ways:
    When you open a report in Report Designer in SQL Server Data Tools (SSDT), the report definition is upgraded to the currently supported RDL schema. When you specify a SQL Server 2008 or SQL Server 2008 R2 report server in the project properties, the report
    definition is saved in a schema that is compatible with the target server.
    When you upgrade a Reporting Services installation to a SQL Server 2014 Reporting Services (SSRS) installation, existing reports and snapshots that have been published to a report server are compiled and automatically upgraded to the new schema the first
    time they are processed. If a report cannot be automatically upgraded, the report is processed using the backward-compatibility mode. The report definition remains in the original schema.
    Reports are not upgraded when you upload a report definition file directly to the report server or SharePoint site. Upgrading a report definition in SQL Server Data Tools is the only way to upgrade the .rdl file.
    After a report is upgraded locally or on the report server, you might notice additional errors, warnings, and messages. This is the result of changes to the internal report object model and processing components, which cause messages to appear when underlying
    problems in the report are detected. For more information, see Reporting Services Backward Compatibility.
    For more information about new features for SQL Server 2014 Reporting Services (SSRS), see
    What's New (Reporting Services).
    Check the below Microsoft link for more information
    http://msdn.microsoft.com/en-us/library/ms143674.aspx
    Mudassar

  • Business Content or Information for GR/IR Account Report

    Hi All,
    I have an R3 report called GR/IR Account Report by PO Mismatch.
    Is there any business content available for this in BI.
    The below tables are using in the report.
             bsis,                         " Accounting docs by account
             bsas,                         " Cleared accounting docs by acc
             bseg,                         " Accounting doc line item
             ekko,                         " Purchase Order Header,
             ekpo,
             mkpf,                         " Material Document
             lfa1,                         " Vendor details
             ekbe,                         " PO History
             ekkn,                         " PO Acct.Assgnment
             usr21,
             addr3_val,
             ad3_flags,
             stxh.
    Could you please provide me your inputs on this
    Regards
    Srini

    The new additional fields need to be populated are
              ZZAUFNR         Order Number                                  *
              ZZBEDAT         Purchase Order Date                           *
              ZZCRE_FI         FI Doc Created By                             *
              ZZCRE_PO         PO Doc Created By                             *
              ZZEBELN         Purchasing Document Number                    *
              ZZEBELP         Item Number of Purchasing Document            *
              ZZKOSTL         Cost Center                                   *
              ZZMWSKZ         Tax on sales/purchases code                   *
              ZZPROJK      WBS element                                   *
              ZZTXZ01         Short text                                    *
              ZZUSNAM         User name                                     *
              ZZXBLNR         Reference document number                     *
              ZZHWSTE      Tax Amount in Local Currency                 *
              ZZSGTXT      Item Text                                    *
              ZZHKONT      Finance G/L Account                          *
      when '0FI_AP_4'.
    Declare the local data fields to store data temporarily
        data : l_dtfiap_3 like DTFIAP_3,
               mwskz like bsik-mwskz,
               l_ernam like   bapibname-bapibname,
               l_address like bapiaddr3,
               l_bseg  like bseg,
               l_bedat like ekko-bedat,
               l_ps_psp_pnr like prps-pspnr.
        data : gt_return type bapiret2 occurs 0 with header line.
        loop at c_t_data into l_dtfiap_3.
          l_tabix = sy-tabix.
    *Select the tax Code for the particular record from BSAK TABLE
          select single mwskz sgtxt into (l_dtfiap_3-zzmwskz,
                                          l_dtfiap_3-zzsgtxt)
                from bsak
                where bukrs = l_dtfiap_3-bukrs
                  and buzei = l_dtfiap_3-buzei
                  and belnr = l_dtfiap_3-belnr
                  and lifnr = l_dtfiap_3-lifnr
                  and gjahr = l_dtfiap_3-gjahr
                  and zuonr = l_dtfiap_3-zuonr
                  and augbl = l_dtfiap_3-augbl
                and augdt = l_dtfiap_3-augdt
                and bldat = l_dtfiap_3-bldat
                and blart = l_dtfiap_3-blart
                and bschl = l_dtfiap_3-bschl
                and budat = l_dtfiap_3-budat.
          if sy-subrc = 0.
            modify c_t_data from l_dtfiap_3 index l_tabix.
          else.
    *If corresponding Document Number is not present in BSAK check BSIK
    *TABLE
            select single mwskz sgtxt into (l_dtfiap_3-zzmwskz,
                                            l_dtfiap_3-zzsgtxt)
                    from bsik
                    where bukrs = l_dtfiap_3-bukrs
                      and buzei = l_dtfiap_3-buzei
                      and belnr = l_dtfiap_3-belnr
                      and lifnr = l_dtfiap_3-lifnr
                      and gjahr = l_dtfiap_3-gjahr
                      and zuonr = l_dtfiap_3-zuonr
                      and augbl = l_dtfiap_3-augbl
                    and augdt = l_dtfiap_3-augdt
                    and bldat = l_dtfiap_3-bldat
                    and blart = l_dtfiap_3-blart
                    and bschl = l_dtfiap_3-bschl
                    and budat = l_dtfiap_3-budat.
            if sy-subrc = 0.
              modify c_t_data from l_dtfiap_3 index l_tabix.
            endif.
          endif.
          select single hwste into l_dtfiap_3-zzhwste
              from bset
              where bukrs eq l_dtfiap_3-bukrs
                and belnr eq l_dtfiap_3-belnr
                and gjahr eq l_dtfiap_3-gjahr
                and buzei eq l_dtfiap_3-buzei.
    Select Created By and invoice Reference Number from BKPF table
          select single usnam xblnr from bkpf
              into (l_dtfiap_3-zzusnam,l_dtfiap_3-zzxblnr)
                where bukrs = l_dtfiap_3-bukrs
                  and belnr = l_dtfiap_3-belnr
                  and gjahr = l_dtfiap_3-gjahr.
          if sy-subrc = 0.
            modify c_t_data from l_dtfiap_3 index l_tabix.
          endif.
          move l_dtfiap_3-zzusnam to l_ernam.
          refresh : gt_return.
    Get the Fi doc Created By doing the function Module call
          call function 'BAPI_USER_GET_DETAIL'
            EXPORTING
              username = l_ernam
            IMPORTING
              address  = l_address
            TABLES
              return   = gt_return.
          move l_address-fullname to l_dtfiap_3-zzcre_fi.
          if l_dtfiap_3-zzcre_fi is initial.
            move l_ernam to l_dtfiap_3-zzcre_fi.
          endif.
          if not l_dtfiap_3-zzcre_fi is initial.
            modify c_t_data from l_dtfiap_3 index l_tabix.
          endif.
          if l_dtfiap_3-blart eq 'RE'.
    .....Get New Fields from PO linked to FI Document.....................
    Select PO Number from PO Line item from BSEG TABLE
            select buzei buzid ebeln ebelp
              into corresponding fields of l_bseg
              from bseg
             where bukrs eq l_dtfiap_3-bukrs
               and belnr eq l_dtfiap_3-belnr
               and gjahr eq l_dtfiap_3-gjahr.
              if l_bseg-buzei eq l_dtfiap_3-buzei.
    .....Already read this line, therefore ignore it......................
                continue.
              endif.
              if l_bseg-buzid eq 'T'.
    .....Don't read automatically created lines - Tax Line................
                continue.
              endif.
              if not ( l_bseg-ebeln is initial ).
                move l_bseg-ebeln to l_dtfiap_3-zzebeln.   " PO Number
              endif.
              if not ( l_bseg-ebelp is initial ).
                move l_bseg-ebelp to l_dtfiap_3-zzebelp.   " PO Line Item No
              endif.
              if not l_dtfiap_3-zzebelp is initial.
                modify c_t_data from l_dtfiap_3 index l_tabix.
              endif.
            endselect.
    .....Got PO Number from FI Document, Now get PO Details...............
    .....Get Short Text...................................................
    GET PO Line Item text
            select single txz01 into l_dtfiap_3-zztxz01
              from ekpo
               where ebeln eq l_dtfiap_3-zzebeln
                 and ebelp eq l_dtfiap_3-zzebelp.
            if sy-subrc = 0.
              modify c_t_data from l_dtfiap_3 index l_tabix.
            endif.
    .....Get Account Assignment...........................................
            select ps_psp_pnr aufnr kostl sakto
              into (l_ps_psp_pnr,l_dtfiap_3-zzaufnr,
                      l_dtfiap_3-zzkostl,l_dtfiap_3-zzhkont)
                  from ekkn
                   where ebeln eq l_dtfiap_3-zzebeln
                     and ebelp eq l_dtfiap_3-zzebelp.
              if sy-subrc = 0.
                modify c_t_data from l_dtfiap_3 index l_tabix.
              endif.
              select single posid into l_dtfiap_3-zzprojk
                   from prps
                     where pspnr = l_ps_psp_pnr.
              if sy-subrc = 0.
                modify c_t_data from l_dtfiap_3 index l_tabix.
              endif.
            endselect.
    .....Get Name of Person who created PO................................
            clear : l_ernam,l_bedat.
            select ernam bedat into (l_ernam, l_bedat)
                up to 1 rows
                from ekko
                 where ebeln eq l_dtfiap_3-zzebeln.
            endselect.
            move l_bedat to l_dtfiap_3-zzbedat.
            if not l_dtfiap_3-zzbedat is initial.
              modify c_t_data from l_dtfiap_3 index l_tabix.
            endif.
            refresh : gt_return.
            call function 'BAPI_USER_GET_DETAIL'
              EXPORTING
                username = l_ernam
              IMPORTING
                address  = l_address
              TABLES
                return   = gt_return.
            move l_address-fullname to l_dtfiap_3-zzcre_po.
            if l_dtfiap_3-zzcre_po is initial.
              move l_ernam to l_dtfiap_3-zzcre_po.
            endif.
            if not l_dtfiap_3-zzcre_po is initial.
              modify c_t_data from l_dtfiap_3 index l_tabix.
            endif.
          else.
    .....Get new Fields from FI Document..................................
            select buzei buzid ebeln ebelp projk aufnr kostl hkont
              into corresponding fields of l_bseg
              from bseg
             where bukrs eq l_dtfiap_3-bukrs
               and belnr eq l_dtfiap_3-belnr
               and gjahr eq l_dtfiap_3-gjahr.
              if l_bseg-buzei eq l_dtfiap_3-buzei.
    .....Already read this line, therefore ignore it......................
                continue.
              endif.
              if l_bseg-buzid eq 'T'.
    .....Don't read automatically created lines - Tax Line................
                continue.
              endif.
              if not ( l_bseg-ebeln is initial ).
                move l_bseg-ebeln to l_dtfiap_3-zzebeln. " PO Number
              endif.
              if not ( l_bseg-ebelp is initial ).
                move l_bseg-ebelp to l_dtfiap_3-zzebelp. " PO Line Item
              endif.
              move l_bseg-aufnr to l_dtfiap_3-zzaufnr.   " Order Number
              move l_bseg-kostl to l_dtfiap_3-zzkostl.   " Cost Centre
              move l_bseg-hkont to l_dtfiap_3-zzhkont.   " GL Account
              select single posid into l_dtfiap_3-zzprojk
                  from prps
                    where pspnr = l_bseg-projk.
              if not l_dtfiap_3-zzprojk is initial
                or not l_dtfiap_3-zzaufnr is initial
                or not l_dtfiap_3-zzkostl is initial
                or not l_dtfiap_3-zzhkont is initial.
                modify c_t_data from l_dtfiap_3 index l_tabix.
              endif.
            endselect.
    .....Get PO Short Text................................................
            select single txz01 into l_dtfiap_3-zztxz01
              from ekpo
               where ebeln eq l_dtfiap_3-zzebeln
               and ebelp eq l_dtfiap_3-zzebelp.
            if sy-subrc = 0.
              modify c_t_data from l_dtfiap_3 index l_tabix.
            endif.
    .....Get Name of Person who created PO................................
            clear : l_ernam,l_bedat.
            select ernam bedat into (l_ernam, l_bedat)
                   up to 1 rows
                   from ekko
                   where ebeln eq l_dtfiap_3-zzebeln.
            endselect.
            move l_bedat to l_dtfiap_3-zzbedat.
            if not l_dtfiap_3-zzbedat is initial.
              modify c_t_data from l_dtfiap_3 index l_tabix.
            endif.
            refresh : gt_return.
    Get PO Doc Created By
            call function 'BAPI_USER_GET_DETAIL'
              EXPORTING
                username = l_ernam
              IMPORTING
                address  = l_address
              TABLES
                return   = gt_return.
            move l_address-fullname to l_dtfiap_3-zzcre_po.
            if l_dtfiap_3-zzcre_po is initial.
              move l_ernam to l_dtfiap_3-zzcre_po.
            endif.
            if not l_dtfiap_3-zzcre_po is initial.
              modify c_t_data from l_dtfiap_3 index l_tabix.
            endif.
          endif.
        endloop.
    Edited by: Srinivas Gogineni on Apr 19, 2009 11:10 AM

  • Get a insert session value for SQL query at report

    Hi friends
    I created a global temp table and procedure to support web search form.
    and a search result report. The procudure
    gets search result from multip tables and
    insert into temp table --recordsearch. I can get value from temp table  by call procedure
    at SQL*Plus.
    However, I can not get this value by web report.
    How can I get this insert session value and pass to SQL query for report?
    Thanks,
    Newweb
    CREATE GLOBAL TEMPORARY TABLE recordsearch
    (emp_id          VARCHAR2(200),
    ssn               VARCHAR2(9),
    fname          VARCHAR2(200),
    lname           VARCHAR2(200),
    m_name          VARCHAR2(200)
    ) ON COMMIT PRESERVE ROWS;

    it possible that your web form does not have a persistent, dedicated connection. if you have connection pooling for example, multiple sessions will see the same instance of the GTT, so if one deletes it, then nobody sees it (or you can see others data). if the connections are not persistent, then they can disconnect between calls, deleting the GTT table.

  • Imessage on my iMac has created two iMessage account both asking for Apple ID....and no option to - (delete) one of the two duplicate accounts....how can I delete one of them it just bothers me due to sign in issues....goes inactive when signed in on othe

    imessage on my iMac has created two iMessage account both asking for Apple ID....and no option to - (delete) one of the two duplicate accounts....how can I delete one of them it just bothers me due to sign in issues....when signed into one it signs out the other and goes inactive I just wanted to delete one of them so this issue doesn't happen....why doesn't it give the option to delete ONLY these two accounts

    1. Don't confuse "Apple ID" with iTunes Account ID.  You can have many Apple IDs but only one iTunes account active at a time.
    2. If you "changed" your iTunes account ID, you actually have 2 accounts - one under the old name plus the new name.
    3. You can't merge the accounts - they remain separate.  Apps purcahsed under the old account name will update ONLY WHEN THE PHONE IS SIGNED IN TO THE OLD ACCOUNT NAME  and visa versa.
    4. Likewise, you can sync only the apps, music, media purchased under the account the phone AND iTunes are signed in to.

  • Update Field On Change For A SQL Query (updateable report)

    Hi,
    I'd like to request help from anyone with ideas on how to solve this.
    We are using APEX 4.2, 10GR2, RedHat5.
    I have a report that comes from SQL Query (updateable report).
    I'm using the apex_item.text and apex_item.hidden on fields.
    I'm using a button to submit and after submit process to add some logic that I need.
    There could be 1 - 10 records in the report.
    There is only 1 field that is needed to enter a value, but the value of this field determines the value of another field.
    I think that I can do this with a submit button and an after submit process where I loop through all the records. I think I have this handled.
    This is the question
    When the value of that field is changed then the value of another field in the same row changes immediately.
    Is this possible?
    All the examples I've seen so far are for a single record and that doesn't work for us.
    I guess this is a MRU process but I haven't seen an example where a dynamic action is possible on a Multi Row Update.
    Could anyone direct me to where I can see an example or help me get directions?
    I appreciate all your help an comments and I thank you in advance.

    Yes why not...what you looking for is a ajax call
    See {message:id=10390979}
    Please note:-you can also do this as a dynamic action as shown below
    Event: Change
    Selection type: jQuery Selector
    jQuery Selector: input[name="f01"]
    True action with Execute JavaScript Code and put all code inside the test funtion, you may need to amend the code to use this.triggeringElemnt in place of this

Maybe you are looking for

  • Outbound Delivery without Manufacturing date

    Hi Guys, I have activated SLED in Article master.(We are using SAP IS Retail, ECC 6.00) At the time of GRN, users have entered manufacturing date to check remaining shelf life for an article. I have made following customization (using transaction cod

  • Why do I get iMessage failed update date and time in settings

    My iphone5 keeps changing it time zone on it's own and I keep getting a notification in messages saying iMessage failed update your date and time in settings.  I have update it several times and it's keep doing it.  Now it's just frustrating.  How ca

  • Bold, Emphasis formatting not displayed

    I have a report that I'm generating from cf (I bypassed the reportbuilder tool). The query pulls all the data from a sql db. The report properly inserts line breaks <BR>, however, whenever it encounters <em> or <i>, it will not format the text proper

  • Cross Company Sercice Order.

    Hello, We have 3 Company Codes and Each has 1 Plant. Lets say - Company Code - 001, 002, 003 Plant - 001, 002, 003 Profit center & Business area is also same Each company code have only 1 Profit center and Business area Now issue is We have created w

  • Can I Install OAS 10.1.3.1 32 bit on Redhat Linux 64 bit ?

    Hi all, Can I Install OAS 10.1.3.1 32 bit on Redhat Linux ES 4 (64 bit) ? Thank you for your help, xtanto