Lookup Data For Each Record of Result Set

I'm trying to determine if the following task is possible in BPEL and how to implement it.
Assume I have two DB Adapters returning data from two different databases.
The first excepts no inputs returns 5 records in a collection looking somewhat like the following.
Order ID, Item ID
1, 2
2, 1
3, 1
4, 2
5, 3
The second accepts an Item ID as input and returns the description for that item.
I would like the output of the BPEL Process to look like this.
Order ID, Item ID, Item Desc
1, 2, Computer
2, 1, Desk
3, 1, Desk
4, 2, Computer
5, 3, Lamp
I'm new to BPEL and I'm assuming this will involve invoking the first db adapter link and then iterator through the result set calling the second db adapter link for each record but I'm not sure where to start. I'm hoping someone can give me a simple example that I can play with. I've looked at How to iterate through multiple records read from a file adapter? and How to pass a single element in an array to XSL from BPEL but I'm getting lost.
Thanks

I just got it working in the BPEL for-each loop by creating a variable of type Order which I then assigned the results from that loop and then appended them to my output variable. I'd be interested in seeing how I could do that within a transformation if its quicker. How do I append in a transformation so that I can add the row after each loop.
Here is the BPEL so far.
I will note that I think just fetching a complete copy of both data sources and merging wouldn't be ideal as my items table could contain a million records or more and I'm only wanting to fetch the ones I'm interested in.
Thanks
<?xml version = "1.0" encoding = "UTF-8" ?>
<!--
  Oracle JDeveloper BPEL Designer
  Created: Thu Dec 19 10:16:29 CST 2013
  Author:  shawn.c.weeks.ctr
  Type: BPEL 2.0 Process
  Purpose: Synchronous BPEL Process
-->
<process name="Lookup_Orders"
               targetNamespace="http://xmlns.oracle.com/Order_Lookup/Sales_System/Lookup_Orders"
               xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
               xmlns:client="http://xmlns.oracle.com/Order_Lookup/Sales_System/Lookup_Orders"
               xmlns:ora="http://schemas.oracle.com/xpath/extension"
               xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
         xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
         xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/db/Order_Lookup/Sales_System/get_orders"
         xmlns:ns2="http://www.example.org"
         xmlns:ns3="http://xmlns.oracle.com/pcbpel/adapter/db/top/get_orders"
         xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
         xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
         xmlns:oraext="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc"
         xmlns:dvm="http://www.oracle.com/XSL/Transform/java/oracle.tip.dvm.LookupValue"
         xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath"
         xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
         xmlns:bpm="http://xmlns.oracle.com/bpmn20/extensions"
         xmlns:xdk="http://schemas.oracle.com/bpel/extension/xpath/function/xdk"
         xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions"
         xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
         xmlns:ns4="http://xmlns.oracle.com/pcbpel/adapter/db/Order_Lookup/Sales_System/get_items"
         xmlns:ns5="http://xmlns.oracle.com/pcbpel/adapter/db/top/get_items"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <import namespace="http://xmlns.oracle.com/Order_Lookup/Sales_System/Lookup_Orders" location="Lookup_Orders.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
    <!--
        PARTNERLINKS                                                     
        List of services participating in this BPEL process              
    -->
  <partnerLinks>
    <!--
      The 'client' role represents the requester of this service. It is
      used for callback. The location and correlation information associated
      with the client role are automatically set using WS-Addressing.
    -->
    <partnerLink name="lookup_orders_client" partnerLinkType="client:Lookup_Orders" myRole="Lookup_OrdersProvider"/>
    <partnerLink name="get_orders" partnerLinkType="ns1:get_orders_plt"
                 partnerRole="get_orders_role"/>
    <partnerLink name="get_items" partnerLinkType="ns4:get_items_plt"
                 partnerRole="get_items_role"/>
  </partnerLinks>
  <!--
      VARIABLES                                                       
      List of messages and XML documents used within this BPEL process
  -->
  <variables>
    <!-- Reference to the message passed as input during initiation -->
    <variable name="inputVariable" messageType="client:Lookup_OrdersRequestMessage"/>
    <!-- Reference to the message that will be returned to the requester-->
    <variable name="outputVariable" messageType="client:Lookup_OrdersResponseMessage"/>
    <variable name="Invoke1_get_ordersSelect_InputVariable"
              messageType="ns1:get_ordersSelect_inputParameters"/>
    <variable name="Invoke1_get_ordersSelect_OutputVariable"
              messageType="ns1:OrdersCollection_msg"/>
    <variable name="Invoke2_get_itemsSelect_InputVariable"
              messageType="ns4:get_itemsSelect_inputParameters"/>
    <variable name="Invoke2_get_itemsSelect_OutputVariable"
              messageType="ns4:ItemsCollection_msg"/>
    <variable name="Output_Row" element="ns2:OrderCollection"/>
  </variables>
  <!--
     ORCHESTRATION LOGIC                                              
     Set of activities coordinating the flow of messages across the   
     services integrated within this business process                 
  -->
  <sequence name="main">
    <!-- Receive input from requestor. (Note: This maps to operation defined in Lookup_Orders.wsdl) -->
    <receive name="receiveInput" partnerLink="lookup_orders_client" portType="client:Lookup_Orders" operation="process" variable="inputVariable" createInstance="yes"/>
    <!-- Generate reply to synchronous request -->
    <invoke name="Invoke1" bpelx:invokeAsDetail="no" partnerLink="get_orders"
            portType="ns1:get_orders_ptt" operation="get_ordersSelect"
            inputVariable="Invoke1_get_ordersSelect_InputVariable"
            outputVariable="Invoke1_get_ordersSelect_OutputVariable"/>
    <forEach parallel="no" counterName="ForEach1Counter" name="ForEach1">
      <startCounterValue>1</startCounterValue>
      <finalCounterValue>count($Invoke1_get_ordersSelect_OutputVariable.OrdersCollection/ns3:Orders)</finalCounterValue>
      <scope name="Scope1">
        <sequence name="Sequence1">
          <assign name="Assign2">
            <copy>
              <from>$Invoke1_get_ordersSelect_OutputVariable.OrdersCollection/ns3:Orders[$ForEach1Counter]/ns3:itemId</from>
              <to>$Invoke2_get_itemsSelect_InputVariable.get_itemsSelect_inputParameters/ns5:item_id</to>
            </copy>
          </assign>
          <invoke name="Invoke2" bpelx:invokeAsDetail="no"
                  partnerLink="get_items" portType="ns4:get_items_ptt"
                  operation="get_itemsSelect"
                  inputVariable="Invoke2_get_itemsSelect_InputVariable"
                  outputVariable="Invoke2_get_itemsSelect_OutputVariable"/>
          <assign name="Assign3">
            <copy>
              <from>$Invoke1_get_ordersSelect_OutputVariable.OrdersCollection/ns3:Orders[$ForEach1Counter]/ns3:orderId</from>
              <to>$Output_Row/ns2:Order/ns2:Order_ID</to>
            </copy>
            <copy>
              <from>$Invoke1_get_ordersSelect_OutputVariable.OrdersCollection/ns3:Orders[$ForEach1Counter]/ns3:itemId</from>
              <to>$Output_Row/ns2:Order/ns2:Item_ID</to>
            </copy>
            <copy>
              <from>$Invoke2_get_itemsSelect_OutputVariable.ItemsCollection/ns5:Items[1]/ns5:itemDesc</from>
              <to>$Output_Row/ns2:Order/ns2:Item_Desc</to>
            </copy>
          </assign>
          <assign name="Assign4">
            <extensionAssignOperation>
              <bpelx:append>
                <bpelx:from>$Output_Row/ns2:Order</bpelx:from>
                <bpelx:to>$outputVariable.payload</bpelx:to>
              </bpelx:append>
            </extensionAssignOperation>
          </assign>
        </sequence>
      </scope>
    </forEach>
    <reply name="replyOutput" partnerLink="lookup_orders_client" portType="client:Lookup_Orders" operation="process" variable="outputVariable"/>
  </sequence>
</process>

