Rowtype not fetching all the rows

This my cursor declaration. When the Package is executed it get all records minus 1 (Assumming there are 10 rows to be processed, it ONLY processes 9 records)
cursor X1 is
select *
from NT
hdr X1%rowtype;
Below is the procedure call
     open X1;
     fetch X1 into hdr;
     loop
     exit when X1%notfound;
               fetch X1 into hdr;
               pkgXX.insrt(hdr);
     end loop;
          commit;
     close X1;

That makes sense. You 1) fetch a row, 2) check for %notfound, 3) fetch a row and process it. Notice that the row you fetched in 1 was never processed. Try this:
open X1;
loop
  fetch X1 into hdr;
  exit when X1%notfound;
  pkgXX.insrt(hdr);
end loop;
commit;
close X1;

Similar Messages

  • ALV not showing all the rows! Please help!

    Hi Experts,
         I have webdynpro ALV report and I am using SALV_WD_TABLE as the reusable component. In component controller's WDDOINIT I have written the code for pulling teh data from R/3 table and binding it to ALV table.
    In the view's WDDOMODIFYVIEW event I have written the following code to get subtotal and grand total of Qty column based on product column.
          I have coded like this:
          lr_field_settings ?= l_value.
    lr_field = lr_field_settings->get_field( 'PRODUCT' ).
    lr_field->if_salv_wd_sort~set_group_aggregation_allowed( ABAP_TRUE ).
    lr_field->if_salv_wd_sort~create_sort_rule( ).
    l_sortrule = lr_field->if_salv_wd_sort~GET_SORT_RULE(  ).
    l_sortrule->set_sort_order( if_salv_wd_c_sort=>sort_order_ascending ).
    l_sortrule->set_group_aggregation( ABAP_TRUE ).
    *...Aggregate Field PRODUCT
    lr_field = lr_field_settings->get_field( 'QTY' ).
    lr_field->if_salv_wd_aggr~create_aggr_rule( ).
    lr_aggr_rule = lr_field->if_salv_wd_aggr~get_aggr_rule(  ).
    lr_aggr_rule->set_aggregation_type( if_salv_wd_c_aggregation=>aggrtype_total ).
    It is working now but my ALV table is not showing all the rows. I have 6 products and it is showing from product 2. But it is calculating grand total and subtotal correctly. I am not able to see the first product row and subtotal for that. Even if I click on the ^ icon in the ALV table below it is not showing all the rows.
    What could be the problem?
    Please help
    Thanks
    Gopal

    did you somehow manage to set the "first visible row" property on table object
    to 2.   Only thing I can think of that could cause this effect.
    Cheers
    Phil

  • InfoPath form load rule is not checking all the rows in form library

    Hi,
    Requirement:
    We have a form library named "HR Annual Review". In the InfoPath form we have two buttons "Save" and "Submit". User is allowed to Save multiple times and only once using Submit button. The file name of form library "HR
    Annual Review" will be stored in the format “<username>+<mm>+<dd>+<yy>.xml”. Say for example, an user named Mike Walt submitted a form then the file name will be as “MikeWalt012314.xml”. If the same user (Mike Walt)
    submits the form and tries to open the form for subsequent edit, then we need to show a view which has an error info saying “The Appraisal is already submitted for the current appraisal cycle”.
    Solution we tried:
    To achieve the above requirement, we tried using InfoPath Form Load and add a rule to check whether the combination of current user name and the year already exists in the filename column of the form library. But the rule we applied is not checking all the
    rows in the form library. The rule is always checking the first row of the form library.
    What we need:
    We need the validation using InfoPath rule or some other way/solution to check whether the combination of current login username and current year file already exists in the form library.
    Thanks in advance.
    Srivignesh J

    Hi Srivignesh,
    Submit button Uses the Main Data connection to submit the data to the list. This is what you are using and naming the file in the format. You can create secondary data submit that will update the exiting item in the list. With this, you don't have to create
    any rules to check all the rows which is also not possible in OOB InfoPath.
    Once you have the two data connection, hide the toolbar from the form and display these two on the button. For The Submit button, apply the rule to hide the button if created by is not empty. For Save button, apply the rule to hide the button if Created
    By is empty. This way, when a new form is created, you will see the Submit button, and when the user have to update the form, they will see Save button. Hope it help.s
    Regards, Kapil ***Please mark answer as Helpful or Answered after consideration***

  • People Picker JS Control not fetching all the users...

    Hi,
    I am using Java Script people picker control. It fetching information for users but not all. I used following code block to get the control working. Why is not fetching all the users?? Where as OOTB people picker fetches same user. This does not make sense.
    My environment is SharePoint online.  
    // Run your custom code when the DOM is ready.
    $(document).ready(function () {
    // Specify the unique ID of the DOM element where the
    // picker will render.
    initializePeoplePicker('peoplePickerDiv');
    // Render and initialize the client-side People Picker.
    function initializePeoplePicker(peoplePickerElementId) {
    // Create a schema to store picker properties, and set the properties.
    var schema = {};
    schema['PrincipalAccountType'] = 'User,DL,SecGroup,SPGroup';
    schema['SearchPrincipalSource'] = 15;
    schema['ResolvePrincipalSource'] = 15;
    schema['AllowMultipleValues'] = true;
    schema['MaximumEntitySuggestions'] = 50;
    schema['Width'] = '280px';
    // Render and initialize the picker.
    // Pass the ID of the DOM element that contains the picker, an array of initial
    // PickerEntity objects to set the picker value, and a schema that defines
    // picker properties.
    this.SPClientPeoplePicker_InitStandaloneControlWrapper(peoplePickerElementId, null, schema);
    Here is the link from Microsoft explaining it.
     How to: Use the client-side People Picker control in SharePoint-hosted apps: https://msdn.microsoft.com/en-us/library/office/jj713593.aspx
    Appreciate any help or workaround here.
    Thanks.

    Hi,
    In my case im usign customize people picker. it is better to use in delelopement since you have the control and customization.
    I have used select2 (https://select2.github.io/examples.html) drop down control and create a people picker
    You can use the same REST call to populate data.
    function initApproversPicker(success, fail) {
                var data = { results: [] };
                var executor = new SP.RequestExecutor($$.getAppWebUrlUrl());
                executor.executeAsync(
      url: $$.getAppWebUrlUrl() + "/_api/web/siteusers",
      method: "GET",
      contentType: "application/json;odata=verbose",
      headers: { "Accept": "application/json; odata=verbose" },
      success: function (dt) {
          $.each(JSON.parse(dt.body).d.results, function (i, ele) {
              data.results.push({ id: ele.Id, text: ele.Title });
          executor.executeAsync(
               url: $$.getAppWebUrlUrl() + "/_api/web/sitegroups",
               method: "GET",
               contentType: "application/json;odata=verbose",
               headers: { "Accept": "application/json; odata=verbose" },
               success: function (dt) {
                   $.each(JSON.parse(dt.body).d.results, function (i, ele) {
                       data.results.push({ id: ele.Id, text: ele.Title });
                   $("#WFApprovers").select2({ data: data, multiple: true });
                   if (success) {
                       success();
               error: function (d, errorCode, errorMessage) {
                   if (fail) {
                       fail();
                   utils.log(errorMessage);
      error: function (d, errorCode, errorMessage) {
          utils.log(errorMessage);
    Melick Rajee http://melick-rajee.blogspot.com

  • SQD3 select options not fetching all the data?

    Hi abapers,
    standard SDQ3 tcode is not fetching all the data?
    In this standard t.code how to find that for different Select-options, different data retrieval queries have been written?
    where to find the select options conditions are written?
    thans in advance

    This could be an issue as ROWTERMINATOR and FIELDTERMINATOR are not well placed.
    Use FORMAT FILE while using BULK INSERT.

  • Is there a way to BULK COLLECT with FOR UPDATE and not lock ALL the rows?

    Currently, we fetch a cursor on a few million rows using BULK COLLECT.
    In a FORALL loop, we update the rows.
    What is happening now, is that we run this procedure at the same time, and there is another session running a MERGE statement on the same table, and a DEADLOCK is created between them.
    I'd like to add to the cursor the FOR UPDATE clause, but from what i've read,
    it seems that this will cause ALL the rows in the cursor to become locked.
    This is a problem, as the other session is running MERGE statements on the table every few seconds, and I don't want it to fail with ORA-0054 (resource busy).
    What I would like to know is if there is a way, that only the rows in the
    current bulk will be locked, and all the other rows will be free for updates.
    To reproduce this problem:
    1. Create test table:
    create table TEST_TAB
    ID1 VARCHAR2(20),
    ID2 VARCHAR2(30),
    LAST_MODIFIED DATE
    2. Add rows to test table:
    insert into TEST_TAB (ID1, ID2, LAST_MODIFIED)
    values ('416208000770698', '336015000385349', to_date('15-11-2009 07:14:56', 'dd-mm-yyyy hh24:mi:ss'));
    insert into TEST_TAB (ID1, ID2, LAST_MODIFIED)
    values ('208104922058401', '336015000385349', to_date('15-11-2009 07:11:15', 'dd-mm-yyyy hh24:mi:ss'));
    insert into TEST_TAB (ID1, ID2, LAST_MODIFIED)
    values ('208104000385349', '336015000385349', to_date('15-11-2009 07:15:13', 'dd-mm-yyyy hh24:mi:ss'));
    3. Create test procedure:
    CREATE OR REPLACE PROCEDURE TEST_PROC IS
    TYPE id1_typ is table of TEST_TAB.ID1%TYPE;
    TYPE id2_typ is table of TEST_TAB.ID2%TYPE;
    id1_arr id1_typ;
    id2_arr id2_typ;
    CURSOR My_Crs IS
    SELECT ID1, ID2
    FROM TEST_TAB
    WHERE ID2 = '336015000385349'
    FOR UPDATE;
    BEGIN
    OPEN My_Crs;
    LOOP
    FETCH My_Crs bulk collect
    INTO id1_arr, id2_arr LIMIT 1;
    Forall i in 1 .. id1_arr.COUNT
    UPDATE TEST_TAB
    SET LAST_MODIFIED = SYSDATE
    where ID2 = id2_arr(i)
    and ID1 = id1_arr(i);
    dbms_lock.sleep(15);
    EXIT WHEN My_Crs%NOTFOUND;
    END LOOP;
    CLOSE My_Crs;
    COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20000,
    'Test Update ' || SQLCODE || ' ' || SQLERRM);
    END TEST_PROC;
    4. Create another procedure to check if table rows are locked:
    create or replace procedure check_record_locked(p_id in TEST_TAB.ID1%type) is
    cursor c is
    select 'dummy'
    from TEST_TAB
    WHERE ID2 = '336015000385349'
    and ID1 = p_id
    for update nowait;
    e_resource_busy exception;
    pragma exception_init(e_resource_busy, -54);
    begin
    open c;
    close c;
    dbms_output.put_line('Record ' || to_char(p_id) || ' is not locked.');
    rollback;
    exception
    when e_resource_busy then
    dbms_output.put_line('Record ' || to_char(p_id) || ' is locked.');
    end check_record_locked;
    5. in one session, run the procedure TEST_PROC.
    6. While it's running, in another session, run this block:
    begin
    check_record_locked('208104922058401');
    check_record_locked('416208000770698');
    check_record_locked('208104000385349');
    end;
    7. you will see that all records are identified as locked.
    Is there a way that only 1 row will be locked, and the other 2 will be unlocked?
    Thanks,
    Yoni.

    I don't have database access on weekends (look at it as a template)
    suppose you
    create table help_iot
    (bucket number,
    id1    varchar2(20),
    constraint help_iot_pk primary key (bucket,id1)
    organization index;not very sure about the create table syntax above.
    declare
      maximal_bucket number := 10000; -- will update few hundred rows at a time if you must update few million rows
      the_sysdate date := sysdate;
    begin
      truncate table help_iot;
      insert into help_iot
      select ntile(maximal_bucket) over (order by id1) bucket,id1
        from test_tab
       where id2 = '336015000385349';
      for i in 1 .. maximal_bucket
      loop
        select id1,id2,last_modified
          from test_tab
         where id2 = '336015000385349'
           and id1 in (select id1
                         from help_iot
                        where bucket = i
           for update of last_modified;
        update test_tab
           set last_modified = the_sysdate
         where id2 = '336015000385349'
           and id1 in (select id1
                         from help_iot
                        where bucket = i
        commit;
        dbms_lock.sleep(15);
      end loop;
    end;Regards
    Etbin
    introduced the_sysdate if last_modified must be the same for all updated rows
    Edited by: Etbin on 29.11.2009 16:48

  • Query from oracle to MySql using dblink fetch all the rows in MySql table

    Hello,
    I am using Heterogeneous connectivity between oracle 10204 to Mysql database.
    I have a database link in the oracle side .
    I am query a table in MySql that have 10 million rows.
    Its doesnt matter if i am running :
    select * from "CDR_Accounts"@mysql where "id"=7675405;
    or
    select * from "CDR_Accounts"@mysql ;
    There is an index on the id column.
    Yet, it seems that the Mysql is feteching all the rows from the table , all the data is transfering to oracle over the dblink , and only after that the requested rows are get back to the client.
    The /etc/odbcinst.ini file is as follow:
    [odbcprd:oracle@odbc /software/oracle]$ cat /etc/odbcinst.ini
    [myodbc3]
    Description             = Mysql connector to mysql version 3.5
    Driver          = /software/oracle/MysqlOdbc/3.52/lib/libmyodbc3-3.51.25.so
    Driver64                = /usr/lib
    Setup           = /software/oracle/MysqlOdbc/3.52/lib/libmyodbc3S-3.51.25.so
    Setup64         = /usr/lib
    UsageCount              = 1
    CPTimeout               = 3600
    CPReuse         = Please advice
    Thanks

    When using a gateway it is always possible that a where clause is not sent to the remote database. This is called post processing and depends on several factors like the used ODBC driver, the columns and its data types but also if you specify certain functions in the where clause.
    The fastest way to see if post processing happens is in Oracle 11g the explain plan for a query. In 10g the plan does not always match the statement sent to the foreign database. Here it would be better to enable gateway tracing and setting the trace level to ON. This will log the statements sent to the foreign database and you can compare what statement was sent with the statement you've tried to execute.

  • RowSetIterator not returning all the rows

    Hi,
    We have a use-case where we need to create a new row iterator to insert rows(values) in it. Immediately after insertRow(), we are reading the values by creating a secondary row set iterator (createRowSetIterator) but it is not returning all the inserted rows. Here is the code snippet:
    Code to insert rows:
    public void insertTerrLineOfBusiness(CreateOperation operation, TerritoryVORowImpl newTerritoryRow, TerritoryVORowImpl selectedRow){     
    if((operation.equals(CreateOperation.CREATE))
    || operation.equals(CreateOperation.COPY)
    || operation.equals(CreateOperation.ADD_EXISTING)){
    RowIterator selTerritoryLineOfBusinessIter = selectedRow.getTerritoryLineOfBusiness();
    //RowIterator newTerrLineOfBusinessIter = newTerritoryRow.getTerritoryLineOfBusiness();
    ViewRowSetImpl newTerrLineOfBusinessIter = (ViewRowSetImpl) newTerritoryRow.getTerritoryLineOfBusiness();
    newTerrLineOfBusinessIter.setAssociationConsistent(true);
    while(selTerritoryLineOfBusinessIter.hasNext()){
    TerritoryLineOfBusinessVORowImpl selTerrLineOfBusinessRow =
    (TerritoryLineOfBusinessVORowImpl)selTerritoryLineOfBusinessIter.next();
    TerritoryLineOfBusinessVORowImpl newTerrLineOfBusinessRow =
    (TerritoryLineOfBusinessVORowImpl)newTerrLineOfBusinessIter.createRow();
    newTerrLineOfBusinessRow.setTerritoryVersionId(newTerritoryRow.getTerritoryVersionId());
    newTerrLineOfBusinessRow.setLobCode(selTerrLineOfBusinessRow.getLobCode());
    newTerrLineOfBusinessIter.insertRow(newTerrLineOfBusinessRow);
    Code to read:
    public List getTerritoryLobsValues() {
    List <String> lobsValues = new ArrayList<String>();
    if (this.getTerritory().getCurrentRow() != null) {
    TerritoryVORowImpl territoryVORowImpl =
    (TerritoryVORowImpl)this.getTerritory().getCurrentRow();
    if(territoryVORowImpl.getTerritoryLineOfBusiness() != null){
    ViewRowSetImpl territoryLob =
    (ViewRowSetImpl)territoryVORowImpl.getTerritoryLineOfBusiness();
    RowSetIterator itr = territoryLob.createRowSetIterator(null);
    if(itr!=null){
    while(itr.hasNext()) {
    Row r = itr.next();
    String lobCode = (String)r.getAttribute("LobCode");
    lobsValues.add(lobCode);
    itr.closeRowSetIterator();
    return lobsValues;
    Can anybody suggest what could be the issue? How to fix it?
    Thanks,
    Akhila

    Thanks for your response.
    Jdev version:
    Primary == FUSIONAPPS_PT.V1REL6INT_LINUX.X64_120719.0800 (Primary Product for the view)
    Primary depends on FMWTOOLS == FMWTOOLS_11.1.1.6.0_GENERIC_120112.0037.2
    FMWTOOLS depends on label == JDEVADF_11.1.1.6.0_GENERIC_111205.1733.6192.1
    The above label originated from base label == JDEVADF_11.1.1.6.0_GENERIC_111205.1733.6192
    Use case: We have a tree table, each record may or may not have Line of Business(LOB) associated with it. On creating a child node in the tree table, the child node copies all the attributes of parent. These attributes are not committed explicitly, if user wants to save the child node only then the attributes are committed.
    Giving secondary rowSetIterator a name did not help in resolving this issue.
    If I am calling postChanges() before reading from secondary row iterator then its returning all the inserted values. But this.getTransaction().postChanges() is a JAudit violation, so cannot use it:
    RuleId: apps-jbo-category.File.AdfModel.54
    Rule: insertTerrLineOfBusiness - Review DBTransaction.postChanges call to ensure passivation-safety
    Any pointers on this?

  • Sharepoint List of action plan not load all the rows,

    hello
    we are using sharepoint 2010 , we are facing problem in loading list_of_action_plan that not load all the raws (data)in datasheet view, but in standard view its loads all the data,
    can some one helps in this problem
    We have one separate virtual machine  SQL server 2005 for sharepoint server.  also we check that SQL server instance use more CPU usages.

    Hi,
    According to your post, my understanding is that one of your custom columns could not be copied using the copy list item action.
    I had created a custom field using the URL type, then add the column into the list.
    Using the SharePoint Designer to create a custom workflow with the copy list item action.
    The workflow worked without any issue, it can copy the custom URL type field.
    Did the issue occur in other list? You can create a new list, add the custom field to the list, then just using the copy list item to check whether it works.
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

  • Report not displaying all the rows

    Hi Experts,
    We are having a report which when ran for a year as a filter criteria gives me 6725 rows and i also observe that there are more rows which are not getting displayed. Is there any restriction with the no of rows getting displayed. I am also able to find the specific information of a particular vendor when i explicitly filter it. Which would otherwise not get displayed in the normal report execution for the entire year. Thanks
    Warm Regards,
    Akilesh

    Hello Akilesh,
             This is the issue with your Bex Analyzer...! please update ur Bex with all the latest patches. I am sure this report sould be running on other mechines...
    I will try to find the concern patch in t he mean while..!
                   EnjoySAP

  • Entity based VO not showing all the rows

    Hi, I am having a entity based VO in a page. When we run a page from Jdeveloper the table shows all 1300 rows. But in Front end it shows onli 1001 rows

    Hi ,
    Or instead of setMaxFetchsize see By Johny  explain setAttribute in OAF?
    if it is helpful to you..

  • Discover Plus - Export to Text Tab delimited is not exporting all the rows

    Hi gurus,
    I am trying to export a large data report which has 1 million plus rows to text tab delimited. The export takes 9 plus hours to export and the data is not more than 100000.
    My question is
    1. How can I make the discoverer to export it quicker or rather faster to tab delimited.
    2. Where can I change the number of rows to be exported.
    Any help, suggestions is appreciated.
    Thanks,
    SAI

    Hi Rod,
    Yes. The text tab delimited export is taking lot of time. The total rows for this report are nearly 1 million. If I break down the report with condition and export it I was able to export it ( three files exported with 212000, 103000 and 687000 rows respectively).
    But I m still having problems exporting it in one shot. Is there any way I could resolve this? Please let me know.
    Thanks,
    SAI

  • Lookup in transformation not fetching all records

    Hi Experts,
    In the routine of the transformation of a DSO (say DSO1), i have written a look-up on other DSO (say DSO2) to fetch records. I have used all the key fields of DSO2  in the Select statement, Still the look-up is not fetching all the records in DSO1. There is difference in the aggregated value of the Key Figure of both the DSOs. Please suggest, how can i remove this error.
    Thanks,
    Tanushree

    hi tanushree,
    The code which yu have written in the field routine for lookup is not fetching the data. you can debug the field routine code in the simulation mode of execution of DTP by keeping a break point after the transformation.
    you can test the routine with out actually loading the data..
    double click rule where you have routine and in the below you have option called test routine.
    here you can pass input parameters..
    i hope it will give you an idea.
    Regards
    Chandoo7

  • Not able to download all the rows to excel sheet from alv grid display

    Hi experts,
    I am not able to download all the rows which are displayed in alv grid display for some material numbers.
    for some materials i am able to download, i used two ways to download 1) from icon(local file) on grid 2) menu list->export.
    i checked in debugging till selecting the spread sheet pop up window, i am able to see all the data in internal table.
    Can you suggest me what will be the problem....
    thanks in advance,

    hi sandeep,
    sorry for didnt specify clearly.
    note: EX: "asaasdada  in this sentence i said  " this symbol is special character not the text.
    building final internal table code
    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
        EXPORTING
          capid                 = p_capid
          datuv                 = sy-datum
          ehndl                 = '1'
          mktls                 = 'X'
          mehrs                 = 'X'
          mmory                 = '1'
          mtnrv                 = p_matnr
          stlal                 = '1'
          stpst                 = 0
          svwvo                 = 'X'
          werks                 = p_werks
          vrsvo                 = 'X'
        TABLES
          stb                   = i_stb
        EXCEPTIONS
          alt_not_found         = 1
          call_invalid          = 2
          material_not_found    = 3
          missing_authorization = 4
          no_bom_found          = 5
          no_plant_data         = 6
          no_suitable_bom_found = 7
          conversion_error      = 8
          OTHERS                = 9.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      i_stb1[] = i_stb[].
      IF NOT i_stb1[] IS INITIAL.
        SORT i_stb1 BY idnrk.
        DELETE ADJACENT DUPLICATES FROM i_stb1 COMPARING idnrk.
        SELECT bmatn ematn FROM ampl INTO TABLE i_ampl
          FOR ALL ENTRIES IN i_stb1
          WHERE bmatn = i_stb1-idnrk AND
                datuv LE sy-datum AND                          
                datub GE sy-datum.                              
        SELECT
        matnr
        bwkey
        verpr
        stprs
        bwprh
        FROM mbew
        INTO TABLE i_mbew
        FOR ALL ENTRIES IN i_stb1
        WHERE
            matnr EQ i_stb1-idnrk AND
            bwkey EQ i_stb1-werks.
        IF NOT i_stb1[] IS INITIAL.
          SELECT matnr werks beskz
                 dzeit webaz plifz                              
                 ekgrp                                         
          INTO TABLE i_marc
          FROM marc
          FOR ALL ENTRIES IN i_stb1
          WHERE matnr = i_stb1-idnrk
          AND werks = i_stb1-werks.
          SORT i_marc BY matnr werks.
        ENDIF.
        CLEAR i_ekpo.
        CLEAR i_vend.
        IF NOT i_stb1[] IS INITIAL.
          SELECT ebeln ebelp matnr werks loekz aedat
                 netpr peinh                                   
          INTO TABLE i_ekpo
          FROM ekpo
                FOR ALL ENTRIES IN i_stb1
                WHERE matnr = i_stb1-idnrk
                AND werks = i_stb1-werks.
          SORT i_ekpo BY matnr ASCENDING
                         aedat DESCENDING
                         ebeln DESCENDING
                         ebelp DESCENDING.
          IF NOT i_ekpo IS INITIAL.
            SELECT k~ebeln k~lifnr l~name1
            INTO TABLE i_vend
            FROM ekko AS k INNER JOIN lfa1 AS l
            ON k~lifnr EQ l~lifnr
            FOR ALL ENTRIES IN i_ekpo
            WHERE ebeln = i_ekpo-ebeln.
            SORT i_vend BY ebeln.
          ENDIF.
        ENDIF.
      ENDIF.
      i_ampl1[] = i_ampl[].
      IF NOT i_ampl1[] IS INITIAL.
        SORT i_ampl1 BY ematn.
        DELETE ADJACENT DUPLICATES FROM i_ampl1 COMPARING ematn.
        SELECT matnr mfrpn mfrnr FROM mara INTO TABLE i_mara
          FOR ALL ENTRIES IN i_ampl1
           WHERE matnr = i_ampl1-ematn.
      ENDIF.
      SORT i_ampl BY bmatn.
      IF NOT i_stb[] IS INITIAL.
        SELECT stlty stlnr stlkn stpoz idnrk potx1 potx2
        INTO TABLE i_stpo
        FROM stpo
        FOR ALL ENTRIES IN i_stb
        WHERE stlty = i_stb-stlty
          AND stlnr = i_stb-stlnr
          AND stlkn = i_stb-stlkn
          AND stpoz = i_stb-stpoz
          AND idnrk = i_stb-idnrk.
        SORT i_stpo BY stlty stlnr stlkn stpoz idnrk.
      ENDIF.
      LOOP AT i_stb INTO wa_stb.
        READ TABLE i_marc INTO wa_marc
        WITH KEY     matnr = wa_stb-idnrk
                     werks = wa_stb-werks
                     BINARY SEARCH.
        IF sy-subrc = 0.
          wa_outtab-beskz = wa_marc-beskz.
          wa_outtab-dzeit = wa_marc-dzeit.                      
          wa_outtab-webaz = wa_marc-webaz.                     
          wa_outtab-plifz = wa_marc-plifz.                     
          wa_outtab-ekgrp = wa_marc-ekgrp.                     
        ENDIF.
        READ TABLE i_ekpo INTO wa_ekpo
            WITH KEY matnr = wa_stb-idnrk.
        IF sy-subrc = 0.
          wa_outtab-netpr = wa_ekpo-netpr.                     
          wa_outtab-peinh = wa_ekpo-peinh.                     
          READ TABLE i_vend INTO wa_vend
          WITH KEY ebeln = wa_ekpo-ebeln
                   BINARY SEARCH.
          IF sy-subrc = 0.
            wa_outtab-lifnr = wa_vend-lifnr.
            wa_outtab-name_sup = wa_vend-name1.
          ENDIF.
        ENDIF.
        READ TABLE i_stpo INTO wa_stpo
        WITH KEY stlty = wa_stb-stlty
                 stlnr = wa_stb-stlnr
                 stlkn = wa_stb-stlkn
                 stpoz = wa_stb-stpoz
                 idnrk = wa_stb-idnrk
                 BINARY SEARCH.
        IF sy-subrc = 0.
          wa_outtab-potx1 = wa_stpo-potx1.
          wa_outtab-potx2 = wa_stpo-potx2.
        ENDIF.
        READ TABLE i_mbew INTO wa_mbew
        WITH KEY
        matnr = wa_stb-idnrk
        bwkey = wa_stb-werks.
        IF sy-subrc IS INITIAL.
          MOVE:
          wa_mbew-verpr TO wa_outtab-verpr,
          wa_mbew-stprs TO wa_outtab-stprs,
          wa_mbew-bwprh TO wa_outtab-bwprh.
        ENDIF.
        wa_outtab-matnr = p_matnr.
        wa_outtab-posnr = wa_stb-posnr.
        wa_outtab-stufe = wa_stb-stufe.
        wa_outtab-idnrk = wa_stb-idnrk.
        wa_outtab-ojtxb = wa_stb-ojtxp.
        wa_outtab-menge = wa_stb-menge.
        wa_outtab-meins = wa_stb-meins.
        MOVE: wa_stb-zzitem_draw_no TO wa_outtab-zzitem_draw_no.
        IF wa_stb-upskz = 'X'.
          SELECT * FROM stpu INTO TABLE i_stpu
                   WHERE  stlty = wa_stb-stlty AND
                          stlnr = wa_stb-stlnr AND
                          stlkn = wa_stb-stlkn AND
                          stpoz = wa_stb-stpoz.
        ENDIF.
        LOOP AT i_stpu INTO wa_stpu.
          wa_outtab-upmng = wa_stpu-upmng.
          wa_outtab-ebort = wa_stpu-ebort.
          wa_outtab-uposz = wa_stpu-uposz.
          CONCATENATE v_ebort wa_stpu-ebort      INTO v_ebort
          SEPARATED BY space.
        ENDLOOP.
        MOVE strlen( v_ebort ) TO v_len.
        MOVE: 0 TO x,
          128 TO y.
        DATA : lt_tab TYPE TABLE OF swastrtab.
        DATA : ls_tab LIKE LINE OF lt_tab.
        DATA : lv_ebort TYPE string.
        CLEAR lv_ebort. CLEAR lt_tab.
        MOVE v_ebort TO lv_ebort.
        CALL FUNCTION 'SWA_STRING_SPLIT'
          EXPORTING
            input_string                 = lv_ebort
            max_component_length         = 128
          TABLES
            string_components            = lt_tab
          EXCEPTIONS
            max_component_length_invalid = 1
            OTHERS                       = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        IF lt_tab[] IS NOT INITIAL.
          LOOP AT lt_tab INTO ls_tab.
            CLEAR lv_ebort.
            MOVE: ls_tab-str TO lv_ebort.
            CONDENSE lv_ebort.
            MOVE lv_ebort TO wa_outtab-ebort.
            APPEND wa_outtab TO i_outtab.
            CLEAR:
            wa_outtab-matnr,
            wa_outtab-posnr,
            wa_outtab-zzitem_draw_no,
            wa_outtab-ojtxb,
            wa_outtab-menge,
            wa_outtab-meins,
            wa_outtab-uposz,
            wa_outtab-upmng,
            wa_outtab-verpr,
            wa_outtab-stprs,
            wa_outtab-bwprh,
            wa_outtab-lifnr,
            wa_outtab-name_sup,
            wa_outtab-potx1,
            wa_outtab-potx2,
            wa_outtab-netpr,
            wa_outtab-peinh.
    *        wa_outtab-idnrk.
          ENDLOOP.
        ELSE.
          APPEND wa_outtab TO i_outtab.
        ENDIF.
        CLEAR v_ebort.
        CLEAR: wa_stpu.
        REFRESH: i_stpu.
        LOOP AT i_ampl INTO wa_ampl WHERE bmatn = wa_stb-idnrk.
        READ TABLE i_mara INTO wa_mara WITH TABLE KEY matnr = wa_ampl-ematn.
          IF sy-subrc = 0.
            LOOP AT i_outtab INTO wa_outtab
            WHERE
            idnrk = wa_stb-idnrk AND
            flag NE 'X'.
              wa_outtab-mfrpn = wa_mara-mfrpn.
              wa_outtab-mfrnr = wa_mara-mfrnr.
              SELECT SINGLE name1 FROM lfa1 INTO wa_outtab-name1 WHERE lifnr = wa_mara-mfrnr.
              MOVE 'X' TO wa_outtab-flag.
              MODIFY i_outtab FROM wa_outtab
              TRANSPORTING mfrpn mfrnr name1 flag.
              EXIT.
            ENDLOOP.
            IF sy-subrc <> 0.
              CLEAR:
              wa_outtab-matnr,
              wa_outtab-posnr,
              wa_outtab-zzitem_draw_no,
              wa_outtab-ojtxb,
              wa_outtab-ebort,
    *          wa_outtab-idnrk,
              wa_outtab-menge,
              wa_outtab-meins,
              wa_outtab-uposz,
              wa_outtab-upmng,
              wa_outtab-verpr,
              wa_outtab-stprs,
              wa_outtab-bwprh,
              wa_outtab-lifnr,                                 
              wa_outtab-name_sup,                              
              wa_outtab-potx1,                                 
              wa_outtab-potx2,                                 
              wa_outtab-netpr,                                 
              wa_outtab-peinh.                                 
              wa_outtab-mfrpn = wa_mara-mfrpn.
              wa_outtab-mfrnr = wa_mara-mfrnr.
              SELECT SINGLE name1 FROM lfa1 INTO wa_outtab-name1 WHERE lifnr = wa_mara-mfrnr.
              APPEND wa_outtab TO i_outtab.
            ENDIF.
          ENDIF.
          REFRESH i_stpu.
          CLEAR i_stpu.
        ENDLOOP.    CLEAR: wa_matnr1, wa_mfrnr, wa_outtab.
      ENDLOOP.
    Edited by: srinivasareddy j on Mar 9, 2011 7:16 AM
    Edited by: srinivasareddy j on Mar 9, 2011 7:20 AM

  • AP PAYABLES- Not getting all the DUE DATE's in with split schedule payments

    Hello All,
    We have some issues with AP Data loading's into our DW from EBS 11.5.10 AP - PAYABLES.
    One of our customer is using split schedule and share payment into few payment. Our
    sql is not reading all the due dates for PAYABLES.
    We are using PAYMENT_NUM=1 from ap_payment_schedules_all table as condition to load the Data to avoid duplicate rows coming for Payables.
    Some hints: removing the "PAYMENT_NUM=1" from the where clause gives all the due_dates but then we have duplicate rows for Payables.
    Please help to modify our query so that it will work for split schedule payment.
    select
    inv.invoice_num,
    inv.doc_sequence_value,
    sob.currency_code,
    inv.invoice_date,
    'EH'||inv.vendor_id vendor_id,
    'EH'||inv.vendor_site_id vendor_site_id,
    ael.ae_line_number distribution_line_number,
    inv.invoice_currency_code,
    aeh.accounting_date,
    'EH'||ael.code_combination_id code_combination_id,
    nvl(ael.entered_dr,0)-nvl(ael.entered_cr,0) accounted,
    nvl(ael.accounted_dr,0)-nvl(ael.accounted_cr,0) amount,
    fuser.user_name,
    fuser2.user_name user_name2,
    inv.payment_status_flag,
    'PAYABLES' rowtype,
    inv.discount_amount_taken,
    inv.invoice_type_lookup_code invoice_type,
    inv.exchange_rate,
    inv.exchange_date,
    tax.name,
    inv.source,
    inv.attribute6 eflow_doc_id,
    sysdate transfer_date,
    sch.hold_flag,
    inv.cancelled_date,
    sch.due_date
    from
    ap.ap_invoices_all inv,
    apps.ap_ae_headers_all aeh,
    apps.ap_ae_lines_all ael,
    ap.ap_tax_codes_all tax,
    ap.ap_payment_schedules_all sch,
    gl.gl_sets_of_books sob,
    applsys.fnd_user fuser,
    applsys.fnd_user fuser2
    where
    aeh.ae_header_id=ael.ae_header_id and
    inv.set_of_books_id=sob.set_of_books_id and
    inv.invoice_id=sch.invoice_id and
    sch.payment_num*1=1 and ---------------------------------------------- *
    fuser.user_id=inv.last_updated_by and
    fuser2.user_id=inv.created_by and
    ael.tax_code_id=tax.tax_id(+) and
    ael.ae_line_type_code='LIABILITY' and
    inv.invoice_id=ael.source_id and
    ael.source_table='AP_INVOICES' and
    aeh.gl_transfer_flag='Y'
    Thanks,
    Aman

    Hello All,
    We have some issues with AP Data loading's into our DW from EBS 11.5.10 AP - PAYABLES.
    One of our customer is using split schedule and share payment into few payment. Our
    sql is not reading all the due dates for PAYABLES.
    We are using PAYMENT_NUM=1 from ap_payment_schedules_all table as condition to load the Data to avoid duplicate rows coming for Payables.
    Some hints: removing the "PAYMENT_NUM=1" from the where clause gives all the due_dates but then we have duplicate rows for Payables.
    Please help to modify our query so that it will work for split schedule payment.
    select
    inv.invoice_num,
    inv.doc_sequence_value,
    sob.currency_code,
    inv.invoice_date,
    'EH'||inv.vendor_id vendor_id,
    'EH'||inv.vendor_site_id vendor_site_id,
    ael.ae_line_number distribution_line_number,
    inv.invoice_currency_code,
    aeh.accounting_date,
    'EH'||ael.code_combination_id code_combination_id,
    nvl(ael.entered_dr,0)-nvl(ael.entered_cr,0) accounted,
    nvl(ael.accounted_dr,0)-nvl(ael.accounted_cr,0) amount,
    fuser.user_name,
    fuser2.user_name user_name2,
    inv.payment_status_flag,
    'PAYABLES' rowtype,
    inv.discount_amount_taken,
    inv.invoice_type_lookup_code invoice_type,
    inv.exchange_rate,
    inv.exchange_date,
    tax.name,
    inv.source,
    inv.attribute6 eflow_doc_id,
    sysdate transfer_date,
    sch.hold_flag,
    inv.cancelled_date,
    sch.due_date
    from
    ap.ap_invoices_all inv,
    apps.ap_ae_headers_all aeh,
    apps.ap_ae_lines_all ael,
    ap.ap_tax_codes_all tax,
    ap.ap_payment_schedules_all sch,
    gl.gl_sets_of_books sob,
    applsys.fnd_user fuser,
    applsys.fnd_user fuser2
    where
    aeh.ae_header_id=ael.ae_header_id and
    inv.set_of_books_id=sob.set_of_books_id and
    inv.invoice_id=sch.invoice_id and
    sch.payment_num*1=1 and ---------------------------------------------- *
    fuser.user_id=inv.last_updated_by and
    fuser2.user_id=inv.created_by and
    ael.tax_code_id=tax.tax_id(+) and
    ael.ae_line_type_code='LIABILITY' and
    inv.invoice_id=ael.source_id and
    ael.source_table='AP_INVOICES' and
    aeh.gl_transfer_flag='Y'
    Thanks,
    Aman

Maybe you are looking for