Looping over 1 document to fetch multiple invoices using "Appending"

Hi gurus ,
             I'm facing a peculiar problem where in , i use the code -
  SELECT KUNNR REBZG BUDAT DMBTR gjahr XBLNR HKONT UMSKZ SHKZG AUGGJ REBZJ AUGBL
     FROM BSAD
    APPENDING CORRESPONDING FIELDS OF TABLE I_BSAD_CL
    FOR ALL ENTRIES IN I_BSAD
     WHERE kunnr IN s_kunnr
         AND   bukrs EQ p_bukrs
         AND   AUGGJ EQ i_bsad-auggj
         AND   AUGBL EQ I_BSAD-belnr
         AND   shkzg EQ 'S'
     AND ( UMSKZ EQ 'A'
         OR    UMSKZ EQ 'M'
         OR    UMSKZ EQ ' ' ).
There are 2 internal tables -
I_BSAD
I_BSAD_CL
I need to fetch multiple Invoice documents (REBZG) from BSAD table and place it in I_BSAD_CL , w.r.t. to the document numbers (BELNR) in I_BSAD internal table.
( There can be a scenario where in there r 5 invoices for 1 document number as well ).
So, to perform the task I use "appending corresponding fields of table" and "for all entries" .
Do u ppl have any other option by which i complete this task ? Because this code takes a while to execute in case of heavy data .
Thanks and Regards ,
Prithvi.
Edited by: Prithvi  Sridhar on Jun 26, 2009 1:13 PM

>
Rui Pedro Dantas wrote:
> Ok, then it is using the index we want.
> I just noticed that in your original code you have "IN s_kunnr" in the 2nd query, when it should be  "= I_BSAD-KUNNR" (after getting each clearing document, you already know the customer for the corresponding cleared document).
>
> Have you changed that along the way?
> Maybe you can post the code you have at this moment?
>
> Anyway, your original question was about making only one query by joining the two tables, and yes, that would be of course possible.
Oh yeah ! I can also use I_BSAD-KUNNR instead of S_KUNNR. I did the same for BUKRS as well.
Here's my fresh code -
SELECT kunnr belnr budat dmbtr augbl rebzg gjahr XBLNR HKONT BUDAT AUGDT UMSKZ SHKZG AUGGJ REBZJ PSWSL BUZEI bukrs
         FROM BSAD
         INTO CORRESPONDING FIELDS OF TABLE I_BSAD
         WHERE kunnr IN s_kunnr
         AND   bukrs EQ p_bukrs
         AND   gjahr EQ p_gjahr
         AND   budat IN s_budat
*         AND   shkzg EQ 'S'
         AND   blart EQ 'DZ'
         AND ( UMSKZ EQ 'A'
         OR    UMSKZ EQ 'M'
         OR    UMSKZ EQ ' ' )
         AND   HKONT NE '241000'
         AND   HKONT NE '241010'
         AND   HKONT NE '241020'.
*MULTIPLE INVOICES(CLEARED)
IF I_BSAD[] IS NOT INITIAL .
  SELECT KUNNR BELNR BUDAT  gjahr XBLNR HKONT UMSKZ SHKZG AUGGJ REBZJ AUGBL BUZEI
     FROM BSAD
    INTO CORRESPONDING FIELDS OF TABLE I_BSAD_CL
    FOR ALL ENTRIES IN I_BSAD
     WHERE kunnr eq i_bsad-kunnr
         AND   bukrs EQ I_BSAD-bukrs
         AND   AUGGJ EQ i_bsad-auggj
         AND   AUGBL EQ I_BSAD-belnr
         AND   PSWSL EQ I_BSAD-PSWSL
*         AND  ( GJAHR EQ I_BSAD-AUGGJ OR GJAHR EQ I_BSAD-GJAHR )
*        AND  BUDAT EQ I_BSAD-AUGDT
*         AND   AUGDT EQ I_BSAD-BUDAT
         AND   shkzg EQ 'S'
     AND ( UMSKZ EQ 'A'
         OR    UMSKZ EQ 'M'
         OR    UMSKZ EQ ' ' ).

