Column is summing up all the rows and displaying same value in all rows.

Hi,
Kindly see the below query. I have a problem in this query to fetch the abs_qty when the parameter P:item ie)msib.segment1 is not given as the input parameter. Its just summing up the entire quantity for all the items.When I pass P:item ie)msib.segment1 as input parameter, It fetches the exact value for abs_qty. Kindly help me to resolve this.
Note only : Manufacturing plant ,Start date and End Date are Mandatory(required) parameters. Others like Item,Base Model and Planner code are optional.
SELECT mmt.transaction_date date_produced, msib.segment1 item,
cic.cost_type_id, msib.description item_description,
mc.segment6 base_model, mc.segment7 trade_brand,
mmt.subinventory_code subinventory,
mil.segment1 || '.' || mil.segment2 || '.' || mil.segment3 LOCATOR,
ood.organization_code
|| '-'
|| ood.organization_name manufacturing_plant,
mmt.transaction_quantity quantity_produced,
mtt.transaction_type_name transaction_type, msib.inventory_item_id,
msib.organization_id, cic.material_cost COST,
cic.material_overhead_cost freight, csc.standard_cost,
*(select (NVL((SELECT SUM (mmt.transaction_quantity) total_NET_qty*
FROM mtl_material_transactions mmt,
mtl_system_items_b msib,
mtl_transaction_types mtt,
org_organization_definitions ood,
mtl_txn_source_types mts
WHERE mmt.organization_id = msib.organization_id
AND msib.inventory_item_id = mmt.inventory_item_id
AND mmt.transaction_type_id = mtt.transaction_type_id
AND mmt.organization_id = ood.organization_id
AND mtt.transaction_type_name = 'WIP Completion'
AND mts.transaction_source_type_name = 'Job or Schedule'
AND msib.segment1 = NVL (:p_item, msib.segment1)
AND ood.organization_code = :p_manufacturing_plant
AND TRUNC (mmt.transaction_date) BETWEEN :p_start_date
AND :p_end_date ),0)
*(NVL((SELECT SUM (mmt.transaction_quantity) total_NET_qty*
FROM mtl_material_transactions mmt,
mtl_system_items_b msib,
mtl_transaction_types mtt,
org_organization_definitions ood,
mtl_txn_source_types mts
WHERE mmt.organization_id = msib.organization_id
AND msib.inventory_item_id = mmt.inventory_item_id
AND mmt.transaction_type_id = mtt.transaction_type_id
AND mmt.organization_id = ood.organization_id
AND mtt.transaction_type_name = 'WIP Issue'
AND mts.transaction_source_type_name = 'Job or Schedule'
AND msib.segment1 = NVL (:p_item, msib.segment1)
AND ood.organization_code = :p_manufacturing_plant
AND TRUNC (mmt.transaction_date) BETWEEN :p_start_date
AND :p_end_date
*),0))) abs_qty from dual) AS ABS_qtyy,*(select (NVL((SELECT SUM (mmt.transaction_quantity) total_NET_qty
FROM mtl_material_transactions mmt,
mtl_system_items_b msib,
mtl_transaction_types mtt,
org_organization_definitions ood,
mtl_txn_source_types mts
WHERE mmt.organization_id = msib.organization_id
AND msib.inventory_item_id = mmt.inventory_item_id
AND mmt.transaction_type_id = mtt.transaction_type_id
AND mmt.organization_id = ood.organization_id
AND mtt.transaction_type_name = 'WIP Completion'
AND mts.transaction_source_type_name = 'Job or Schedule'
AND msib.segment1 = NVL (:p_item, msib.segment1)
AND ood.organization_code = :p_manufacturing_plant
AND TRUNC (mmt.transaction_date) BETWEEN :p_start_date
AND :p_end_date ),0)
(NVL((SELECT SUM (mmt.transaction_quantity) total_NET_qty
FROM mtl_material_transactions mmt,
mtl_system_items_b msib,
mtl_transaction_types mtt,
org_organization_definitions ood,
mtl_txn_source_types mts
WHERE mmt.organization_id = msib.organization_id
AND msib.inventory_item_id = mmt.inventory_item_id
AND mmt.transaction_type_id = mtt.transaction_type_id
AND mmt.organization_id = ood.organization_id
AND mtt.transaction_type_name = 'WIP Issue'
AND mts.transaction_source_type_name = 'Job or Schedule'
AND msib.segment1 = NVL (:p_item, msib.segment1)
AND ood.organization_code = :p_manufacturing_plant
AND TRUNC (mmt.transaction_date) BETWEEN :p_start_date
AND :p_end_date
),0))) abs_qty from dual)*csc.standard_cost AS abs_val
FROM mtl_material_transactions mmt,
mtl_system_items_b msib,
mtl_item_locations mil,
mtl_transaction_types mtt,
org_organization_definitions ood,
mtl_txn_source_types mts,
mtl_categories mc,
mtl_item_categories mic,
mtl_category_sets mcs,
cst_item_costs cic,
cst_standard_costs csc,
cst_cost_types ct,
mfg_lookups mlo
WHERE mmt.organization_id = msib.organization_id
AND msib.inventory_item_id = mmt.inventory_item_id
AND mmt.locator_id = mil.inventory_location_id
AND mil.organization_id = msib.organization_id
AND mil.subinventory_code = mmt.subinventory_code
AND mmt.transaction_type_id = mtt.transaction_type_id
AND msib.organization_id = ood.organization_id
AND mic.category_set_id = mcs.category_set_id
AND mc.category_id = mic.category_id
AND mc.structure_id = mcs.structure_id
AND mic.inventory_item_id = msib.inventory_item_id
AND mic.organization_id = msib.organization_id
AND mcs.category_set_id = 52487965
AND msib.inventory_item_id = cic.inventory_item_id
AND msib.organization_id = cic.organization_id
AND ct.cost_type_id = cic.cost_type_id
AND cic.organization_id = ood.organization_id
AND mil.inventory_location_id = mmt.locator_id
AND mmt.transaction_source_type_id = mtt.transaction_source_type_id
AND mmt.transaction_action_id = mtt.transaction_action_id
AND mmt.transaction_source_type_id = mts.transaction_source_type_id
AND mmt.transaction_action_id = mlo.lookup_code
AND mmt.inventory_item_id = csc.inventory_item_id
AND mmt.organization_id = csc.organization_id
AND csc.last_update_date >=
(SELECT MAX (csc1.last_update_date)
FROM cst_standard_costs csc1
WHERE csc1.inventory_item_id = mmt.inventory_item_id
AND csc1.organization_id = mmt.organization_id)
AND msib.segment1 = NVL (:p_item, msib.segment1)
AND NVL (mc.segment6, 'X') = NVL (:p_base_model, NVL (mc.segment6, 'X'))
AND NVL (msib.planner_code, 'Y') =
NVL (:p_planner_code, NVL (msib.planner_code, 'Y'))
AND UPPER (mlo.meaning) = 'ASSEMBLY COMPLETION'
AND mtt.transaction_type_name = 'WIP Completion'
AND ct.cost_type = 'Frozen'
AND mts.transaction_source_type_name = 'Job or Schedule'
AND ood.organization_code = :p_manufacturing_plant
AND TRUNC (mmt.transaction_date) BETWEEN :p_start_date AND :p_end_date