Similar Messages

  • Create id, update id with date for each record

    Hi,
    Please give me brief idea or document for this concept:
    I need create id, create date, update id, update date for each record inserted or updated in database (in few tables).
    1) how user id can be obtained?
    2) Is it better if i use views instead of tables for this?
    3) is it possible for each record?
    Please show me complete scenario. a piece of code can also be helpful.
    thanx in advance.

    only.ashish99 wrote:
    Hi,
    Please give me brief idea or document for this concept:
    I need create id, create date, update id, update date for each record inserted or updated in database (in few tables).
    1) how user id can be obtained?SELECT
    2) Is it better if i use views instead of tables for this?It depends.
    post EXPLAIN PLAN for both.
    3) is it possible for each record?yes
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • Multiple parameters one row for each record

    I have this query I want the user to be able to allow the user to enter multiple MATL_CODE_MOD as a parameters, the problem is that the GURMAIL table have multiple records one for each GURMAIL_MATL_CODE_MOD, so it will give me duplicates.. How I can code this, so I can allow the user to enter multiple MATL_CODE_MOD codes, and have only one row for each record...
    and GURMAIL_MATL_CODE_MOD in ('8IBC','8IBD')
    select
    spriden_id,        
    spbpers_name_suffix   name_suffix,
    spbpers_name_prefix   name_prefix,
    spriden_last_name     last_name,
    spriden_first_name    first_name,
    spriden_mi            mi,
    srbrecr_term_code,
    srbrecr_majr_code,
    srbrecr_program_1,
    saturn_midd.utlq.f_matl_code_type(srbrecr_pidm)
    FROM
    saturn.srbrecr,
    saturn.spriden,
    saturn.spbpers,
    SATURN.SPRADDR,
    general.gurmail
    WHERE
    spriden_pidm = srbrecr_pidm
    and gurmail_pidm = spriden_pidm
    AND spriden_pidm = spraddr_pidm 
    --and srbrecr_term_code = decode(p_term  ,'%',SRBRECR_TERM_CODE,p_term)
    and spbpers_pidm = spriden_pidm
    and spriden_change_ind is null
    --and gurmail_matl_code_mod
    and SRBRECR_PROGRAM_1 = 'CMQ'
    and GURMAIL_MATL_CODE_MOD in ('8IBC','8IBD')
    --AND SPRADDR_ATYP_CODE = 'CM'
    AND SPRADDR_STREET_LINE1 IS NOT NULL;

    Hi,
    SELECT DISTINCT ...will keep duplicate rows out of the result set.
    Depending on your data, another possibility might be to not join the table that contains GURMAIL_MATL_CODE_MOD. Do an EXISTS sub-query on that table instead.
    If you need more help, post some sample data from all the tables, and the results you want from that data.
    Simplify, if possible, You can probably post a problem with 2 or 3 tables, each with 2 or 3 columns, that will have the same answer.
    Edited by: Frank Kulash on Apr 22, 2009 2:28 PM

  • How to Get Missing Dates for Each Support Ticket In My Query?

    Hello -
    I'm really baffled as to how to get missing dates for each support ticket in my query.  I did a search for this and found several CTE's however they only provide ways to find missing dates in a date table rather than missing dates for another column
    in a table.  Let me explain a bit further here -
    I have a query which has a list of support tickets for the month of January.  Each support ticket is supposed to be updated daily by a support rep, however that isn't happening so the business wants to know for each ticket which dates have NOT been
    updated.  So, for example, I might have support ticket 44BS which was updated on 2014-01-01, 2014-01-05, 2014-01-07.  Each time the ticket is updated a new row is inserted into the table.  I need a query which will return the missing dates per
    each support ticket.
    I should also add that I DO NOT have any sort of admin nor write permissions to the database...none at all.  My team has tried and they won't give 'em.   So proposing a function or storable solution will not work.  I'm stuck with doing everything
    in a query.
    I'll try and provide some sample data as an example -
    CREATE TABLE #Tickets
    TicketNo VARCHAR(4)
    ,DateUpdated DATE
    INSERT INTO #Tickets VALUES ('44BS', '2014-01-01')
    INSERT INTO #Tickets VALUES ('44BS', '2014-01-05')
    INSERT INTO #Tickets VALUES ('44BS', '2014-01-07')
    INSERT INTO #Tickets VALUES ('32VT', '2014-01-03')
    INSERT INTO #Tickets VALUES ('32VT', '2014-01-09')
    INSERT INTO #Tickets VALUES ('32VT', '2014-01-11')
    So for ticket 44BS, I need to return the missing dates between January 1st and January 5th, again between January 5th and January 7th.  A set-based solution would be best.
    I'm sure this is easier than i'm making it.  However, after playing around for a couple of hours my head hurts and I need sleep.  If anyone can help, you'd be a job-saver :)
    Thanks!!

    CREATE TABLE #Tickets (
    TicketNo VARCHAR(4)
    ,DateUpdated DATETIME
    GO
    INSERT INTO #Tickets
    VALUES (
    '44BS'
    ,'2014-01-01'
    INSERT INTO #Tickets
    VALUES (
    '44BS'
    ,'2014-01-05'
    INSERT INTO #Tickets
    VALUES (
    '44BS'
    ,'2014-01-07'
    INSERT INTO #Tickets
    VALUES (
    '32VT'
    ,'2014-01-03'
    INSERT INTO #Tickets
    VALUES (
    '32VT'
    ,'2014-01-09'
    INSERT INTO #Tickets
    VALUES (
    '32VT'
    ,'2014-01-11'
    GO
    GO
    SELECT *
    FROM #Tickets
    GO
    GO
    CREATE TABLE #tempDist (
    NRow INT
    ,TicketNo VARCHAR(4)
    ,MinDate DATETIME
    ,MaxDate DATETIME
    GO
    CREATE TABLE #tempUnUserdDate (
    TicketNo VARCHAR(4)
    ,MissDate DATETIME
    GO
    INSERT INTO #tempDist
    SELECT Row_Number() OVER (
    ORDER BY TicketNo
    ) AS NROw
    ,TicketNo
    ,Min(DateUpdated) AS MinDate
    ,MAx(DateUpdated) AS MaxDate
    FROM #Tickets
    GROUP BY TicketNo
    SELECT *
    FROM #tempDist
    GO
    -- Get the number of rows in the looping table
    DECLARE @RowCount INT
    SET @RowCount = (
    SELECT COUNT(TicketNo)
    FROM #tempDist
    -- Declare an iterator
    DECLARE @I INT
    -- Initialize the iterator
    SET @I = 1
    -- Loop through the rows of a table @myTable
    WHILE (@I <= @RowCount)
    BEGIN
    --  Declare variables to hold the data which we get after looping each record
    DECLARE @MyDate DATETIME
    DECLARE @TicketNo VARCHAR(50)
    ,@MinDate DATETIME
    ,@MaxDate DATETIME
    -- Get the data from table and set to variables
    SELECT @TicketNo = TicketNo
    ,@MinDate = MinDate
    ,@MaxDate = MaxDate
    FROM #tempDist
    WHERE NRow = @I
    SET @MyDate = @MinDate
    WHILE @MaxDate > @MyDate
    BEGIN
    IF NOT EXISTS (
    SELECT *
    FROM #Tickets
    WHERE TicketNo = @TicketNo
    AND DateUpdated = @MyDate
    BEGIN
    INSERT INTO #tempUnUserdDate
    VALUES (
    @TicketNo
    ,@MyDate
    END
    SET @MyDate = dateadd(d, 1, @MyDate)
    END
    SET @I = @I + 1
    END
    GO
    SELECT *
    FROM #tempUnUserdDate
    GO
    GO
    DROP TABLE #tickets
    GO
    DROP TABLE #tempDist
    GO
    DROP TABLE #tempUnUserdDate
    Thanks, 
    Shridhar J Joshi 
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • From XML (import) for each record automatic new page creation?

    Hello,
    I'm playing around with XML.
    Can someone tell me where to look and help me?
    I load variable data via XML.
    Example content xml:
    <pages>
         <page>
             <id>1</id>
             <article>title page 1</article>
             <info>Info page 1</info>
             <price>price page 1</price>
         </page>
         <page>
             <id>2</id>
             <article>title page 2</article>
             <info>Info page 2</info>
             <price>price page 2</price>
         </page>
         <page>
             <id>3</id>
             <article>title page 3</article>
             <info>Info page 3</info>
             <price>price page 3</price>
         </page>
    </pages>
    I have 1 page classified (ie 3 text boxes). The idea is that for each record in the xml (in this case 1, 2 and 3) a new page is created (Qua layout identical to the page that I had prepared, but with the corresponding data in each box)
    How do I do this?
    Thanks!

    If you need to keep the three parts of your page in separate text frames, you are probably out of luck.
    I can't tell from your question whether you know how to tag frames and import XML content into them. If you don't, the manual is fairly clear on it. However, it states more than once that "InDesign flows merged XML content into existing frames only."  That means that it won't add frames or pages for you -- you can only load XML into tagged frames on the first page and will have to add extra ones by hand.
    If you could rework your design so that all the elements could be accommodated in a single text frame, using paragraph styles to keep them apart, you could just import the XML and map tags to styles, then drag it into a frame on the first pages. If your article style was set to start in a new frame,  everything but the first would go into overset text, which you could deal with in the usual way -- shift-click on the in port of a new frame and InDesign will add the pages you need.

  • Last Entry Date for Each Quarter

    Hi,
    I want to find out the last entry date for each quarter. The query I am using is this:
    SELECT 
    Country.Name as Country,
    CONVERT(DATE,MAX([CreationDate])) as LastDateOfClipEntry,
    DATEPART(Year,([CreationDate])) as Year,
    DATEPART(Quarter,([CreationDate])) as Quarter
    FROM 
    [dbo].[Clip]
    JOIN Office on Office.Code = Clip.Office
    JOIN Country on Country.Code = Office.Country
    WHERE YEAR(CreationDate) IN (@YEAR)
    GROUP BY Country.Name,DATEPART(Year,([CreationDate])) ,DATEPART(Quarter,([CreationDate]))
    ORDER BY Country.Name
    Now based on the column group I added in my report the result is coming correct but not properly formatted as I want.
    Below is the snapshot how its coming now:
    I don't want the extra blanks coming for each occurrence. There should be only one line for Australia and in the single line it should show the last entry date for that quarter. How can I achieve that ? Below is the snapshot showing current config:
    Thanks a lot in advance. Any help would be appreciated.
    Vivek Kamath

    Hi Vik2907,
    According to your description, you have a matrix which shows you those unexpected cells. Right?
    In this scenario, the reason caused this problem is the group setting. Mostly, you set the row group on a wrong field. As we tested in our local environment, if you set the row group on LastDateOfClipEntry, it will render the data as the screenshot you post.
    Please check both Row and Column Group setting, make sure they are group on proper field.
    Reference:
    Tables, Matrices, and Lists (Report Builder and SSRS)
    Understanding Groups (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Filter Oldest Entry for Each Record

    Post Author: Stephanie
    CA Forum: Desktop Intelligence Reporting
    I have a file that has multiple rows for each record, each with a different date. I would like to filter the report so that only the oldest entry for each record appears. Any suggestions? The report looks like this:
    Record 1     01/01/07
    Record 1     03/01/07
    Record 1     05/01/07
    Record 2     03/01/07
    Record 2     05/01/07
    Record 2     07/01/07
    I would like the report to show this:
    Record 1     01/01/07
    Record 2     03/01/07
    Thank you.

    Post Author: Stephanie
    CA Forum: Desktop Intelligence Reporting
    Thanks for the suggestion, but I had already tried that and I could not get it to work. I made a variable =Min(<Date>). When I removed the other date field, my report did look like this:
    Record 1     01/01/07
    Record 2     03/01/07
    The problem is that there are other fields in the entry that I need to display as well. Let me rephrase what my original file looks like.
    Record 1     01/01/07     Product A
    Record 1     03/01/07     Product H
    Record 1     05/01/07     Product K
    Record 2     03/01/07     Product Z
    Record 2     05/01/07     Product G
    Record 2     07/01/07     Product H
    I want the result to look like this:
    Record 1     01/01/07     Product A
    Record 2     03/01/07     Product Z
    When I use the min formula, I can't figure out a way to get the product information from the original record as well.

  • Query for Separate data for each VU user in OLT testing

    Hi,
    I am not able to configure separate set of data for each VU users in OLT testing to avoid concurrency.Is there a way out in OATs?
    Regards,
    Yogesh
    Edited by: user10313659 on Jan 8, 2012 10:52 PM

    Hi Yogesh,
    It is not really practical to use a separate databank per virtual user (assuming this is what you were referring to). You can use a databank that contains enough records for all users and then use the databank control to make sure that each user gets a separate record for each iteration - check out the 'Sequential/Stop the User' settings or use 'Shuffle'.
    Regards,
    Jamie

  • Sending emails for each record from tabular form

    I currently have a requirements management tabular form that used to update or set job requirements inactive and/or covered.
    We're a staffing agency and have salesmen across the country that will use this tabular form to quickly manage their requirements to mark them as covered or inactive if the position has been filled.
    The multi-row update works fine since the form was built using the wizard, but I need to be able to send out an email for each record that's been marked as covered in the tabular form.
    How can this be accomplished?
    I'm running Oracle 12c and Apex 4.2.0 on a windows 2008 R2 server.
    Thanks again.

    Greg,
    I took a different approach from what I originally suggested.  Since the tabular form is displaying only reqs that eligible to be covered, I chose to construct a process that would read the database after the reqs table was updated.  The code should find recent reqs covered by the salesman and then send out an email for each covered req.
    Since I cannot see the data structure of your reqs table, I guessed the data type and size for the local variables in the DECLARE section, you many need to adjust these.
    Give this code a shot and let's see where we get.  By the way, the naming conventions of your database are in need of naming standards.
    The process needs to occur After Submit and after the Automatic Row Processing (DML) process that is updating the reqs table.  Make sure that the process sequence number is greater than the Automatic Row Processing (DML) sequence number.
    DECLARE
       l_id           NUMBER;
       l_index        NUMBER;
       l_vc_arr2      apex_application_global.vc_arr2;
       lc_message     VARCHAR2 (4000);
       l_pkey         NUMBER;
       l_date_wrote   DATE;
       l_sales        VARCHAR2 (100);
       l_client       VARCHAR2 (100);
       l_job          VARCHAR2 (100);
       l_1or2         VARCHAR2 (100);
       l_rate         NUMBER;
       l_notes        VARCHAR2 (4000);
    BEGIN
       FOR c1
          -- Retrieve reqs primary key that have been covered
          -- in the last 2 seconds by the salesman
       IN (SELECT pkey
             INTO l_pkey
             FROM reqs
            WHERE     SYSDATE < (date_wrote + 1 / 46200)
                  AND active = 'Active'
                  AND reqs.sales = :p12_sales
                  AND covered IS NOT NULL)
       -- Send an email for each req that has been covered
       LOOP
          SELECT c1.date_wrote,
                 c1.sales,
                 c1.client,
                 c1.job,
                 c1.notes,
                 c1.who,
                 c1.1or2,
                 c1.rate
            INTO l_date_wrote,
                 l_sales,
                 l_client,
                 l_job,
                 l_notes,
                 l_who,
                 l_1or2,
                 l_rate
            FROM reqs
           WHERE pkey = l_pkey;
          lc_message := 'Date Written   :' || l_date_wrote || CHR (10);
          lc_message := lc_message || 'Sales          :' || l_sales || CHR (10);
          lc_message := lc_message || 'Client         :' || l_client || CHR (10);
          lc_message := lc_message || 'Position       :' || l_job || CHR (10);
          lc_message := lc_message || '#1 or #2       :' || l_1or2 || CHR (10);
          lc_message := lc_message || 'Rate           :' || l_rate || CHR (10);
          lc_message := lc_message || 'Notes      :' || l_notes || CHR (10);
          l_id :=
             apex_mail.send (
                p_to     => '[email protected]',
                p_from   => 'DO_NOT_REPLY@REQS',
                p_subj   =>    ''
                            || l_who
                            || ' Has Covered '
                            || l_job
                            || ' at '
                            || l_client
                            || CHR (10),
                p_body   => lc_message);
          COMMIT;
          apex_mail.push_queue ();
       END LOOP;
    END;
    Jeff

  • Output the requested delivery date for each different line item

    Hello Experts
    I have program called ZFSFSF(following), in the output Its showing multiple requested delvery dates per line item.
    But We need to show the requested delivery date for each different line item.
    Any code is highly appreciated. I wud appreacite if you cud bold the added code.
    Thanks
    SP
    TYPE-POOLS: slis.
    TABLES: vbap, vbrk, vbfa, vbak, vbrp, konv, kna1, bkpf, bsad, bkpf_bsad,
    knvv, pa0002, t005u, mvke, lips, likp, vbpa, vbep.
    DATA: BEGIN OF i_list OCCURS 0,
    vbeln LIKE vbak-vbeln,
    posnr LIKE vbap-posnr,
    matnr LIKE vbap-matnr,
    erdat LIKE vbap-erdat,
    mvgr1 LIKE mvke-mvgr1,
    wadat_ist LIKE likp-wadat_ist,
    days TYPE i,
    werks LIKE vbap-werks,
    lgort LIKE vbap-lgort,
    kwmeng LIKE vbap-kwmeng," CH01+
    lfimg LIKE lips-lfimg," CH01+
    pstyv LIKE vbap-pstyv," CH01+
    obd LIKE lips-vbeln," CH01+
    obd_pos LIKE lips-posnr," CH01+
    soldto LIKE vbaK-kunnr," JR+
    shipto LIKE vbpa-kunnr," JR+
    edatu like vbep-edatu," PR+
    END OF i_list.
    DATA: i_list2 LIKE i_list OCCURS 0 WITH HEADER LINE,
    i_list3 LIKE i_list OCCURS 0 WITH HEADER LINE.
    DATA: i_list4 LIKE vbap OCCURS 0 WITH HEADER LINE.
    *ALV Output Header
    DATA: gt_list_top_of_page TYPE slis_t_listheader,
    prognm LIKE sy-repid,
    gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
    gt_events TYPE slis_t_event,
    is_layout TYPE slis_layout_alv,
    is_variant LIKE disvariant,
    it_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    DATA:gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA:gt_outtab LIKE i_list OCCURS 0 WITH HEADER LINE.
    DATA: g_repid LIKE sy-repid,
    g_count LIKE sy-tabix.
    SELECTION-SCREEN BEGIN OF BLOCK block0 WITH FRAME TITLE text-t01.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t10.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t11.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t12.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN END OF BLOCK block0.
    */ Selection and Input Parameters
    SELECTION-SCREEN BEGIN OF BLOCK blocko WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_vbeln FOR vbap-vbeln, "SO
    s_auart FOR vbak-auart DEFAULT 'KB' OBLIGATORY,
    s_matnr FOR vbap-matnr," obligatory,
    s_mvgr1 FOR mvke-mvgr1,
    s_erdat FOR vbap-erdat OBLIGATORY,
    s_werks FOR vbap-werks,
    s_lgort FOR vbap-lgort,
    s_edatu FOR vbep-edatu.
    PARAMETERS: p_vkorg LIKE vbak-vkorg DEFAULT '5010'.
    SELECTION-SCREEN SKIP 2.
    +EC1
    Addition +EC1
    +EC1
    PARAMETERS: p_vari LIKE disvariant-variant.
    +EC1
    End Addition +EC1
    +EC1
    SELECTION-SCREEN END OF BLOCK blocko.
    +EC1
    Addition +EC1
    +EC1
    DATA: g_save(1) TYPE c,
    g_default(1) TYPE c,
    g_exit(1) TYPE c,
    gx_variant LIKE disvariant,
    g_variant LIKE disvariant.
    +EC1
    End Addition +EC1
    +EC1
    Initialization fieldcatalog
    INITIALIZATION.
    PERFORM clear_tables.
    g_repid = sy-repid.
    PERFORM fieldcat_init USING gt_fieldcat[].
    +EC1
    Addition +EC1
    +EC1
    g_save = 'A'.
    PERFORM variant_init.
    Get default variant
    gx_variant = g_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
    i_save = g_save
    CHANGING
    cs_variant = gx_variant
    EXCEPTIONS
    not_found = 2.
    IF sy-subrc = 0.
    p_vari = gx_variant-variant.
    ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    PERFORM f4_for_variant.
    AT SELECTION-SCREEN.
    PERFORM auth_check. "+ESC
    PERFORM pai_of_selection_screen.
    +EC1
    End Addition +EC1
    +EC1
    START-OF-SELECTION.
    PERFORM get_data.
    PERFORM alv.
    END-OF-SELECTION.
    FORM get_data *
    FORM get_data.
    *CH01 - Added kwmeng(order qty) to selection, excluded rejects
    *JR -added soldto and shipto code
    SELECT avbeln aposnr amatnr aerdat awerks algort
    akwmeng apstyv bkunnr cedatu
    CH01+
    INTO
    (i_list-vbeln, i_list-posnr, i_list-matnr, i_list-erdat, i_list-werks,
    i_list-lgort,
    i_list-kwmeng , i_list-pstyv, i_list-soldto,i_list-edatu)
    CH01+
    FROM vbap AS a INNER JOIN vbak AS b ON avbeln = bvbeln
    INNER JOIN vbep AS c ON avbeln = cvbeln
    WHERE b~vkorg = p_vkorg
    AND a~werks IN s_werks
    AND a~lgort IN s_lgort
    AND b~auart IN s_auart
    AND a~vbeln IN s_vbeln
    AND a~erdat IN s_erdat
    AND a~abgru = ''" CH01+
    AND a~matnr IN s_matnr
    AND c~edatu IN s_edatu.
    APPEND i_list.
    ENDSELECT.
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    SELECT SINGLE mvgr1 INTO i_list-mvgr1 FROM mvke
    WHERE matnr = i_list-matnr.
    MODIFY i_list.
    CLEAR: i_list.
    ENDLOOP.
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    IF i_list-mvgr1 IN s_mvgr1.
    CONTINUE.
    ELSE.
    DELETE i_list.
    COMMIT WORK AND WAIT.
    ENDIF.
    ENDLOOP.
    CH01 - commented these lines out and redid logic below
    LOOP AT i_list.
    select single vbeln into lips-vbeln from lips
    where vgbel = i_list-vbeln
    and vgpos = i_list-posnr.
    select single wadat_ist into i_list-wadat_ist from likp
    where vbeln = lips-vbeln.
    SELECT b~wadat_ist INTO i_list-wadat_ist
    FROM lips AS a INNER JOIN
    likp AS b ON avbeln = bvbeln WHERE a~vgbel = i_list-vbeln
    AND a~vgpos = i_list-posnr.
    MODIFY i_list.
    CLEAR: i_list, lips-vbeln.
    ENDSELECT.
    ENDLOOP.
    CH01 - Changed to select multiple delivery lines & del qty
    summing the total deliveries per OBD# and date
    LOOP AT i_list.
    SELECT avbeln sum( alfimg ) b~wadat_ist
    INTO (i_list-obd , i_list-lfimg , i_list-wadat_ist)
    FROM lips AS a INNER JOIN
    likp AS b ON avbeln = bvbeln WHERE a~vgbel = i_list-vbeln
    AND a~vgpos = i_list-posnr
    AND a~pstyv = i_list-pstyv
    group by avbeln bwadat_ist.
    i_list2 = i_list.
    APPEND i_list2.
    ENDSELECT.
    IF sy-subrc <> 0.
    i_list2 = i_list.
    APPEND i_list2.
    ENDIF.
    ENDLOOP.
    i_list[] = i_list2[].
    *End CH01
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    IF i_list-wadat_ist IS INITIAL.
    CONTINUE.
    ELSE.
    i_list-days = i_list-wadat_ist - i_list-erdat.
    ENDIF.
    MODIFY i_list.
    CLEAR: i_list.
    COMMIT WORK AND WAIT.
    ENDLOOP.
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    IF i_list-vbeln IS INITIAL.
    DELETE i_list.
    ENDIF.
    ENDLOOP.
    COMMIT WORK AND WAIT.
    *JR
    LOOP AT i_list.
    SELECT SINGLE KUNNR INTO i_list-shipto FROM vbpa
    WHERE vbeln = i_list-vbeln
    AND parvw = 'WE'.
    MODIFY i_list.
    ENDLOOP.
    *END JR
    gt_outtab[] = i_list[].
    COMMIT WORK AND WAIT.
    ENDFORM.
    FORM alv *
    FORM alv.
    PERFORM e03_eventtab_build USING gt_events[]. "+EC1
    PERFORM e04_comment_build USING gt_list_top_of_page[]. "+EC1
    prognm = sy-repid. "+EC1
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_user_command = 'USER_COMMAND'
    i_callback_program = g_repid
    it_fieldcat = gt_fieldcat[]
    it_events = gt_events[] "+ESC
    it_sort = it_sort[]
    +EC1
    Addition +EC1
    +EC1
    is_variant = g_variant
    i_save = g_save
    +EC1
    End Addition +EC1
    +EC1
    TABLES
    t_outtab = gt_outtab.
    COMMIT WORK AND WAIT.
    ENDFORM.
    FORM fieldcat_init *
    --> I_FIELDCAT *
    FORM fieldcat_init
    USING i_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: ls_fieldcat TYPE slis_fieldcat_alv.
    DATA: pos TYPE i VALUE 1.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'VBELN'.
    ls_fieldcat-ref_tabname = 'VBAK'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'POSNR'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'MATNR'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'MVGR1'.
    ls_fieldcat-ref_tabname = 'MVKE'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'WERKS'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'LGORT'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'ERDAT'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'WADAT_IST'.
    ls_fieldcat-ref_tabname = 'LIKP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'DAYS'.
    ls_fieldcat-ref_fieldname = 'DAYS'.
    ls_fieldcat-seltext_s = '# Of Days'.
    ls_fieldcat-seltext_m = '# Of Days'.
    ls_fieldcat-seltext_l = '# Of Days'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *Begin CH01
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'KWMENG'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-outputlen = 7.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'LFIMG'.
    ls_fieldcat-ref_tabname = 'LIPS'.
    ls_fieldcat-outputlen = 7.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'OBD'.
    ls_fieldcat-seltext_s = 'OBD'.
    ls_fieldcat-seltext_m = 'Outbound Del'.
    ls_fieldcat-seltext_l = 'Outbound Delivery'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'OBD_POS'.
    ls_fieldcat-seltext_s = 'OBD Ln'.
    ls_fieldcat-seltext_m = 'Outbound Del Ln'.
    ls_fieldcat-seltext_l = 'Outbound Del Line'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *End CH01
    *JR
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'SOLDTO'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-seltext_m = 'Sold To'.
    ls_fieldcat-seltext_l = 'Sold To'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'SHIPTO'.
    ls_fieldcat-ref_tabname = 'VBPA'.
    ls_fieldcat-seltext_m = 'Ship To'.
    ls_fieldcat-seltext_l = 'Ship To'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *END JR
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'EDATU'.
    ls_fieldcat-ref_tabname = 'VBEP'.
    ls_fieldcat-seltext_m = 'Requested Delivery date'.
    ls_fieldcat-seltext_l = 'Requested Delivery date'.
    ls_fieldcat-outputlen = 20.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *FOR ALV SORT & SUBTOTAL
    CLEAR it_sort.
    it_sort-spos = '0'.
    it_sort-fieldname = 'VBELN'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '1'.
    it_sort-fieldname = 'POSNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '2'.
    it_sort-fieldname = 'MATNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '3'.
    it_sort-fieldname = 'MVGR1'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '4'.
    it_sort-fieldname = 'ERDAT'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '5'.
    it_sort-fieldname = 'WADAT_IST'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-down = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '6'.
    it_sort-fieldname = 'PERNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '7'.
    it_sort-fieldname = 'VORNA'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '8'.
    it_sort-fieldname = 'NACHN'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '9'.
    it_sort-fieldname = 'VKGRP'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '10'.
    it_sort-fieldname = 'VBELN'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '11'.
    it_sort-fieldname = 'ERDAT'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '12'.
    it_sort-fieldname = 'BEZEI'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    clear it_sort.
    it_sort-spos = '1'.
    it_sort-fieldname = 'BELNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    append it_sort.
    ENDFORM.
    +EC1
    Addition +EC1
    +EC1
    *& Form VARIANT_INIT
    text
    --> p1 text
    <-- p2 text
    FORM variant_init.
    CLEAR g_variant.
    g_variant-report = g_repid.
    ENDFORM. " VARIANT_INIT
    FORM f4_for_variant *
    FORM f4_for_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
    is_variant = g_variant
    i_save = g_save
    it_default_fieldcat =
    IMPORTING
    e_exit = g_exit
    es_variant = gx_variant
    EXCEPTIONS
    not_found = 2.
    IF sy-subrc = 2.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    IF g_exit = space.
    p_vari = gx_variant-variant.
    ENDIF.
    ENDIF.
    ENDFORM.
    *& Form PAI_OF_SELECTION_SCREEN
    text
    FORM pai_of_selection_screen.
    IF NOT p_vari IS INITIAL.
    MOVE g_variant TO gx_variant.
    MOVE p_vari TO gx_variant-variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
    EXPORTING
    i_save = g_save
    CHANGING
    cs_variant = gx_variant.
    g_variant = gx_variant.
    ELSE.
    PERFORM variant_init.
    ENDIF.
    ENDFORM. " PAI_OF_SELECTION_SCREEN
    +EC1
    End Addition +EC1
    +EC1
    FORM e03_eventtab_build *
    --> E03_LT_EVENTS *
    FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
    DATA: ls_event TYPE slis_alv_event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    i_list_type = 0
    IMPORTING
    et_events = e03_lt_events.
    READ TABLE e03_lt_events WITH KEY name = slis_ev_top_of_page
    INTO ls_event.
    IF sy-subrc = 0.
    MOVE gc_formname_top_of_page TO ls_event-form.
    APPEND ls_event TO e03_lt_events.
    ENDIF.
    ENDFORM.
    FORM e04_comment_build *
    --> E04_LT_TOP_OF_PAGE *
    FORM e04_comment_build USING e04_lt_top_of_page TYPE slis_t_listheader.
    DATA: ls_line TYPE slis_listheader.
    *Report Title
    CLEAR ls_line.
    ls_line-typ = 'H'.
    ls_line-info = text-007.
    APPEND ls_line TO e04_lt_top_of_page.
    **Doc Type Desc.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-008.
    ls_line-info = p_matnr.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-009.
    ls_line-info = p_werks.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-010.
    ls_line-info = p_stlan.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-011.
    ls_line-info = p_stlal.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-012.
    ls_line-info = p_stlal.
    append ls_line to e04_lt_top_of_page.
    ENDFORM.
    FORM top_of_page *
    FORM top_of_page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = gt_list_top_of_page.
    ENDFORM.
    FORM auth_check *
    FORM auth_check.
    AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'
    ID 'VKORG' FIELD p_vkorg.
    IF sy-subrc NE 0.
    MESSAGE e054 WITH p_vkorg.
    ENDIF.
    ENDFORM. " auth_check
    *& Form USER_COMMAND
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    CASE r_ucomm.
    WHEN '&IC1'.
    PERFORM display_so_order USING r_ucomm
    rs_selfield.
    ENDCASE.
    ENDFORM.
    *& Form display_sales_order
    text
    -->P_R_UCOMM text
    -->P_RS_SELFIELD text
    FORM display_so_order USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    CASE rs_selfield-sel_tab_field.
    WHEN '1-VBELN'.
    SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    WHEN '1-MATNR'.
    SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
    CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
    WHEN '1-OBD'.
    SET PARAMETER ID 'VL' FIELD rs_selfield-value.
    CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
    WHEN OTHERS.
    MESSAGE i000(z1) WITH 'Please Click on the Valid Selection'.
    EXIT.
    ENDCASE.
    ENDFORM. " display_sales_order
    FORM EDit_table *

    > TYPE-POOLS: slis.
    >
    > TABLES: vbap, vbrk, vbfa, vbak, vbrp, konv, kna1,
    > bkpf, bsad, bkpf_bsad,
    > knvv, pa0002, t005u, mvke, lips, likp, vbpa, vbep.
    >
    > DATA: BEGIN OF i_list OCCURS 0,
    > vbeln LIKE vbak-vbeln,
    > posnr LIKE vbap-posnr,
    <b>  etenr like vbep-etenr,</b>
    > matnr LIKE vbap-matnr,
    > erdat LIKE vbap-erdat,
    > mvgr1 LIKE mvke-mvgr1,
    > wadat_ist LIKE likp-wadat_ist,
    > days TYPE i,
    > werks LIKE vbap-werks,
    > lgort LIKE vbap-lgort,
    > kwmeng LIKE vbap-kwmeng," CH01+
    > lfimg LIKE lips-lfimg," CH01+
    > pstyv LIKE vbap-pstyv," CH01+
    > obd LIKE lips-vbeln," CH01+
    > obd_pos LIKE lips-posnr," CH01+
    > soldto LIKE vbaK-kunnr," JR+
    > shipto LIKE vbpa-kunnr," JR+
    > edatu like vbep-edatu," PR+
    > END OF i_list.
    >
    > DATA: i_list2 LIKE i_list OCCURS 0 WITH HEADER LINE,
    > i_list3 LIKE i_list OCCURS 0 WITH HEADER LINE.
    >
    > DATA: i_list4 LIKE vbap OCCURS 0 WITH HEADER LINE.
    >
    >
    > *ALV Output Header
    > DATA: gt_list_top_of_page TYPE slis_t_listheader,
    > prognm LIKE sy-repid,
    > gc_formname_top_of_page TYPE slis_formname VALUE
    > 'TOP_OF_PAGE',
    > gt_events TYPE slis_t_event,
    > is_layout TYPE slis_layout_alv,
    > is_variant LIKE disvariant,
    > it_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    >
    > DATA:gt_fieldcat TYPE slis_t_fieldcat_alv.
    > DATA:gt_outtab LIKE i_list OCCURS 0 WITH HEADER
    > LINE.
    >
    > DATA: g_repid LIKE sy-repid,
    > g_count LIKE sy-tabix.
    >
    > SELECTION-SCREEN BEGIN OF BLOCK block0 WITH FRAME
    > TITLE text-t01.
    >
    > SELECTION-SCREEN: BEGIN OF LINE.
    > SELECTION-SCREEN COMMENT 1(79) text-t10.
    >
    > SELECTION-SCREEN: END OF LINE.
    >
    > SELECTION-SCREEN: BEGIN OF LINE.
    > SELECTION-SCREEN COMMENT 1(79) text-t11.
    > SELECTION-SCREEN: END OF LINE.
    >
    > SELECTION-SCREEN: BEGIN OF LINE.
    > SELECTION-SCREEN COMMENT 1(79) text-t12.
    > SELECTION-SCREEN: END OF LINE.
    >
    > SELECTION-SCREEN END OF BLOCK block0.
    >
    > */ Selection and Input Parameters
    > SELECTION-SCREEN BEGIN OF BLOCK blocko WITH FRAME
    > TITLE text-001.
    >
    >
    >
    > SELECT-OPTIONS: s_vbeln FOR vbap-vbeln, "SO
    > s_auart FOR vbak-auart DEFAULT 'KB' OBLIGATORY,
    > s_matnr FOR vbap-matnr," obligatory,
    > s_mvgr1 FOR mvke-mvgr1,
    > s_erdat FOR vbap-erdat OBLIGATORY,
    > s_werks FOR vbap-werks,
    > s_lgort FOR vbap-lgort,
    > s_edatu FOR vbep-edatu.
    >
    > PARAMETERS: p_vkorg LIKE vbak-vkorg DEFAULT '5010'.
    >
    >
    >
    > SELECTION-SCREEN SKIP 2.
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > PARAMETERS: p_vari LIKE disvariant-variant.
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    > SELECTION-SCREEN END OF BLOCK blocko.
    >
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > DATA: g_save(1) TYPE c,
    > * g_default(1) TYPE c,
    > g_exit(1) TYPE c,
    > gx_variant LIKE disvariant,
    > g_variant LIKE disvariant.
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    >
    > * Initialization fieldcatalog
    > INITIALIZATION.
    >
    > * PERFORM clear_tables.
    >
    > g_repid = sy-repid.
    > PERFORM fieldcat_init USING gt_fieldcat[].
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > g_save = 'A'.
    > PERFORM variant_init.
    > * Get default variant
    > gx_variant = g_variant.
    > CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    > EXPORTING
    > i_save = g_save
    > CHANGING
    > cs_variant = gx_variant
    > EXCEPTIONS
    > not_found = 2.
    > IF sy-subrc = 0.
    > p_vari = gx_variant-variant.
    > ENDIF.
    >
    > AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    > PERFORM f4_for_variant.
    >
    > AT SELECTION-SCREEN.
    > PERFORM auth_check. "+ESC
    > PERFORM pai_of_selection_screen.
    >
    >
    >
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    >
    >
    > START-OF-SELECTION.
    >
    > PERFORM get_data.
    >
    > PERFORM alv.
    >
    > END-OF-SELECTION.
    >
    > *----
    > -
    > * FORM get_data *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM get_data.
    > *CH01 - Added kwmeng(order qty) to selection,
    > excluded rejects
    > *JR -added soldto and shipto code
    SELECT a~vbeln a~posnr a~matnr a~erdat a~werks a~lgort
    a~kwmeng a~pstyv b~kunnr c~edatu
    CH01+
    INTO corresponding fields of table i_list
    FROM vbap AS a INNER JOIN vbak AS b ON a~vbeln = b~vbeln
    INNER JOIN vbep AS c ON a~vbeln = c~vbeln
    and a~posnr = c~posnr
    WHERE b~vkorg = p_vkorg
    AND a~werks IN s_werks
    AND a~lgort IN s_lgort
    AND b~auart IN s_auart
    AND a~vbeln IN s_vbeln
    AND a~erdat IN s_erdat
    AND a~abgru = ''" CH01+
    AND a~matnr IN s_matnr
    AND c~edatu IN s_edatu.
    > COMMIT WORK AND WAIT.
    >
    > LOOP AT i_list.
    > SELECT SINGLE mvgr1 INTO i_list-mvgr1 FROM mvke
    > WHERE matnr = i_list-matnr.
    > MODIFY i_list.
    > CLEAR: i_list.
    > ENDLOOP.
    > COMMIT WORK AND WAIT.
    >
    > LOOP AT i_list.
    > IF i_list-mvgr1 IN s_mvgr1.
    > CONTINUE.
    > ELSE.
    > DELETE i_list.
    > COMMIT WORK AND WAIT.
    > ENDIF.
    > ENDLOOP.
    > * CH01 - commented these lines out and redid logic
    > below
    > * LOOP AT i_list.
    > ** select single vbeln into lips-vbeln from lips
    > ** where vgbel = i_list-vbeln
    > ** and vgpos = i_list-posnr.
    > **
    > ** select single wadat_ist into i_list-wadat_ist from
    > likp
    > ** where vbeln = lips-vbeln.
    > *
    > * SELECT b~wadat_ist INTO i_list-wadat_ist
    > * FROM lips AS a INNER JOIN
    > * likp AS b ON a~vbeln = b~vbeln WHERE a~vgbel =
    > i_list-vbeln
    > * AND a~vgpos = i_list-posnr.
    > * MODIFY i_list.
    > * CLEAR: i_list, lips-vbeln.
    > * ENDSELECT.
    > * ENDLOOP.
    >
    > * CH01 - Changed to select multiple delivery lines &
    > del qty
    > * summing the total deliveries per OBD# and date
    > LOOP AT i_list.
    > SELECT avbeln sum( alfimg ) b~wadat_ist
    > INTO (i_list-obd , i_list-lfimg , i_list-wadat_ist)
    > FROM lips AS a INNER JOIN
    > likp AS b ON avbeln = bvbeln WHERE a~vgbel =
    > i_list-vbeln
    > AND a~vgpos = i_list-posnr
    > AND a~pstyv = i_list-pstyv
    > group by avbeln bwadat_ist.
    > i_list2 = i_list.
    > APPEND i_list2.
    > ENDSELECT.
    > IF sy-subrc <> 0.
    > i_list2 = i_list.
    > APPEND i_list2.
    > ENDIF.
    > ENDLOOP.
    > i_list[] = i_list2[].
    > *End CH01
    >
    > COMMIT WORK AND WAIT.
    >
    > LOOP AT i_list.
    > IF i_list-wadat_ist IS INITIAL.
    > CONTINUE.
    > ELSE.
    > i_list-days = i_list-wadat_ist - i_list-erdat.
    > ENDIF.
    > MODIFY i_list.
    > CLEAR: i_list.
    > COMMIT WORK AND WAIT.
    > ENDLOOP.
    >
    > COMMIT WORK AND WAIT.
    >
    > LOOP AT i_list.
    > IF i_list-vbeln IS INITIAL.
    > DELETE i_list.
    > ENDIF.
    > ENDLOOP.
    > COMMIT WORK AND WAIT.
    >
    > *JR
    > LOOP AT i_list.
    > SELECT SINGLE KUNNR INTO i_list-shipto FROM vbpa
    > WHERE vbeln = i_list-vbeln
    > AND parvw = 'WE'.
    > MODIFY i_list.
    > ENDLOOP.
    > *END JR
    >
    > gt_outtab[] = i_list[].
    > COMMIT WORK AND WAIT.
    >
    >
    > ENDFORM.
    >
    > *----
    > -
    > * FORM alv *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM alv.
    >
    > PERFORM e03_eventtab_build USING gt_events[]. "+EC1
    > PERFORM e04_comment_build USING
    > gt_list_top_of_page[]. "+EC1
    > prognm = sy-repid. "+EC1
    >
    >
    > CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    > EXPORTING
    > i_callback_user_command = 'USER_COMMAND'
    > i_callback_program = g_repid
    > it_fieldcat = gt_fieldcat[]
    > it_events = gt_events[] "+ESC
    > it_sort = it_sort[]
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > is_variant = g_variant
    > i_save = g_save
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    > TABLES
    > t_outtab = gt_outtab.
    >
    > COMMIT WORK AND WAIT.
    >
    >
    > ENDFORM.
    >
    >
    > *----
    > -
    > * FORM fieldcat_init *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > * --> I_FIELDCAT *
    > *----
    > -
    > FORM fieldcat_init
    > USING i_fieldcat TYPE slis_t_fieldcat_alv.
    > DATA: ls_fieldcat TYPE slis_fieldcat_alv.
    > DATA: pos TYPE i VALUE 1.
    > CLEAR ls_fieldcat.
    <b>Please note to keep on incrementing pos variable for column position.</b>
    <b> pos = pos + 1.</b>
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'VBELN'.
    > ls_fieldcat-ref_tabname = 'VBAK'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    <b> pos = pos + 1.</b> ===> after every append to field catalog.
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'POSNR'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    <b>> ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'ETERN'.
    > ls_fieldcat-ref_tabname = 'VBEP'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.</b>
    >
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'MATNR'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'MVGR1'.
    > ls_fieldcat-ref_tabname = 'MVKE'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'WERKS'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > * ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'LGORT'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > * ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'ERDAT'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > * ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'WADAT_IST'.
    > ls_fieldcat-ref_tabname = 'LIKP'.
    > * ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'DAYS'.
    > ls_fieldcat-ref_fieldname = 'DAYS'.
    > ls_fieldcat-seltext_s = '# Of Days'.
    > ls_fieldcat-seltext_m = '# Of Days'.
    > ls_fieldcat-seltext_l = '# Of Days'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > *Begin CH01
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'KWMENG'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > ls_fieldcat-outputlen = 7.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'LFIMG'.
    > ls_fieldcat-ref_tabname = 'LIPS'.
    > ls_fieldcat-outputlen = 7.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'OBD'.
    > ls_fieldcat-seltext_s = 'OBD'.
    > ls_fieldcat-seltext_m = 'Outbound Del'.
    > ls_fieldcat-seltext_l = 'Outbound Delivery'.
    > ls_fieldcat-outputlen = 10.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > * ls_fieldcat-col_pos = pos.
    > * ls_fieldcat-fieldname = 'OBD_POS'.
    > * ls_fieldcat-seltext_s = 'OBD Ln'.
    > * ls_fieldcat-seltext_m = 'Outbound Del Ln'.
    > * ls_fieldcat-seltext_l = 'Outbound Del Line'.
    > * ls_fieldcat-outputlen = 10.
    > * APPEND ls_fieldcat TO i_fieldcat.
    > * CLEAR ls_fieldcat.
    > *
    > *End CH01
    >
    > *JR
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'SOLDTO'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > ls_fieldcat-seltext_m = 'Sold To'.
    > ls_fieldcat-seltext_l = 'Sold To'.
    > ls_fieldcat-outputlen = 10.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'SHIPTO'.
    > ls_fieldcat-ref_tabname = 'VBPA'.
    > ls_fieldcat-seltext_m = 'Ship To'.
    > ls_fieldcat-seltext_l = 'Ship To'.
    > ls_fieldcat-outputlen = 10.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    > *END JR
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'EDATU'.
    > ls_fieldcat-ref_tabname = 'VBEP'.
    > ls_fieldcat-seltext_m = 'Requested Delivery date'.
    > ls_fieldcat-seltext_l = 'Requested Delivery date'.
    > ls_fieldcat-outputlen = 20.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    >
    > *FOR ALV SORT & SUBTOTAL
    > CLEAR it_sort.
    > it_sort-spos = '0'.
    > it_sort-fieldname = 'VBELN'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    >
    > CLEAR it_sort.
    > it_sort-spos = '1'.
    > it_sort-fieldname = 'POSNR'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > it_sort-subtot = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    > *
    > CLEAR it_sort.
    > it_sort-spos = '2'.
    > it_sort-fieldname = 'MATNR'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    >
    > CLEAR it_sort.
    > it_sort-spos = '3'.
    > it_sort-fieldname = 'MVGR1'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    > *
    > CLEAR it_sort.
    > it_sort-spos = '4'.
    > it_sort-fieldname = 'ERDAT'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    >
    >
    > CLEAR it_sort.
    > it_sort-spos = '5'.
    > it_sort-fieldname = 'WADAT_IST'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-down = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    >
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '6'.
    > * it_sort-fieldname = 'PERNR'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '7'.
    > * it_sort-fieldname = 'VORNA'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '8'.
    > * it_sort-fieldname = 'NACHN'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '9'.
    > * it_sort-fieldname = 'VKGRP'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '10'.
    > * it_sort-fieldname = 'VBELN'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '11'.
    > * it_sort-fieldname = 'ERDAT'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '12'.
    > * it_sort-fieldname = 'BEZEI'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    >
    > * clear it_sort.
    > * it_sort-spos = '1'.
    > * it_sort-fieldname = 'BELNR'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > * append it_sort.
    >
    >
    > ENDFORM.
    >
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > *&----
    > -
    > *& Form VARIANT_INIT
    > *&----
    > -
    > * text
    > *----
    > -
    > * --> p1 text
    > * <-- p2 text
    > *----
    > -
    > FORM variant_init.
    > *
    > CLEAR g_variant.
    > g_variant-report = g_repid.
    > ENDFORM. " VARIANT_INIT
    >
    >
    >
    > *----
    > -
    > * FORM f4_for_variant *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM f4_for_variant.
    > *
    > CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    > EXPORTING
    > is_variant = g_variant
    > i_save = g_save
    > * it_default_fieldcat =
    > IMPORTING
    > e_exit = g_exit
    > es_variant = gx_variant
    > EXCEPTIONS
    > not_found = 2.
    > IF sy-subrc = 2.
    > MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
    > WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    > ELSE.
    > IF g_exit = space.
    > p_vari = gx_variant-variant.
    > ENDIF.
    > ENDIF.
    > ENDFORM.
    > *&----
    > -
    > *& Form PAI_OF_SELECTION_SCREEN
    > *&----
    > -
    > * text
    > *----
    > -
    > FORM pai_of_selection_screen.
    > *
    > IF NOT p_vari IS INITIAL.
    > MOVE g_variant TO gx_variant.
    > MOVE p_vari TO gx_variant-variant.
    > CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
    > EXPORTING
    > i_save = g_save
    > CHANGING
    > cs_variant = gx_variant.
    > g_variant = gx_variant.
    > ELSE.
    > PERFORM variant_init.
    > ENDIF.
    > ENDFORM. " PAI_OF_SELECTION_SCREEN
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    >
    >
    > *----
    > -
    > * FORM e03_eventtab_build *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > * --> E03_LT_EVENTS *
    > *----
    > -
    > FORM e03_eventtab_build USING e03_lt_events TYPE
    > slis_t_event.
    > DATA: ls_event TYPE slis_alv_event.
    >
    > CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    > EXPORTING
    > i_list_type = 0
    > IMPORTING
    > et_events = e03_lt_events.
    > READ TABLE e03_lt_events WITH KEY name =
    > slis_ev_top_of_page
    > INTO ls_event.
    > IF sy-subrc = 0.
    > MOVE gc_formname_top_of_page TO ls_event-form.
    > APPEND ls_event TO e03_lt_events.
    > ENDIF.
    > ENDFORM.
    >
    > *----
    > -
    > * FORM e04_comment_build *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > * --> E04_LT_TOP_OF_PAGE *
    > *----
    > -
    > FORM e04_comment_build USING e04_lt_top_of_page TYPE
    > slis_t_listheader.
    > DATA: ls_line TYPE slis_listheader.
    >
    > *Report Title
    > CLEAR ls_line.
    > ls_line-typ = 'H'.
    > ls_line-info = text-007.
    > APPEND ls_line TO e04_lt_top_of_page.
    > *
    > *
    > **Doc Type Desc.
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-008.
    > ** ls_line-info = p_matnr.
    > * append ls_line to e04_lt_top_of_page.
    > *
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-009.
    > ** ls_line-info = p_werks.
    > * append ls_line to e04_lt_top_of_page.
    > *
    > *
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-010.
    > ** ls_line-info = p_stlan.
    > * append ls_line to e04_lt_top_of_page.
    > *
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-011.
    > ** ls_line-info = p_stlal.
    > * append ls_line to e04_lt_top_of_page.
    > *
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-012.
    > ** ls_line-info = p_stlal.
    > * append ls_line to e04_lt_top_of_page.
    >
    >
    >
    > ENDFORM.
    >
    > *----
    > -
    > * FORM top_of_page *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM top_of_page.
    >
    > CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    > EXPORTING
    > it_list_commentary = gt_list_top_of_page.
    >
    >
    > ENDFORM.
    >
    > *----
    > -
    > * FORM auth_check *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM auth_check.
    >
    > AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'
    > ID 'VKORG' FIELD p_vkorg.
    > IF sy-subrc NE 0.
    > MESSAGE e054 WITH p_vkorg.
    > ENDIF.
    >
    >
    > ENDFORM. " auth_check
    >
    >
    > *&----
    > -
    > *& Form USER_COMMAND
    > *&----
    > -
    > FORM user_command USING r_ucomm LIKE sy-ucomm
    > rs_selfield TYPE slis_selfield.
    >
    > CASE r_ucomm.
    > WHEN '&IC1'.
    > PERFORM display_so_order USING r_ucomm
    > rs_selfield.
    >
    > ENDCASE.
    >
    > ENDFORM.
    >
    > *&----
    > -
    > *& Form display_sales_order
    > *&----
    > -
    > * text
    > *----
    > -
    > * -->P_R_UCOMM text
    > * -->P_RS_SELFIELD text
    > *----
    > -
    > FORM display_so_order USING r_ucomm LIKE sy-ucomm
    > rs_selfield TYPE slis_selfield.
    >
    > CASE rs_selfield-sel_tab_field.
    > WHEN '1-VBELN'.
    > SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
    > CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    > WHEN '1-MATNR'.
    > SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
    > CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
    > WHEN '1-OBD'.
    > SET PARAMETER ID 'VL' FIELD rs_selfield-value.
    > CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
    > WHEN OTHERS.
    > MESSAGE i000(z1) WITH 'Please Click on the Valid
    > Selection'.
    > EXIT.
    > ENDCASE.
    >
    >
    > ENDFORM. " display_sales_order
    >
    > *----
    > -
    > * FORM EDit_table *
    > *----
    > -
    > * ........ *
    > *----
    > -
    Message was edited by: Anurag Bankley

  • SSRS 2008 R2 - Separate report for Each record?

    Hi,
    How do I create new pdf reports for each records from a table? The pdf files should be named as customerid.pdf and needs to be delivered in email or share path? 
    Each record has enough content for 5 page of pdf report.
    How do we achieve this?
    Thanks
    Raj

    You can create a data driven subscription to loop through records in the table and create pdf based on number of customerid.
    Have a look at this for DD subscriptions :
    http://msdn.microsoft.com/en-us/library/ms169673.aspx
    Kind Regards, Vikram Kansal Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker

  • Table cntrol field to be display/Change only For each record

    Hi all,
    How to set a particular Field in table control either as display only or
    change only for <b>each row</b> based on certain condition.I need to set this property for each record in table control not for the entire coloumn?.I know the procedure for setting up an entire coloumn in table control either as diplay or change only using <b>Loop at screen</b> statement.
    Conditions:
    If Material is batch managed:
    itab-batch field has to be <b>Display only</b> mode.
    if material is not batch managed:
    itab-batch field has to be <b>change mode</b>.
    <b>O/p of Table Control :</b>
    Material     Batch
    1000         Display only
    2000        Change only
    8000        Change only
    3500        Display only
    3600        Display only

    Hi Ravi,
              Thanks for your reply.I have put the code as u said. It is modifying the whole coloumn insted of  modifying Current row of the coloumn.
    I have tried to modify the screen property using  Table control attributes (TC-COLS).The following commented code is that logic.Even that also doing the same thing.Can yoy please tell me how to do it.
    MODULE tc_get_lines OUTPUT.
    LOOP AT SCREEN.
        IF screen-name = 'X_ZPINV-CHARG'.
          IF fg_batch = ' '.
            screen-input = 0.
          ELSE.
            screen-input = 1.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    LOOP AT tc-cols INTO tc_wa
      WHERE screen-name = 'X_ZPINV-CHARG'.
       IF x_zpinv-matnr IS NOT INITIAL.
         CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
           EXPORTING
             input  = x_zpinv-matnr
           IMPORTING
             output = v_matnr.
         SELECT SINGLE * FROM marc WHERE matnr = v_matnr
         AND werks = w_plant.
         IF marc-xchar IS INITIAL.
           tc_wa-screen-input = 0.
         ELSE.
           tc_wa-screen-input = 1.
         ENDIF.
         MODIFY tc-cols FROM tc_wa INDEX sy-tabix."    transporting screen-input
       ENDIF.
    ENDLOOP.
    ENDMODULE.                    "TC_GET_LINES OUTPUT

  • Mapping issue: FCC: Idoc for each record in file

    Hi,
    I have file to Idoc scenario.
    I receive csv file with multiple records.
    The requirement is to create an Idoc for each record.
    For eg.
    source file
    A1,B1,C1
    A2,B2,C2
    A3,B3,C3
    After FCC
    <MT>
    <TRANS>
    <ROW>
    <A>A1</A>
    <B>B1</B>
    <C>C1</C>
    </ROW>
    <ROW>
    <A>A2</A>
    <B>B2</B>
    <C>C2</C>
    </ROW>
    <ROW>
    <A>A3</A>
    <B>B3</B>
    <C>C3</C>
    </ROW>
    </TRANS>
    <MT>
    I have first tested it with only 1 record to test end to end connectivity. It works as expected and Idoc is posted to target system.
    Now when I am trying to send multiple records, I am getting some issues.
    Below are the steps that I have taken to process multiple records:
    1. Changed the cardinality of ROW (child of RecordSet) from 1 to Unbounded.
    2. Changed the occurance of Idoc to Unbounded.
    3. Mapped ROW to Idoc root.
    I have tested the mapping in IR and it generates multiple IDOCs.
    When I send the test file, it fails with error Tag found instead of tag IDOC BEGIN=
    I can see the xml message created with multiple ROWs in XI by File adapter in sxmb_moni.
    When I do Test Configuration in ID, with the XML message extracted from sxmbmoni, the result that I got was:_
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge"><ns0:Message1></ns0:Message1></ns0:Messages>
    This means that idoc was not created while mapping.
    But the same sample message works OK in IR!
    Pls help where I have missed.
    Regards,
    Anirudh.

    Sudhir,
    Thanks for your response.
    FCC is working fine. I have taken the XML message in XI created after FCC from csv sample message.
    I have tested this message in IR by placing it between
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
       <ns0:Message1>
    </ns0:Message1>
    </ns0:Message>
    It is working fine and Idocs are created in mapping in IR.
    But the same sample message is creating below output ID!
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge"><ns0:Message1></ns0:Message1></ns0:Messages>
    Regards,
    Anirudh.

  • Create single message in receiving side for each record in the sender file

    Dear Experts,
    My Interface is from FILE to MQ (JMS)..
    I have a specific requirement in my project, I have multiple files in sender directory ( /tmp)
    Ex: FILE_20090202.TXT
    FILE_20090203.TXT
    FILE_20090204.TXT
    FILE_20090205.TXT
    And each file has couple of records just shown below:
    ABC   123     WER    SER
    BCD   345     WEDR    SER
    CDE   567     GHTE   DDGG u2026. Etc..
    I have to process all the files at a time ( may be I can use file masking by FILE*.txt) , one message has to be created in MQ for each record of the file..
    Ex:
    Message 1: ABC   123     WER    SER
    Message 2: BCD   345     WEDR    SER
    Message 3: CDE   567     GHTE   DDGG
    Valuable inputs are appiciated !!
    Cheers,
    Kumar

    As already suggested, multi-mapping can be used
    You need to set target root node occurrence to unbounded and map root node accordingly
    you will have to use enhanced interface determinaion
    For detail refer:
    /people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible

  • To create 5 different files in target for each record in the sender file

    Hi SapAll,
    i have got a a requirement where pi need to create 5 different files with data of each record from the sender side.
    Its an file to file scenario
    suppose there are 5 rows in a file , then in target side i need to create 5 diff with each one record in it.
    Can we do it without using 3 comm channels
    Thanks&regards,
    Sai

    Hey,
    As a more generic solution, can you try using MultiMapping. It is supposed to generate multiple instances of messages on receiver side.
    /people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible
    You just need to put a simple logic in Message Mapping to generate new Node for every occurence of source field.
    Thanks
    Aamir

Maybe you are looking for

  • How do I change my old apple ID to my new one on imessenger.

    How do I change my old apple ID to my new one on imessenger. Is asking me for my old password but it does not recognize it.  Imessenger still recognizes my old apple id but not the password. How do i switch it to my new apple id.

  • Change Document program Generation

    Hi all, We are trying to capture changes to several ECC tables. We want to capture any change to that table. We want to know what kind of change (Insert, delete or update) and then the key of the record that has changed. Our goal is to capture the mo

  • Administrator

      The computer is mine and I am the only one who use it. Long ago i set up a password. Somehow I have to do something wrong because since then, I can't open that account not even once. And I have to use the guest account since then what can I do I do

  • Regarding multiple invoices

    Hai Please help me out from this problem When ever I had created the order for consignement fill up and had already delivered and note down the document number.with this number the system is picking out for multiple invoices. I had already checked in

  • Lightroomm 5,lightroom mobile, sync

    Hi. I have lightroom 5 which was installed from disc and i have since purchased adobe cc. i also installed the trial of lightroom mobile when it was first released. Now my i am trying to sync lightroom mobile but it is telling me that my trial has ex