Similar Messages

  • Fetch multiple records using Native SQL

    Hello All,
    I am trying to fetch data from an external database which is an oracle sysrtem.
    I am currenty using cursor method to fetch the data.
    The "fetch next cursor1" only bring 1 record at a time. And it is taking more than 20 mins to bring 1 record, it seems the table i am fetching has more than 12 million records.
    Can someone please answer these 2 questions:
    1) If is have oracle commands to query their tables, can i use them directly between the EXEC SQL   and  ENDEXEC.
       When i put a semicolon its giving error. Oracle statements end with semicolon.
    2) There must be a way of fetching a set of records at one go from external system. Does anyone know the technique.
    I appreciate your help.

    Hi,
    Check if this is useful in your case.
    See here SDB_ADBC - the program
    I am using there:
    cl_sql_connection
    cl_sql_statement
    cl_sql_result_set
    cx_sql_exception
    Regards.

  • Fetch multiple rows using cross-join technique

    Hello.
    Can anyone suggest a method to return 3 rows from a query when only one row would otherwise be returned?
    I'm trying to achieve the Logical SQL analog to this -
    SELECT x.foo, p.id, p.name FROM people p CROSS JOIN (SELECT 1 AS foo UNION ALL SELECT 2 UNION ALL SELECT 3) x;Reason: I want to force a three (n) row result and use GROUP BY with case statements to create 3-level summary.
    Here is a simple Logical SQL expression that works for my OBI setup -
    SELECT
         "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number saw_0,
         "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".SR_Operating_Unit_Name saw_1
    FROM
         "[Noetix-NoetixGlobalRepository] NoetixViews for Oracle Service"     
    WHERE
         ("- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number = '338246')But I think I cannot do this -
    SELECT
         "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number saw_0,
         "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".SR_Operating_Unit_Name saw_1
    FROM
         "[Noetix-NoetixGlobalRepository] NoetixViews for Oracle Service"
         CROSS JOIN (SELECT 1 AS foo UNION ALL SELECT 2 UNION ALL SELECT 3)
    WHERE
         ("- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number = '338246')But what can I do?
    Thank you.
    -cs

    Hi CSeelig ,
    The BI Server uses the ANSI SQL standard. Then all SQL that follows this specification will in OBIEE work.
    I have made an example with a densification:
    http://gerardnico.com/wiki/dat/obiee/logical_sql/obiee_sql_densification
    You will see a cross join to make a densification.
    Cheers
    Nico

  • Multiple Invoices for a Invoice Document Number

    Hi BW Gurus I need your help and quick hint, I have a purchasing cube that recieve the data from 2lis_02_itm and fiap line item ofi_gl_4 which is document item purchasing and account payable, problem is report is showing the PO number and Invoice number and amount, but amount is total of multiple invoice but report only display the invoice number of least invoice amount instead of showing all the invoice numbers so I built the RRI but now problem is how ill the user know that Invoice number in display has multiple invoices and its not the all invoice numbers so he need to use rri, please tell if there is any counter field or any way we can identify the that the invoice number has multiple invoices
    please help
    Soniya

    Hi,
    Did you find any answers for this.
    Thanks & Regards

  • Fetch multiple A/P Reserve Invoices in Goods Receipt PO

    Hi Experts
    Can we fetch multiple A/P Reserve Invoices in one GRPO , or SDK can help to do this?

    Hi Zubair.......
    If based on PO you are doing more than one Advance Payment say first 30% of Total, second 20% of remaining total and third 10% or remaining total before GRPO then such Reserved invoices you can select at a time in one GRPO which is nothing but selection of Multiple AP Reserve Invoices if am not wrong.
    Is that your requirement?
    Regards,
    Rahul

  • Clear Multiple invoices document against single payment amount frm customer

    Dear Experts,
    There is a requirement in the business process like we file multiple invoices to customer account and he pays the amount in single payment. So what we need here is to clear all the invoice document in customer account against that payment.
    Please tell is there anyway to achieve it at FI level.
    Best Regards
    Arun Rai

    Hi,
    You can clear them by defining clearing rules in OB74 for customer account type D. You should have your customer posting for collection based on a defined criteria based on some assignment number or something else that you will give in OB74..Based on the criteria that you will specify in OB74 system will match the open item invoices against their payment document and clear them accordingly. e.g you give assignment number  ZUONR in OB74 for clearing criteria..It means that all of your invoices should have the same assignment number in Invoices as of the assignment number entered in Collection or payment document. Afterward you can clear customer in F.13 ..
    I hope this will help you.
    Regards
    Edited by: Atif Farooq on Oct 18, 2011 11:38 AM

  • Cancel multiple invoice documents

    Dear All,
    when iam cancel single document in vf11 it is cancelled sucessfully,the cancel document date also coming correctly, but my issue is when iam doing cancel multiple invoice documents that time the cancel document date is not taking the latest date, please help me in this issue ...iam using the below code ....
    include name:MV60AF0V_VBRK_UNTERLEGEN
    FORM VBRK_UNTERLEGEN
    ENHANCEMENT 71  ZSD_BILLING_DT_DEF
    if sy-tcode = 'VF11'.
    data : l_index TYPE sy-tabix,
              l_check(1) type c.
    select single CHK from ZCONFIG into l_check
    where ZCONFIGOB eq 'ALLOWBKINV'.
    if sy-subrc eq 0.
      if l_check eq 'Y'.
      else.
        if sy-tcode = 'VF11'.
          if ( XVBRK-FKART = 'S1' OR XVBRK-FKART = 'IVS' ) .
             XVBRK-FKDAT = sy-datum.
          endif.
         l_index = XVBRK_TABIX_AKTUELL - 1.
         modify xvbrk INDEX l_index.
       endif.
    endif.
    endif.
    endif.
    Regards
    suni

    HI,
    Have you checked in debug that after entring the documents , is the part of your code triggered ? If yes then check tat in debug why it is not updating the sy-datum. I think the index is giving the problem check in debug you will find the solution .
    Regards,
    Madhukar Shetty

  • APP - F110 - Payment of multiple invoices with different document type

    Hi
    Vendor X has been assigned with payment method same with two document types. One document type got 4 invoices and other document type got 1 invoice.
    During payment run (F110) for each document type, the system picked up both the document type but listed them as two separate lines in the proposal list. When we process the payment the system also created two payment documents.
    Is there a way for these two document types to be processed as a single proposal and payment.
    Any suggestion how can we process these invoices together in a single proposal/payment document?
    Thanks & Regards,
    Sam

    Thanks

  • Excise invoice Print for multiple invoices

    Hi All ,
    i have developed a z smartform and attached to standard tcode J1IP o/p type J1I0 . The o/p is comming fine when i select one excise no after excecuting tcode J1IP But if selected multiple invoices by checking the checkbox and press print preview or print
    button each time it is giving print preview/print diaog. i.e i need to execute print for first invoice and again i have to come back and again it will ask print prview/print dialog for second like wise n times for n no of selected documents .
    my requirement is like when i execute tcode J1Ip and when i select multiple invoice i should get only one print preview or print dialog for all documents . how to achieve this

    HI friend,
    Its simple.
    Put all the invoices in a single loop. I think you will be calling the smartform function module for each and every invoice. Don't do like that. Just collect all the invoices in the final table first and after that display the invoices.
    I think you can understand what i am saying.
    Please try and let me know if you have any queries i will help you.
    Thanks,
    Sri Hari

  • Single Supplimentary Invoice for Multiple Invoices

    Hi
    We are having Standardmanufacturing sales Process
    Ex: We did the sales of 1000 quantity of  goods over the period of time for Price  100 Rs/ and we had created invoices also in the system .After 3 months with the customer on mutual undersating we have decided to hike the price  110 Rs on excisting sales, Now i want to create Single Supplimentary invoice for multiple Invoices for the hiked amount 10,000 Rs( 1000 *10=10,000) along with Excise duties.
    Please help me out to map this senario in sap
    Thanks
    Mujubur
    09967919351
    Edited by: mujubur shaik on Nov 9, 2009 8:06 AM

    Dear Mujubur,
    It is generic feature of a business that price is changed for various reasons. So excise accounting is adjusted corresponding it.
    What you do, please create a debit memo request which is a sale order type document by VA01 with reference of all commercial inovices against which you want to create the single supplementory invoice. Then create a debit memo which is a bimming document by VF01 with reference of that debit memo reuest and do the release to accounting.
        Then part A/C will be debited and all other corresponding accounts with Excise provision A/C will be creadited. Now create a billing type as proforma invoice (Bill category U) in configuration and mainatin the copy control from debit memo document type.
    It is better to do the configuration first. Then create the proforma invoice with reference of that debit memo. It will be like a image document of the debit memo. Then create excise invoice by J1IIN with refernce of that proforma invoice with different number series if you want tom maintain. Then excise account will take place -  Ex provision Dr ,  ED payable Cr. That Excise document is  your desired supplementory excise invoice. It will also come in the scope of excise utilisation in J2IUN. The proforma invoice is to be created other wise excise document with transaction type DLFC will not vecreated as it creates only from proforma inovice , not from any other type of billing document.
        Don't go for Excise JV. Apparemntly it is seemed that will be easier but your accounting will be wrong and there will be no track of data which will lead a problem for long run.
    Please do it.  If more help required then inform. I have implemedted the same process.
    Hope this will serve your purpose.
    Regards
    Indranil

  • Generate Multiple Invoices in One PDF

    Hi,
    I have requirement whereby I need to generate multiple invoices in one PDF file. I am using Oracle BI Publisher with Oracle APEX 4.0.2
    If there is only one invoice that needs to be generated in one PDF file then I already have the solution whereby I print the APEX page item session state values on Invoice Header and get the invoice line items from a SQL Query in my RTF template.
    However how to the do the same when multiple invoice needs to be generated in one single PDF file ?
    Any pointers will highly appreciated.
    Thanks & Regards,
    Ashish

    asagarwal wrote:
    However how to the do the same when multiple invoice needs to be generated in one single PDF file ?It should be pretty straight forward.
    Once you've got the query returning multiple rows, then just add a repeating group to your report (if an existing report, just select the section of the document that will repeat -> add-ins menu -> insert repeating group...; or right click selection -> BI Publisher -> Create group...), wherein the column values exist. You can even specify a page break at the end.
    By the way, this question is probably more suited for the {forum:id=245} forum.
    Ta,
    Trent

  • Single Credit Note for Multiple Invoices

    Hi,
    For multiple invoice of a specific customer only one credit note to be issued.
    Pls guide.
    Regards
    Vijay.

    Create credit memo request with reference to first invoice (the pop-up screen will take only one).
    Once all the items are copied to the credit memo request use menu path Sales document -> create with Reference , enter the second reference invoice. This will copy all the line items in the second invoice.
    Repeat the second step to copy all the invoices of the customer to the credit memo request.
    Do invoicing to generate a single credit memo. The credit memo request may split at the time of invoicing (some times) but you can prevent it.

  • Retro Billing for Multiple invoices (in case of supplementary billing)

    Dear Sirs,
    Can you pl suggest me step by step usage of Retro Billing. I would like to use it for supplementary billing for the 1 customers with multiple invoices.
    For one invoice, I used invoices correction request. But for multiple invoices, I guess, retro-billing can be used. Pl suggests me the steps on this.
    regards,
    sagar

    Dear sagar
    While I have absolultely no objection in awarding points to anybody, but b4 awarding, please go through the details.  If you see this thread, you have awarded full points to the one who have asked the same question you also asked.  Again I wish to submit that I have no enmity over Mr.Rahul, but what I would request is that please go through the details of suggestions and award as per your wish.
    I apologise Mr.Rahul if this hurts you but I just wanted to correct someone who is doing mistake unknowingly.  Thats it.  Hope you will also take this in right spirit.
    thanks
    G. Lakshmipathi

  • Return order on the basis of multiple invoice

    Greetings to All
    The scenario is that the return order is to be created with reference to multiple invoice. When i am doing the same by taking the reference twice, i.e I goto Sales Document tab and click Create with Reference twice and in the second time i give different document no. which copies the line item of the 2nd invoice document. But the reference document remains the first invoice in the return process. Is it possible to do the return order with reference to multiple invoice and the reference document getting reflected in the return process.
    Regards
    Parul

    I think you need to look for the reference at the item level. I guess you are currently looking at it at the header level. I am not sure if i am right.Please check if this works.
    Regards,
    Mani

  • How can i loop over treeview selected nodes and then to delete each node if it's a directory or a file ?

    I have this code:
    if (s == "file")
    file = false;
    for (int i = 0; i < treeViewMS1.SelectedNodes.Count; i++)
    DeleteFile(treeViewMS1.SelectedNode.FullPath, file);
    I know it's a file and it is working if it's a single file.
    On the treeView i click on a file right click in the menu i select delete and it's doing the line:
    DeleteFile(treeViewMS1.SelectedNode.FullPath, file);
    And it's working no problems.
    But i want to do that if i selected some files togeather multiple selection then to delete each file.
    So i added the FOR loop but then how do i delete from the SelectedNodes each node ?
    The treeView SelectedNodes dosen't have FullPath like SelectedNode also doing SelectedNodes[i] dosen't have the FullPath property.
    Same as for if i want to delete a single directory or multiple selected directories:
    This is the continue of the code if it"s not a "file" (else) it's null i know it's a directory and doing:
    else
    file = true;
    RemoveDirectoriesRecursive(treeViewMS1.SelectedNode, treeViewMS1.SelectedNode.FullPath);
    Also here i'm using SelectedNode but if i marked multiple directories then i how do i loop over the SelectedNodes and send each SelectedNode to the RemoveDirectoriesRecrusive method ?
    My problem is how to loop over SelectedNode(multiple selection of files/directories) and send each selected file/directory to it's method like i'm doing now ?

    foreach (TreeNode n in treeViewMS1.SelectedNodes)
    // Remove everything associated with TreeNode n here
    I don't think it's any harder than that, is it?
    If you can multi-select both an item and one of its descendents in the tree, then you'll have the situation that you may have deleted the parent folder and all of its children by the time you get around to deleting the descendent.  But that's not such
    a big deal.  A file can get deleted externally to your program too - so you'll just have to deal with it having been deleted already (or externally) when you get around to deleting it yourself.

Maybe you are looking for

  • What is causing my Mac to be so slow?

    Ok so I have a 2011 Mac Mini, upgraded to 8gb of RAM running Mavericks. Over the past few months, it has been performing poorly during certain tasks, for example: -When watching videos, both on and offline, picture will randomly freeze for a couple o

  • Adding more RAM to my MacBook Pro

    I have a MacBook Pro 2.4 GHz with 2 GB 667 MHz DDR2 SDRAM and need to add more ram. can i, and if so, what kind should i get? what's the most I can add? recommend any non-apple brands like kingston? (since it'd be cheaper and i can have a friend inst

  • SQL Developer in Read-Only-Mode

    Oracle SQL Developer version 1.2.1 BUILD MAIN-32.13 Running under WinXP Issue description: Impossible to start SQL Developer in Read-Only-Mode for certain users who should not be able to modify any data.

  • Where can I give my opinion and ideas of Mozilla layout?

    I want to know, because I want to help to improve Mozilla (in the things that I can), I mean, make Mozilla more friendly,more beauty,etc Thanks.

  • Problems with LR 5

    If I have a photo from the Edit - give module to the printer module , I get the following message : Adobe Photoshop Lightroom 64 -bit does not work anymore . What do I do.