If <tt>abs_qty</tt> and consequently <tt>abs_val</tt> should not be the same for all rows returned, you'll have to rewrite your query so that the <tt>abs_qty</tt> won't be computed in isolation (separately) with no interaction with data from the main from table list.
Your query is treated the same as the one below (note the changed table aliases by appending numbers to the originals of yours)
SELECT mmt.transaction_date date_produced,
       msib.segment1 item,
       cic.cost_type_id,
       msib.description item_description,
       mc.segment6 base_model,
       mc.segment7 trade_brand,
       mmt.subinventory_code subinventory,
       mil.segment1 || '.' || mil.segment2 || '.' || mil.segment3 LOCATOR,
       ood.organization_code || '-' || ood.organization_name manufacturing_plant,
       mmt.transaction_quantity quantity_produced,
       mtt.transaction_type_name transaction_type,
       msib.inventory_item_id,
       msib.organization_id,
       cic.material_cost COST,
       cic.material_overhead_cost freight,
       csc.standard_cost,
       (select (NVL(
                    (SELECT SUM (mmt1.transaction_quantity) total_NET_qty
                       FROM mtl_material_transactions mmt1,
                            mtl_system_items_b msib1,
                            mtl_transaction_types mtt1,
                            org_organization_definitions ood1,
                            mtl_txn_source_types mts1
                      WHERE mmt1.organization_id = msib1.organization_id
                        AND msib1.inventory_item_id = mmt1.inventory_item_id
                        AND mmt1.transaction_type_id = mtt1.transaction_type_id
                        AND mmt1.organization_id = ood1.organization_id
                        AND mtt1.transaction_type_name = 'WIP Completion'
                        AND mts1.transaction_source_type_name = 'Job or Schedule'
                        AND msib1.segment1 = NVL (:p_item, msib1.segment1)
                        AND ood1.organization_code = :p_manufacturing_plant
                        AND TRUNC (mmt1.transaction_date) BETWEEN :p_start_date AND :p_end_date
                    ),0
                   ) - NVL(
                           (SELECT SUM (mmt2.transaction_quantity) total_NET_qty
                              FROM mtl_material_transactions mmt2,
                                   mtl_system_items_b msib2,
                                   mtl_transaction_types mtt2,
                                   org_organization_definitions ood2,
                                   mtl_txn_source_types mts2
                             WHERE mmt2.organization_id = msib2.organization_id
                               AND msib2.inventory_item_id = mmt2.inventory_item_id
                               AND mmt2.transaction_type_id = mtt2.transaction_type_id
                               AND mmt2.organization_id = ood.2organization_id
                               AND mtt2.transaction_type_name = 'WIP Issue'
                               AND mts2.transaction_source_type_name = 'Job or Schedule'
                               AND msib2.segment1 = NVL (:p_item, msib2.segment1)
                               AND ood2.organization_code = :p_manufacturing_plant
                               AND TRUNC (mmt.2transaction_date) BETWEEN :p_start_date AND :p_end_date
                           ),0
               ) abs_qty
          from dual
       ) AS ABS_qtyy,
       (select (NVL(
                    (SELECT SUM (mmt3.transaction_quantity) total_NET_qty
                       FROM mtl_material_transactions mmt3,
                            mtl_system_items_b msib3,
                            mtl_transaction_types mtt3,
                            org_organization_definitions ood3,
                            mtl_txn_source_types mts3
                      WHERE mmt3.organization_id = msib3.organization_id
                        AND msib3.inventory_item_id = mmt3.inventory_item_id
                        AND mmt3.transaction_type_id = mtt3.transaction_type_id
                        AND mmt3.organization_id = ood3.organization_id
                        AND mtt3.transaction_type_name = 'WIP Completion'
                        AND mts3.transaction_source_type_name = 'Job or Schedule'
                        AND msib3.segment1 = NVL (:p_item, msib3.segment1)
                        AND ood3.organization_code = :p_manufacturing_plant
                        AND TRUNC (mmt3.transaction_date) BETWEEN :p_start_date AND :p_end_date
                    ),0
                   ) - NVL(
                           (SELECT SUM (mmt4.transaction_quantity) total_NET_qty
                              FROM mtl_material_transactions mmt4,
                                   mtl_system_items_b msib4,
                                   mtl_transaction_types mtt4,
                                   org_organization_definitions ood4,
                                   mtl_txn_source_types mts4
                             WHERE mmt4.organization_id = msib4.organization_id
                               AND msib4.inventory_item_id = mmt4.inventory_item_id
                               AND mmt4.transaction_type_id = mtt4.transaction_type_id
                               AND mmt4.organization_id = ood4.organization_id
                               AND mtt4.transaction_type_name = 'WIP Issue'
                               AND mts4.transaction_source_type_name = 'Job or Schedule'
                               AND msib4.segment1 = NVL (:p_item, msib4.segment1)
                               AND ood4.organization_code = :p_manufacturing_plant
                               AND TRUNC (mmt4.transaction_date) BETWEEN :p_start_date AND :p_end_date
                           ),0
               ) abs_qty
          from dual
       ) * csc.standard_cost AS abs_val
  FROM mtl_material_transactions mmt,
       mtl_system_items_b msib,
       mtl_item_locations mil,
       mtl_transaction_types mtt,
       org_organization_definitions ood,
       mtl_txn_source_types mts,
       mtl_categories mc,
       mtl_item_categories mic,
       mtl_category_sets mcs,
       cst_item_costs cic,
       cst_standard_costs csc,
       cst_cost_types ct,
       mfg_lookups mlo
WHERE mmt.organization_id = msib.organization_id
   AND msib.inventory_item_id = mmt.inventory_item_id
   AND mmt.locator_id = mil.inventory_location_id
   AND mil.organization_id = msib.organization_id
   AND mil.subinventory_code = mmt.subinventory_code
   AND mmt.transaction_type_id = mtt.transaction_type_id
   AND msib.organization_id = ood.organization_id
   AND mic.category_set_id = mcs.category_set_id
   AND mc.category_id = mic.category_id
   AND mc.structure_id = mcs.structure_id
   AND mic.inventory_item_id = msib.inventory_item_id
   AND mic.organization_id = msib.organization_id
   AND mcs.category_set_id = 52487965
   AND msib.inventory_item_id = cic.inventory_item_id
   AND msib.organization_id = cic.organization_id
   AND ct.cost_type_id = cic.cost_type_id
   AND cic.organization_id = ood.organization_id
   AND mil.inventory_location_id = mmt.locator_id
   AND mmt.transaction_source_type_id = mtt.transaction_source_type_id
   AND mmt.transaction_action_id = mtt.transaction_action_id
   AND mmt.transaction_source_type_id = mts.transaction_source_type_id
   AND mmt.transaction_action_id = mlo.lookup_code
   AND mmt.inventory_item_id = csc.inventory_item_id
   AND mmt.organization_id = csc.organization_id
   AND csc.last_update_date >= (SELECT MAX (csc1.last_update_date)
                                  FROM cst_standard_costs csc1
                                 WHERE csc1.inventory_item_id = mmt.inventory_item_id
                                   AND csc1.organization_id = mmt.organization_id
   AND msib.segment1 = NVL (:p_item, msib.segment1)
   AND NVL (mc.segment6, 'X') = NVL (:p_base_model, NVL (mc.segment6, 'X'))
   AND NVL (msib.planner_code, 'Y') = NVL (:p_planner_code, NVL (msib.planner_code, 'Y'))
   AND UPPER (mlo.meaning) = 'ASSEMBLY COMPLETION'
   AND mtt.transaction_type_name = 'WIP Completion'
   AND ct.cost_type = 'Frozen'
   AND mts.transaction_source_type_name = 'Job or Schedule'
   AND ood.organization_code = :p_manufacturing_plant
   AND TRUNC (mmt.transaction_date) BETWEEN :p_start_date AND :p_end_dateRegards
Etbin

Similar Messages

  • Is there a way to open Excell file from the server and display in the UI and save it back on to the

    Hello there,
    Is there a way to open Excell file from the server and display in the UI and save it back on to the server? (like showing xell file as a datagrid - add rows, columns etc.)

    Hi Mike,
    Welcome you to the forum.
    You may try:
    SELECT * FROM MyDBNameHere.dbo.OUSR T0
    Thanks,
    Gordon

  • How to get and disply dynamic values on the fly and display in applet

    hello all ,
    i have a problem in refreshing a applet.
    i have a scrolling applet which will get the share values from the database and display in a scrolling applet in the browser . i am getting the values and displaying it.
    but the problem is , if i enter a new record in the database, until and unless i press refresh button of the browser, i am not getting the new values . please help me if anybody having the idea. please mail me to [email protected]
    thank you all.
    by
    samba

    You want a database update to trigger an applet refresh? Can't be done.
    However, you can have the applet periodically re-query the database and update its display with the information it retrieves. Just kick off a Thread that sleeps for a bit, wakes up, queries the db, updates the display, and goes back to sleep.

  • I am working in Numbers and can't seem to change the generic value assigned to the legend.  Any advice on how to select the legend and save new values?

    I am working in Numbers and can't seem to change the generic value assigned to the legend.  Any advice on how to select the legend and save new values?

    Ntenich,
    If your table has a Header and your Legend text is in the header, it will be picked up by the table.
    Jerry

  • Loading an image in the background and displaying it as it is loaded

    Hi,
    I'm writing an "image viewer" swing component, which should load an image in the background, and display it as it is loaded (for example each time a line of the image is loaded, display it)
    Is there a way to do this using JAI or any other api ?
    I guess i would need a way to check the loading progress from the EDT, get the loaded part of the image and display it. Am I right ? Is that possible ?
    Thanks,
    Nicolas

    In the video inspector set the Spatial Conform to "none". This will give tou the actual size of the image in the viewer. You can then use the transform controls to adjust the image to what you want to see.

  • Can I obtain the date of the exe and display it on the fropnt panel?

    Hello,
        Is there a way that a Labview program can display the date of the exe and display it on the front panel? I am aware of the version info on the application builder, but I did not see a way to get the date when the exe was created.
    Regards,
    Kaspar

    Hi
    You could use File/Directory Info function in your code like this
    cheers
    David
    Message Edited by David Crawford on 02-24-2010 11:11 PM
    Message Edited by David Crawford on 02-24-2010 11:12 PM
    Attachments:
    App Last Mod.png ‏17 KB

  • Is iTunes card in the US and Philippines same?

    Is iTunes card in the US and Philippines same?

    Sorry dosaxl,
    I thought that link would provide both....my bad. Here are two links that may help:
    Send iTunes Gifts - Apple Support (this one appears to allow you to gift amounts to people electronically)
    http://www.apple.com/asia/support/itunes/cards-codes/ (this is the iTunes Asia support page which may provide you with additional info)
    I hope this helps! Sorry I sent you the Apple Store link before
    Cheers,
    GB

  • What happened to the Large and Display choices when exporting?

    What happened to the "Large" and "Display" choices when exporting slide shows?

    They were removed.

  • My iPhone 4S locked to Tmobile so I contacted to Tmobile and submitted unlocking form, but I got a replied said my IMEI number was not recognized. So I tried second and third time submitted the form and got same reply.

    My iPhone 4S locked to Tmobile so I contacted to Tmobile and submitted unlocking form, but I got a replied said my IMEI number was not recognized. So I tried second and third time submitted the form and got same reply.  I've been using same handset they issued to and never changed. But I have know idea why they said they don't recognised my IMEI number. Can anyone help me to solve this issue. Thanks

    You need to call T-Mobile or visit a T-Mobile retail store.

  • How to call the column names into the prompt and display values dynamically

    Hi,
    i have a typical requirement where I have to call 3 columns into the AGE Prompt (I know we can use the Column Selector to call the columns) .Below is the Screen Shot.
    !http://i46.tinypic.com/2qjfukh.jpg!
    2nd Requirement)
    The three columns I have are order Date, Ship Date and Entry Date.
    Whenever I click on Orderdate from the Prompt, It should dynamically show its values in the report.
    and When I click on the Ship Date from the Prompt, it should display the corresponding values in the report.
    and so on with the Entry Date.
    Can anybody help me how to acheive this.
    Thanks a ton.

    Ok so then you can use a fake column prompt. Here's one quick approach (nicer and cleaner with LOV tables but I don't if you have any of those).
    - Create a fresh prompt using any column you want.
    - Open the column formula using the fx button and replace the formula with 'abc'.
    - Use "SqL Results" as the "Show" option.
    - SQL:
    select case when 1=0 the Markets.Region else 'Order Date' from Paint.Markets UNION ALL
    select case when 1=0 the Markets.Region else 'Ship Date' from Paint.Markets UNION ALL
    select case when 1=0 the Markets.Region else 'Entry Date' from Paint.Markets
    - Set Variable = Presentation Variable = @{vPresVarSelectedDate}{Order Date}
    - Label = Date
    Then in the request, you change the column formula for the date. I'm going to make it short and just assume you called your time dimension alias(es) like the lowest grain:
    "@{vPresVarSelectedDate}{Order Date}"."@{vPresVarSelectedDate}{Order Date}"
    Cheers,
    C.

  • Can I change my apple id with keeping all the apps and things same?

    I would like to change my apple Id but would like to keep all the apps and everything in my Macbook and Iphone as it is. Is there any way to do that?

    App Store Frequently Asked Questions (FAQ) - http://support.apple.com/kb/HT2001 when using iTunes --> "To change countries, scroll to the end of the iTunes Store home page and click the flag indicating the current country. To choose a different country, click the appropriate flag."
    iOS: Changing the signed-in iTunes Store account - http://support.apple.com/kb/HT1311  - Change your iTunes Store country: "Sign in to the account for the iTunes Store region you'd like to use. Tap Settings > iTunes & App Stores > Apple ID: > View Apple ID > Country/Region."
    You will, of course, need to change your address and enter valid credit card information after you have changed the settings.
    iTunes Store: Changing Account Information - http://support.apple.com/kb/HT1918
    Further tips on changing country - https://discussions.apple.com/message/20029737 - problems you encounter when changing iTunes country

  • Scan through the records in the Form and display the message!

    Hello Everyone,
    We have a requirement, I do not know how to achieve it.
    In a Forms 6i, 2 fields Type, Comment.
    Type is a list of Values (1,2,3)
    Comment - Free Text Field.
    User can enter as much rows of data, but while user saves the data we have to validate that all the records of Same Type(Say 1). If not we have to display a Message.
    So how to achieve this? How to scan through the records in the Form. Any comments on it would be great.
    Thanks.

    User can enter as much rows of data, but while user saves the data we have to validate that all the records of Same Type(Say 1). If not we have to display a Message.I am assuming that you want to check from the first record. Suppose in first record the user coosed 1 and you will check for all the entries for 1.
    Couple of ways to do this.
    1. While user is entering first record. You can keep that selected type value in GLOBAL variable and while he is entering further records you can match type with that global variable. If it is not matching then you can display message.
    2. On KEY-COMMIT trigger you can start loop from first record and can check for all the records one by one. Like.
    DECLARE
      vVal DATATYPE;
    BEGIN
      GO_BLOCK('BLOCK_NAME');
      FIRST_RECORD;
      vVal:=:FORM_TYPE_FIELD;
      LOOP
        IF vVal!=:FORM_TYPE_FIELD THEN
          MESSAGE(..);
          EXIT;
        END IF;
        EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
        NEXT_RECORD;
      END LOOP;
    END;I would go for earlier approach and will use WHEN-VALIDATE-ITEM / PRE-INSERT for type field for this purpose. Because in KEY-COMMIT the system is doing same thing again.
    -Ammad
    Edited by: Ammad Ahmed on May 15, 2010 12:23 AM
    changes not equal sign to !=

  • Poplist and displaying corresponding values from the database table

    Hi
    I have a poplist in a control block, the values of which are populated using a procedure. This is called in when-new-form-instance.
    This part works fine and values are filled in the poplist when form is opened..
    The datablock is based on a view. 3 columns from the view are selected to be displayed.
    Also the databock is filled with all values (for selected columns)
    Now when the poplist value is changed, I need the values in the datablock to be changed as well, but this is not happening.
    In my when-list-changed trigger, I have:
    go_block('datablock');
    execute_query;Please tell , where and what should I add to display the datablock values as per the poplist value.
    i.e, something like,
    select col1,col2,col3 from <view> where col4 =:control.col4
    Note:I tried in the where clause property of the block, but then nothing is displayed in the datablock
    Thanks

    This does not work , either..
    Before, when I changed the values from the list, it was still displaying same data on datablock always(all records)
    Now when I give this code,data is displayed in datablock only once(first time when the form opens)
    I have defined the Query data source type property on data block as "Table" but infact this datablock is based on a view..is this correct?
    Anything else I could try?

  • Reading the record and displaying when u select it using checkbox

    hi,
           how to read the particilar record and display it in a popup screen when u select it using checkbox and then press 'DISP' button in alv(normal alv not with oops concepts).
    like i select a row which is checked (checkbox) it and i have to read that particular record and display (value of keyfield say vbeln) details in a popup screen.

    hi,
    go through the faloowing code.
    this for normal popup.
    *& Report  ZGS_ALV_POPUP_2_SELECT
    REPORT  ZGS_ALV_POPUP_2_SELECT.
    TYPE-POOLS: slis.
    PARAMETERS: p_title TYPE sy-title default 'Sales Document:item data'.
    DATA: itab TYPE vbap OCCURS 0 WITH HEADER LINE,
          selfield TYPE slis_selfield.
    START-OF-SELECTION.
      SELECT *
        FROM vbap
        INTO TABLE itab
        UP TO 20 ROWS.
      CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
           EXPORTING
                i_title                 = p_title
    *           I_SELECTION             = 'X'
               I_ZEBRA                 = 'X '
    *           I_SCREEN_START_COLUMN   = 0
    *           I_SCREEN_START_LINE     = 0
    *           I_SCREEN_END_COLUMN     = 0
    *           I_SCREEN_END_LINE       = 0
    *           I_CHECKBOX_FIELDNAME    =
    *           I_LINEMARK_FIELDNAME    =
    *           I_SCROLL_TO_SEL_LINE    = 'X'
                i_tabname               = 'ITAB'
                i_structure_name        = 'VBAP'
    *           IT_FIELDCAT             =
    *           IT_EXCLUDING            =
    *           I_CALLBACK_PROGRAM      =
    *           I_CALLBACK_USER_COMMAND =
    *            is_private              =
         IMPORTING
                es_selfield             = selfield
    *            e_exit                  =
           TABLES
                t_outtab                = itab
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
        MESSAGE i000(8I) WITH sy-subrc.
      ENDIF.
      WRITE:
             /  'Table Index : ', 20 selfield-tabindex,
            /  'Table Name  : ', 15 selfield-tabname,
            /  'Field Name  : ', 15 selfield-fieldname,
            /  'Table-Field : ', 15 selfield-sel_tab_field,
            /  'Field Value : ', 15 selfield-value.
    the falowing code is for how to put checkbox and how to display the selected recods.you combine both codes.
    *& Report  ZRP_SALES
    REPORT  ZRP_SALES NO STANDARD PAGE HEADING.
    DATA: TEMP_DATE_STR TYPE STRING.
    *DATA: TEMP_NETP LIKE VBAK-NETWR.
    DATA: TEMP_NETWR(10).
    *DATA: TEMP_VBELN LIKE VBAK-VBELN.
    DATA: CHECK TYPE C VALUE ' '.
    *DATA: WA_VBELN LIKE VBAK-VBELN.
    DATA: TEMP_DATE LIKE VBAK-ERDAT.
    *DATA: TEMP_NETP_STR TYPE STRING.
    DATA:FNAM(20), FVAL(20).
    TYPES: BEGIN OF MY_VBAK,
           VTWEG TYPE VTWEG,
           VKORG TYPE VKORG,
           SPART TYPE SPART,
           NETWR TYPE NETWR_AK,
           VBELN TYPE VBELN_VA,
           ERDAT TYPE ERDAT,
           END OF MY_VBAK.
    DATA: IT_VBAK TYPE MY_VBAK OCCURS 0 WITH HEADER LINE.
    DATA: WA_VBAK TYPE MY_VBAK.
    DATA: V_VBELN TYPE VBELN,
          V_ERDAT TYPE ERDAT.
    SELECT-OPTIONS:S_VBELN FOR V_VBELN,
                   S_ERDAT FOR V_ERDAT.
    AT SELECTION-SCREEN.
    *Check for Sales Order number to be non-initial.
      IF  S_VBELN IS INITIAL.
    *Checking for Date to be non-nitial.
        IF  S_ERDAT IS INITIAL.
          MESSAGE E003(ZRP_MSG). " Please enter either SO number or Date.
        ELSE.
    *Validating the right low values for Date select option
          SELECT SINGLE ERDAT
                 FROM VBAK INTO TEMP_DATE
                 WHERE VBELN EQ S_VBELN-LOW OR ERDAT EQ S_ERDAT-LOW.
          IF SY-SUBRC NE 0.
            MESSAGE E004(ZRP_MSG).
          ENDIF.
    *Validating the right high values for Date select option
          SELECT SINGLE ERDAT
                  FROM VBAK INTO TEMP_DATE
                  WHERE ERDAT EQ S_ERDAT-HIGH OR VBELN EQ S_VBELN-HIGH.
          IF SY-SUBRC NE 0.
            MESSAGE E005(ZRP_MSG).
          ENDIF.
        ENDIF.
      ELSE.
    *Checking for Date to be non-nitial.
        IF  S_ERDAT IS NOT INITIAL.
          MESSAGE E003(ZRP_MSG). " Please enter either SO number or Date.
        ENDIF.
    *Validating the right low values
        SELECT SINGLE VBELN
               FROM VBAK INTO S_VBELN
               WHERE VBELN EQ S_VBELN-LOW.
        IF SY-SUBRC NE 0.
          MESSAGE E001(ZRP_MSG).
        ENDIF.
    *Validating the right high values
        IF S_VBELN-HIGH IS NOT INITIAL.
          SELECT SINGLE VBELN
                  FROM VBAK INTO S_VBELN
                  WHERE VBELN EQ S_VBELN-HIGH.
          IF SY-SUBRC NE 0.
            MESSAGE E002(ZRP_MSG).
          ENDIF.
        ENDIF.
      ENDIF.
    START-OF-SELECTION.
    *First Screen.
      SET PF-STATUS 'DISP'.
      IF S_VBELN IS NOT INITIAL.
        SELECT   VTWEG VKORG SPART NETWR VBELN ERDAT
               FROM VBAK
               INTO TABLE IT_VBAK
               WHERE VBELN IN S_VBELN.
      ENDIF.
      IF S_ERDAT IS NOT INITIAL.
        SELECT  VTWEG VKORG SPART NETWR VBELN ERDAT
               FROM VBAK
               INTO TABLE IT_VBAK
               WHERE ERDAT IN S_ERDAT.
      ENDIF.
      SORT IT_VBAK BY VKORG VTWEG SPART.
    END-OF-SELECTION.
      LOOP AT IT_VBAK.
        MOVE IT_VBAK-NETWR TO TEMP_NETWR.
        MOVE IT_VBAK-ERDAT TO TEMP_DATE.
        WRITE:/6 CHECK AS CHECKBOX.
        FORMAT COLOR 1.
        WRITE: IT_VBAK-VBELN UNDER 'SALES ORDER NO.' .
        WRITE: IT_VBAK-ERDAT UNDER 'DATE'.
        FORMAT COLOR OFF.
        FORMAT COLOR 2.
        WRITE: TEMP_NETWR UNDER 'NET PRICE'.
        FORMAT COLOR OFF."TEMP_NETWR,
        FORMAT COLOR 3.
        WRITE:IT_VBAK-VKORG UNDER 'SALES ORG',
              IT_VBAK-VTWEG UNDER 'DIST CHANNEL',
              IT_VBAK-SPART UNDER 'DIVISION'.
        FORMAT COLOR OFF.
        SKIP 1.
    *FOR SUBTOTALS
        AT END OF SPART.
          SUM.
          FORMAT COLOR 5.
          WRITE:/6 'SUB TOTOAL OF NET PRICE IS :  '.
          WRITE: 32 IT_VBAK-NETWR CURRENCY 'INR'.
          FORMAT COLOR OFF.
          SKIP 2.
        ENDAT.
    *FOR GRAND TOTALS
        AT LAST.
          SUM.
          FORMAT COLOR 6.
          WRITE:/6 'GRAND TOTOAL OF NET PRICE IS :  ',
          32 IT_VBAK-NETWR CURRENCY 'INR'.
          FORMAT COLOR 6.
        ENDAT.
      ENDLOOP.
    TOP-OF-PAGE.
      FORMAT COLOR  6.
      WRITE:/8    'SALES ORDER NO.',
           27   'DATE',
           42   'NET PRICE',
           57   'SALES ORG',
           70   'DIST CHANNEL',
           87   'DIVISION'.
      FORMAT COLOR OFF.
      SKIP 1.
    *WHEN SALES ORDER IS SELECTED
    AT LINE-SELECTION.
      CASE :SY-LSIND.
        WHEN '2'.
          GET CURSOR FIELD FNAM VALUE FVAL.
          IF FNAM <> 'WA_VBAK-VBELN'.
            MESSAGE E006(ZRP_MSG).
          ELSE.
            SET PARAMETER ID 'MAT' FIELD FVAL.
            CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
      ENDIF.
        ENDCASE.
    *WHEN CLICKED ON PUSH BUTTON IN THE APPLICATION BAR
    AT USER-COMMAND.
      CASE:SY-UCOMM.
        WHEN 'DISP'.
          DO.
            CLEAR CHECK.
            CLEAR: WA_VBAK,TEMP_DATE_STR.
            READ LINE SY-INDEX FIELD VALUE CHECK
               IT_VBAK-VTWEG INTO WA_VBAK-VTWEG
    *           IT_VBAK-NETWR INTO TEMP_NETP_STR
               IT_VBAK-VBELN INTO WA_VBAK-VBELN
               IT_VBAK-ERDAT INTO TEMP_DATE_STR
               IT_VBAK-VKORG INTO WA_VBAK-VKORG
               IT_VBAK-SPART INTO WA_VBAK-SPART.
            IF SY-SUBRC <> 0.
              EXIT.
            ELSEIF CHECK = 'X'.
              FORMAT COLOR 1.
              WRITE: 8 WA_VBAK-VBELN HOTSPOT. "UNDER 'SALES ORDER NO'
              WRITE: 25 TEMP_DATE_STR." UNDER 'DATE'.
              FORMAT COLOR OFF.
    *       FORMAT COLOR 2.
    *                   WRITE: 44 TEMP_NETP_STR." UNDER 'NET PRICE'.
    *       FORMAT COLOR OFF.
              FORMAT COLOR 3.
              WRITE:44 WA_VBAK-VKORG," UNDER 'SALES ORG',
             59 WA_VBAK-VTWEG," UNDER 'DIST CHANNEL',
             72  WA_VBAK-SPART." UNDER 'DIVISION'.
              FORMAT COLOR OFF.
              SKIP 1.
            ENDIF.
          ENDDO.
      ENDCASE.
    TOP-OF-PAGE DURING LINE-SELECTION.
      CASE:SY-LSIND.
        WHEN 1.
          FORMAT COLOR  6.
          WRITE:/8    'SALES ORDER NO.',
                 25   'DATE',
    *       44   'NET PRICE',
                 44   'SALES ORG',
                 58   'DIST CHANNEL',
                 72   'DIVISION'.
          SKIP 1.
          FORMAT COLOR  OFF.
    <b>if helpful reward some points.</b>
    Message was edited by:
            suredarreddy pulimamidi

  • Adding Colume in the Table and display result in it.

    Hi Guru's ,
    I have a requirement to add column in existing Table. and Display the result after calculation.
    Thanks,
    Rutu

    Hi,
    Please used this code snippet for reference:
    OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
    OAViewObject vo = (OAViewObject)am.findViewObject("<VO Name>"); // Give VO Name attached to the Table Region.
    if (vo != null)
    vo.addDynamicAttribute("<Att_Name>"); //Adding ViewAttribute to VO
    vo.reset();
    vo.next();
    //Do calculation that you want
    //Setting the calculated value in the created VO Attribute
    vo.getCurrentRow().setAttribute("<Att_Name>", <Value to assign>);
    I hope this will gives you a proper Help.
    Please feel free to ask if any more Question
    Thanks,
    Shrikant

Maybe you are looking for

  • I have a dynex 32" lcd tv and a pavilion dv6 and cant view the laptop on the tv using hdmi cables

    trying to view netfilx my computer has windows 7 when i plug in the hdmi cable in the computer screen goes black and there is no signal on tv

  • Cant download videos..

    Hi, I have been trying to download videos since couple of days now..i did change the ext of the file to the correct format needed for an ipod but still i cant download them.. When i go to mu Ipod properties..Under the vidoes option all the check boxe

  • Rights for all table

    Hi, I have a Role with the name siud_Data (select, insert, update, delete in shema Data). When a User has this Role, he can Select, Insert, Update and Delete in the shema Data. Now i have the problem that evry time i create a table in Data i must gra

  • Installation progress for apps in app store

    How can I see the installation progress after clicking INSTALL for an app in App Store; I find there are some apps that are taking lot of time for installation, hence wanted to check their progress.

  • SQL Query Cost Report..

    Hi all, I am novice to OEM. I wanted to do / run sql query cost report.. How can i do it in OEM.?? Is it possible to do in OEM..??? Please guide me to solve this problem.?? Your suggestion will be helpful. Thanks, -Mahesh.