MTD Logic Required for Calculation

I have Month and year field in my DSO. Values Year(2009) and Month(4)
I want below logic to calculate -
MTD qty % = (qty * elapse days) / no of days in month
so from the above, I want to know,
1. How can we get the no of days from the above 2 objects (year and month).
2. Elapse days are the days that are over from current date to Ist day of that month.
eg: current date - 04.03.2009 , 1st day of the month - 04.01.2009,
elapse days = 2. (you need to consider all days in the month, not only working days)
so my questions is how can we get, # of days n a month from above 2 fields and elapse days based on the above condition.
Also let me know, where in I need to put in my calculations at transformation level or at query level
please provide your suggestions.
Thanks,
Pra

Hi Pra,
you can do this in both levels. But in this szenarion I would prefer a customer exit on query level. Otherwise you have to load data on daily basis.
There are several function modules to implement this logic. Take a look at e.g. FIMA_DAYS_AND_MONTHS_AND_YEARS. This FM expects 2 import dates. You can fill in 2 dates like 1st day of month & last day of month. You can use this FM two times. First for calcualting all days of the month, second with last day sy-datum.
I would use a calcualted key figure with formula variable of type customer exit. This variable will read the input date from an input ready date variable of type intervall based on 0CALMONTH.
Regards
Andreas

Similar Messages

  • Logic required  for Sort in ALV

    Hi All,
    I am dowloding the ALV report layout in excel sheet thorough mailing functionality.
    I want to implenemnt the dynamic sort. Here I am writing this.but i want the logic for below code.
          CALL FUNCTION 'LT_DBDATA_READ_FROM_LTDX'
            EXPORTING
      I_TOOL             = 'LT'
              IS_VARKEY          = W_VARKEY_EU
            TABLES
              T_DBFIELDCAT       = IT_DBFIELDCAT_EU
            T_DBSORTINFO       =  IT_DBSORTINFO
             T_DBFILTER         = IT_FILTER_LAYOUT
             T_DBLAYOUT         = IT_DB_LAYOUT.
    LIT_DBSORTINFO[] = IT_DBSORTINFO[].
        SORT LIT_DBSORTINFO[] BY KEY1.
        DELETE ADJACENT DUPLICATES FROM LIT_DBSORTINFO[] COMPARING KEY1.
        LOOP AT LIT_DBSORTINFO[].
          CLEAR: LW_SPOS,
                 LW_UP,
                 LW_DOWN,
                 LW_SUBTOT,
                 LW_COMP,
                 LW_EXPA,
                 LW_GROUP.
          CLEAR IT_DBSORTINFO[].
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'SPOS'.
          IF SY-SUBRC = 0.
            LW_SPOS = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'UP'.
          IF SY-SUBRC = 0.
            LW_UP = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'DOWN'.
          IF SY-SUBRC = 0.
            LW_DOWN = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'SUBTOT'.
          IF SY-SUBRC = 0.
            LW_SUBTOT = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'COMP'.
          IF SY-SUBRC = 0.
            LW_COMP = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'EXPA'.
          IF SY-SUBRC = 0.
            LW_EXPA = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'GROUP'.
          IF SY-SUBRC = 0.
            LW_GROUP = IT_DBSORTINFO-VALUE.
          ENDIF.
          LOOP AT IT_ALV_DATA FROM W_LOOP_FROM_EU TO W_LOOP_TO_EU.
            LW_TABIX = SY-TABIX.
            READ TABLE IT_FIELDCAT INTO LW_FIELDCAT WITH KEY
                               FIELDNAME = LIT_DBSORTINFO-KEY1.
            IF SY-SUBRC = 0.
              ASSIGN COMPONENT SY-TABIX OF
                         STRUCTURE IT_ALV_DATA TO <LFS>.
              IF SY-SUBRC = 0.
                CLEAR LW_CHAR.
                LW_CHAR = <LFS>.
                  IF LW_SPOS= 'SPOS'.
                  LOGIC Required
                    ENDIF.
                  ELSEIF LW_OPTION = 'DOWN'.
                 LOgic required
                    ENDIF.
                        ENDIF.
          ENDLOOP.
        ENDLOOP.
    regards,
    Ajay reddy

    Hai,
    Let
    1)general data
    2)all customers
    3)company code data
    4)sales organization data
    are the check box names,Then
    Just use the piece  of code below:
    <b>IF general data = 'X'.
       COUNT = COUNT + 1.
    ENDIF.
    IF all_customers = 'X'.
       COUNT = COUNT + 1.
    ENDIF.
    IF company_code_data = 'X'.
       COUNT = COUNT + 1.
    ENDIF.
    IF sales_organization_data = 'X'.
       COUNT = COUNT + 1.
    ENDIF.</b>
    Now check whether more than one Check Boxes are selected or not
    <b>IF COUNT GT 1.
    "* Do the oprations  what ever you want here  
    ENDIF.</b>
    <b>Reward points if it helps you.</b>
    Regds,
    Rama chary.Pammi

  • Programming Logic required for pulling the records for past month /week

    Hi All
    I need help in the SQL programming logic.
    Oracle Database Version: 10.2.0.3.0
    Requirement
    In a data warehouse environment, I need to programme for weekly and monthly automated batch jobs to insert the data from Data_tbl to Reporting_tbl for generating reports. Tables descriptions are given below.
    Table1 - Data_tbl (Source table –this table gets updated everyday).
    Record_dt     first_name     last_name
    Table2 - Reporting_tbl_(Target table)
    Cycle_dt     first_name     last_name
    1. Monthly Report
    In the SQL Query, I have where clause condition—
    Where Record_dt >=’01-nov-08’ and record_dt<=’30-nov-08’
    Using the above condition in development, I am pulling the data from source table for the past month data. This will be repeated every month and it should be automated.
    i.e., if I run this report any time in dec 2008, it should pick records of dates from Nov 01st to Nov 30th 2008. if I run this report any time in Jan 2009, it should pick records of dates from Dec 01st to Dec 31st 2008.
    Date Values should be assigned for past month. Value of Cycle_dt in target table should be end date of past month like 30-nov-2008, 31-dec-2008.
    2. Weekly Report
    In the SQL Query, I have where clause condition—
    Where Record_dt >=’01-dec-08’ and record_dt<=’07-dec-08’
    Here week start day is Monday and end day is Sunday.
    If I run the report between Dec 08th to Dec 14th , it should pull records of dates from Dec 01st to Dec 07th 2008.
    On Dec 15th, it should pick from Dec 08th to Dec 14th.
    Value of Cycle_dt in target table should be end date of past week like 07-Dec-2008, 14-Dec-2008.
    Please help me with the logics for both Monthly and Weekly reports.
    Thanks

    Hi,
    For the monthly report, instead of
    Where Record_dt >=’01-nov-08’ and record_dt<=’30-nov-08’say:
    Where   Record_dt >= TRUNC (ADD_MONTHS (SYSDATE, -1), 'MM')
    and     record_dt <  TRUNC (SYSDATE, 'MM')SYSDATE is the current DATE.
    TRUNC (SYSDATE, 'MM') is the beginning of the current month. (Notice the condition above is less than this date, not equal to it.)
    ADD_MONTHS (STSDATE, -1) is a date exactly one month ago, therefore it is in the previous month.
    For the weekly report, instead of:
    Where Record_dt >=’01-dec-08’ and record_dt<=’07-dec-08’say
    Where   Record_dt >= TRUNC (SYSDATE - 7, 'IW')
    and     record_dt <  TRUNC (SYSDATE, 'IW')TRUNC (dt, 'IW') is the beginning of the ISO week (Monday-Sunday) that contains dt. Again, notice the end condition is strictly less than the beginning of the current week.

  • Reg logic required for selection-screen.

    Hi,
    i have one requirement
    on selection screen 2 radio button
    1 for service
    2 for account
    Parameter      FILE     LOCALFILE     Filename
    If the radiobutton ACCOUNT is selected the default name for file will be:
         ‘Rev_acc_com_&system_time_stamp&.dat’
    Elseif the radiobutton SERVICE is selected the default name for file will be:
         ‘Rev_srv_com_&system_time_stamp&.dat’
    some body can give the logic for this.

    take the following solution
    data: tstamp type TZNTSTMPS.
    data: filename type string.
    call function 'CONVERT_INTO_TIMESTAMP'
    exporting
       I_DATLO  = sy-datum
       I_TIMLO   = sy-uzeit
    importing
       E_TIMESTAMP = tstamp.
    if ACCOUNT is selected then
    concatenate 'Rev_srv_com_' tstamp '.dat' into filename.
    else if SERVICE is selected then
    concatenate 'Rev_srv_com_' tstamp '.dat' into filename.
    the filename variable will be containing ur required file name..
    reward points if useful....

  • Logical Column for calculation

    Hi guru,
    My requirement is we have to display report with Total count of Opportunities , Count new Oppty ( which are created with in 30days from today ) Count Old Opptys ( which are created more than 30days ago and Overdue ( which closed date is > current Date).
    For this requirement I had created one logical column and I am getting error when ever I am using Timestampdiff.
    Could you please let me know how can I create these 3 logical columns in Meta Data.
    I am rally appreciate for your help.

    Here is what you need to do:
    1. Create a Session Variable in your RPD
    2. Check the "Enable any user to set the value" checkbox in the Session Variable properties
    3. In your dashboard prompt, select"Request Variable" in the Set Variable section
    4. Enter the name of your Session Variable in the box that appears
    5. Now you can reference the session variable in the formula of your logical column. Syntax: VALUEOF(NQ_SESSION.YOUR_SESSION_VARIABLE)
    Note: You cannot reference Presentation Variables in the RPD
    -Dave

  • Logic required for the requirement (urgent)

    HI experts,
    can anyone help me out regarding the following logic.
    The logic will check for both complete and partial goods receipts and invoice receipts. Based on the PO line item history it will calculate the totals into following categories:
    (1) Total PO Line Item value with both GR & IR
    (2) Total PO Line Item value with GR but no IR
    (3) Total PO Line Item value with IR but no GR
    For a single PO line, it is possible to have the Total Line Item Value divided into one or more of the above three categories at the same time. For example, if for a PO line item with 100 unit at $10.00 per unit, there is a GR for 50 Units and IR for only 30 units, the three columns above will be populated as:
    (1) Total PO Line Item value with both GR & IR – 30 x 10 = 300
    (2) Total PO Line Item value with GR but no IR – 20 x 10 = 200
    (3) Total PO Line Item value with IR but no GR – 0 x 10 = 0
    Similarly, if for a PO line item with 100 units and $10.00 per unit, there is a GR for 50 units and IR for 70 units, the three columns will be populated as:
    (1) Total PO Line Item value with both GR & IR – 50 x 10 = 500
    (2) Total PO Line Item value with GR but no IR – 0 x 10 = 0
    (3) Total PO Line Item value with IR but no GR – 20 x 10 = 200
    Regards,
    Nagaraj

    Maybe this example will help....
    report zrich_0002 .
    data: iekbe type table of ekbe with header line.
    data: xmbew type mbew.
    data: xekpo type ekpo.
    data: begin of ibuckets occurs 0,
          ebeln type ekpo-ebeln,
          ebelp type ekpo-ebelp,
          pgrir type p decimals 2,  " Total GR & IR
          pgr   type p decimals 2,  " Total GR
          pir   type p decimals 2,  " Total IR
          pgrni type p decimals 2,  "GR no IR
          pirng type p decimals 2,  "IR no GR
          end of ibuckets.
    parameters: p_ebeln type ekko-ebeln,
                p_ebelp type ekpo-ebelp.
    start-of-selection.
      clear iekbe.  refresh iekbe.
      select * into table iekbe from ekbe
                  where ebeln = p_ebeln
                    and ebelp = p_ebelp
                    and vgabe in ('1','2').
      loop at iekbe.
        clear ibuckets.
        ibuckets-ebeln = iekbe-ebeln.
        ibuckets-ebelp = iekbe-ebelp.
        select single * from ekpo into xekpo
                      where ebeln = iekbe-ebeln
                        and ebelp = iekbe-ebelp.
        select single * from mbew into xmbew
                       where matnr = xekpo-matnr.
        case iekbe-vgabe.
          when  '1'.
            ibuckets-pgrir = iekbe-menge * xmbew-stprs.
            ibuckets-pgr   = iekbe-menge * xmbew-stprs.
          when '2'.
            ibuckets-pgrir = iekbe-menge * xmbew-stprs.
            ibuckets-pir   = iekbe-menge * xmbew-stprs.
        endcase.
        collect ibuckets.
      endloop.
      loop at ibuckets.
        ibuckets-pgrni = ibuckets-pgr - ibuckets-pir.
        ibuckets-pirng = ibuckets-pir - ibuckets-pgr.
        if ibuckets-pgrni < 0.
          clear ibuckets-pgrni.
        endif.
        if ibuckets-pirng < 0.
          clear ibuckets-pirng.
        endif.
        modify ibuckets.
      endloop.
      loop at ibuckets.
        write:/    ibuckets-ebeln,
                   ibuckets-ebelp ,
                   ibuckets-pgrir,
                   ibuckets-pgr   ,
                   ibuckets-pir  ,
                   ibuckets-pgrni ,
                   ibuckets-pirng .
      endloop.
    Regards,
    Rich Heilman

  • Logic required for my normal report

    Hi,
    my report output  is below .
    docu #               material no.           quantity       net price  
    55467488          12376                        10                5
    55467488          12376                         20             10
    55467489           12376                        30             12
                                                                 60             27
    55347388             34567                        56            8
    55347387            34567                          12           12
                                                                      68           20
    grand total                                     ________________
                                                                     128           47
    My requirement is now user  wants for same  material instead of individual lines it should come only one line  with addition operation.please help me how to do it ??In my int. table all the records availavle but ho
    ex.    55467488              12376                        60               27
              55347388             34567                        68               20
    Please search for available information before turning to the forums for help.
    Edited by: kishan P on Sep 3, 2010 11:00 AM

    Hi,
       Use AT NEW and AT END OF control statements for ur requirement. Search SCN how to use AT NEW and AT END OF statement or press F1.
    Regards,
    Selva

  • Logic required for the following

    hello all,
    this is naveen.
    i hope you will help me out with the following.
    I'm creating a screen with vendor id,country,name and no push buttons.
    in the next screen i'm having purchase doc., purchase group, company code along with insert and exit push buttons.
    when i enter the data in the in both the screens and press insert only data from the second screen is uploading into the master table.
    I request you to provide the correct PBO and PAI logic for this in a simple way.
    points will be rewarded.
    thanks
    naveen

    PROGRAM ZVENDORMPOOL .
    *&      Module  USER_COMMAND_0100  INPUT
          text vendor  first screen.
    tables : lfa1.
    DATA : BEGIN OF IT OCCURS 0,
           LIFNR LIKE LFA1-LIFNR,
           LAND1 LIKE LFA1-LAND1,
           NAME1 LIKE LFA1-NAME1,
           END OF IT.
    MODULE USER_COMMAND_0100 INPUT.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  USER_COMMAND_0110  INPUT
          text vendor  second screen
    TABLES : EKKO.
    DATA : BEGIN OF JT OCCURS 0,
           EBELN LIKE EKKO-EBELN,
           BUKRS LIKE EKKO-BUKRS,
           EKORG LIKE EKKO-EKORG,
           EKGRP LIKE EKKO-EKGRP,
           END OF JT.
    MODULE USER_COMMAND_0110 INPUT.
    CASE SY-UCOMM.
    WHEN 'INSE'.
    INSERT: LFA1, EKKO.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0110  INPUT
    Following are the screens designed
    Ist screen with out any push buttons(PB).
    2nd screen with PB.
    When we click the insert PB in second screen data from both screens should be updated in corresponding master data tables.
    (both screen logic is written in pai only by me)
    pls got through and give suggestion)

  • Logic required for creation of PR and PO report

    Dear Experts,
           I want to create a report which gives the details of internal lead time for creation purchase requisition to purchase order. Well which tables I need to use for this . I know some tables like eban, ekko to join. Can you please give me the correct information. I only want those purchase orders which are created with purchase requisition. I need to calculate how many days taken from PR to PO.

    Dear,
    PR release date will be found in CDHDR table in CDHDR-UDATE. PO dates you can find as mentioned in replies.
    But the problem is the time taking for executing the report. It will more lenghty to read different tables and give you output (if you go for yearly range data). ABAP dump error.
    Better, just consult with ABAP team and they can give you a correct solution.
    Regards,
    Syed Hussain.

  • Logic required for a Internal table  issue

    Hi All,
    I have 2 internal table. I need STLNR value to another internal table. Both having same field. But while reading from one internal table to another internal table using IDNRK key, One idnrk having 2 different stlnr value. But its taking only one. How to take both the values?
    The internal table value like below.
    it_stpo--> This is first table, Here one Idnrk having different stlnr value. I need the same in to next table. Here i read with idnrk field but its taking one stlnr value only into next table.
    How to change the logic ?
    Below is it_stpo table and next one is it_mbew_1
    it_stpo
    STLNR     IDNRK             MENGE
    17224     00439RM1     2.3
    17225     00439RM1     4.2
    172333     00849RM2     5.6
    172158     00432TM3     7.2
    152164     00583RM4     8.4
    176123     00583RM4     2.3
    it_mbew_1
    STLNR     IDNRK             STPRS
         00439RM1     111.22
         00439RM1     126.45
         00849RM2     3.3364
         00432TM3     15.5888
         00583RM4     0
         00583RM4     0.235
    My logic like below,
              SORT it_stpo BY idnrk.
              SORT it_mbew_1 BY matnr.
              LOOP AT it_mbew_1 INTO wa_mbew_1.
                READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_mbew_1-matnr BINARY SEARCH.
                IF sy-subrc = 0.
                  wa_mbew_1-stlnr = wa_stpo-stlnr.
                  MODIFY it_mbew_1 FROM wa_mbew_1 TRANSPORTING stlnr WHERE matnr = wa_mbew_1-matnr.
                ENDIF.
              ENDLOOP.
    Kindly help us.
    Mohana

    Try below logic.
    add one more field to it_stpo flag type char01.
    update the field with value 'X'.
    SORT it_stpo BY idnrk.
              SORT it_mbew_1 BY matnr.
              LOOP AT it_mbew_1 INTO wa_mbew_1.
                CLEAR WA_STPO.
                READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_mbew_1-matnr                                                                               
    flag = 'X'.
                if sy-subrc eq 0.
                         move ' ' to wa_stpo-flag.
                         modify it_stpo from wa_stpo index sy-tabix.
                          wa_mbew_1-stlnr = wa_stpo-stlnr.
                         MODIFY it_mbew_1 FROM wa_mbew_1 TRANSPORTING stlnr WHERE matnr = wa_mbew_1-matnr.
                 endif.
              ENDLOOP.
    Regards
    Vinod

  • Logic required for report in which selection criteria is more than one

    Hi Friends,
    I have below piece of selection-screen criteria in my report.
    1)general data
    2)all customers
    3)company code data
      a)company code
    4)sales organization data
      a)sales org.
      b)dist. channel
      c)division
      d)field group
    In above one, 1..4 are check boxes and a..d are select-options under the respective check box.
    Please provide me the sample logic which I need to maintain in my report if user selects more than 1 check box.
    Thnks in advance.

    Hai,
    Let
    1)general data
    2)all customers
    3)company code data
    4)sales organization data
    are the check box names,Then
    Just use the piece  of code below:
    <b>IF general data = 'X'.
       COUNT = COUNT + 1.
    ENDIF.
    IF all_customers = 'X'.
       COUNT = COUNT + 1.
    ENDIF.
    IF company_code_data = 'X'.
       COUNT = COUNT + 1.
    ENDIF.
    IF sales_organization_data = 'X'.
       COUNT = COUNT + 1.
    ENDIF.</b>
    Now check whether more than one Check Boxes are selected or not
    <b>IF COUNT GT 1.
    "* Do the oprations  what ever you want here  
    ENDIF.</b>
    <b>Reward points if it helps you.</b>
    Regds,
    Rama chary.Pammi

  • Logic required for select query

    i have a internal table with 4 columns. 3 columns having varrious material numbers. i want to check every material with mara table. its available or not?
    I need to write a single select queary? how to do this?
    My internal table looks like
    matnr     idnrk          s_idnrk          normt
    test10     10UPC3050     F14839030     test.
    i wrotes like below
       select matnr from mara into table
                     i_mara2 for all entries in
                     i_sub_file
                     where matnr =  i_sub_file-matnr and
                           matnr =  i_sub_file-idnrk and
                           matnr = i_sub_file-s_idnrk.
    Its not working, How to manage this? Anyone help this.
    Mohaha

    Hi fill the ranges with ur 3 material numbers.
    and use it in ur select query.
    define a range for mat no.
    ranges : r_matnr for mara-matnr.
    read table or loop with i_sub_file.
      r_matnr-sign = 'I'.
      r_matnr-option = 'EQ'.
      r_matnr-low = 'i_sub_file-matnr.
      append r_matnr. clear r_matnr.
      r_matnr-sign = 'I'.
      r_matnr-option = 'EQ'.
      r_matnr-low = 'i_sub_file-idnrk.
      append r_matnr. clear r_matnr.
      r_matnr-sign = 'I'.
      r_matnr-option = 'EQ'.
      r_matnr-low = 'i_sub_file-s_idnrk.
      append r_matnr. clear r_matnr.
    now in select.
    select matnr from mara into table
    i_mara2  where matnr in r_matnr.

  • PCR Required for calculating absence

    Dear Experts,
    Can anyone please help me in writing a pcr for leave type:- Leave with permission for this leave type it should only calculate HRA,Air Ticket,All Vacation and End of Service Benefits should calculate when ever employee takes this type of leave and basic should not calculate for that type of leave.
    Thaks well in advance.
    With regards
    Shaikh

    As Okan says;
    Operation VARABTYP should be used. Replace the XXXX with the appropriate absence type number, and the rule will only get processed when that leave has been entered. 
    Depending on the function you use to call the PCR you can make it run in different ways, which will affect your results.
    i.e. using ACTIO or IF the system will just check the first absence entered on that day.  ACTIO YYYY AB (where YYYY is your PCR) will run once for every absence entered on that day.  PTIP will run for each line in the TIP table.
    Regards
    Simon

  • ALV ...Logic required

    Hi every body,
       I have one requirement like an alv report will display
    output which contains a material number.
    <b>If i click On the material number it shud go to MM03...Accounting view
    Logic required for this.</b>I am a beginner ...Plz help me...
    Thanks in advance.
    Message was edited by: raja gurrala

    Hi,
    See the code sample,
    INCLUDE <icon>.
    * Predefine a local class for event handling to allow the
    * declaration of a reference variable before the class is defined.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    DATA : o_alvgrid          TYPE REF TO cl_gui_alv_grid ,
           o_dockingcontainer TYPE REF TO cl_gui_docking_container ,
           o_eventreceiver    TYPE REF TO lcl_event_receiver,
           wa_layout TYPE lvc_s_layo ,
           wa_variant TYPE disvariant.
    CONSTANTS : c_a(1) TYPE c VALUE 'A' ,                     " All Layouts
                c_x(1) TYPE c VALUE 'X'.
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
    * Hot Spot Click
           handle_hotspot
             FOR EVENT hotspot_click OF cl_gui_alv_grid
                IMPORTING e_row_id
                          e_column_id
                          es_row_no,
    * Double Click
    handle_double_click
          FOR EVENT double_click OF cl_gui_alv_grid
              IMPORTING e_row
                        e_column
                        es_row_no,
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    * Implementation
    CLASS lcl_event_receiver IMPLEMENTATION.
    *&      Method handle_hotspot
    * This method is called when the user clicks on a hotspot to drill down.
    * The following types are exported from the ALV
    * LVC_S_ROW
    * LVC_S_COL
    * LVC_S_ROID
      METHOD handle_hotspot.
    * The hotspot processing coded in the form below.
        PERFORM f9900_handle_hotspot USING e_row_id
                                           e_column_id
                                           es_row_no.
      ENDMETHOD.                    "handle_hotspot
    *&      Method handle_double_click
      METHOD handle_double_click.
    * The double click processing should be coded in the form below.
        PERFORM f9901_handle_double_click USING e_row
                                                e_column
                                                es_row_no.
      ENDMETHOD.                    "HANDLE_DOUBLE_CLICK
    FORM f9900_handle_hotspot  USING    p_row_id
                                        p_column_id
                                        p_row_no.
    *Read internal table for proper value.
      READ TABLE  i_output
                  INDEX p_row_id
                  INTO wa_output.
    * Call the transaction MMBE
      SET PARAMETER ID 'MAT' FIELD wa_output-matnr.
      CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
    ENDFORM.                    " f9900_handle_hotspot
    *&      Form  f9901_handle_double_click
    *       Double Click
    FORM f9901_handle_double_click  USING    p_row
                                             p_column
                                             p_row_no.
      READ TABLE i_output INDEX p_row INTO wa_output.
      CASE p_column.
        WHEN 'MATNR'.
          IF NOT wa_output-matnr IS INITIAL.
            SET PARAMETER ID 'MAT' FIELD wa_output-matnr.
            CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
          ENDIF.
      ENDCASE.
    ENDFORM.                    " f9901_handle_double_click
    U can use either hot spot or double click event.
    If u r using hotspot set the hotspot = 'X' in fieldcatalog.
    Hope this helps.
    OR another method without oops concept
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    data:lv_matnr    LIKE v_mmim_lc-matnr,   "Material
    read table i_output into w_output index rs_selfield-tabindex.
    lv_matnr = w_output-matnr.
    SET PARAMETER ID 'MAT' FIELD lv_matnr.
    CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
    Clear:     lv_matnr.
    ENDFORM.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                =
    *   I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = v_repid
         i_callback_pf_status_set          = 'SET_PF_STATUS'
    <b>     i_callback_user_command           = 'USER_COMMAND'</b>
         i_background_id        = 'ALV_BACKGROUND'
        IS_LAYOUT               = I_LAYOUT
        it_fieldcat             = i_fieldcat "field catalog
       I_SAVE                   = 'A'
       IS_VARIANT               = G_VARIANT
        TABLES
            t_outtab                       = i_output "output table
       EXCEPTIONS
         program_error                     = 1
         OTHERS                            = 2
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Kindly reward points if this helps u, revert back with queries.
    Message was edited by: Judith Jessie Selvi

  • SAP logic for calculating the replenishment requirement - IS Retail

    Hi All,
              Could you explain from where does the RPLRQ field is getting picked up from the WRPT table.And what is the SAP logic for calculating the replenishment requirement for a particular article.
    Regards,
    PSS

    Dear PSS,
    Field RPLRQ represents for the replenishment requirement determined in the previous replenishment run. This can be changed when follow-on documents are created if order optimizing is active (for example, if quantities are to be rounded off).
    Bye,
    Muralidhara

Maybe you are looking for

  • Partners not getting determined inspite of settings in place.

    Hi Gurus This problem is regarding partners not determining,. Cr/dr memo request is created with ref to invoice. there are partners X,Y,Z  at invoice item but are not getting copied to Cr/dr memo request item. copy control is maintained. can you help

  • How to fix a submenu on screen

    I have made a vertical spry-menu and I would like to be able to make the submenu stay on the screen until the user is choosing a new item in the mainmenu? But as it is now: As soon as the user has chosen a submenu item and is moving the mouse within

  • Crystal Reports - ECC - SSO Issue

    Team, System Details. 1. BOE XI 3.1 SP3 2. Crystal Reports 2008 3. SAP ECC 6.0 4. SAP NW 7.x Scenario: Crystal reports running against ECC system. SSO configured on Crystal Report database configuration option, report is accessed through SAP NW porta

  • BC4J :3 tier: Can not open module

    Hi I am using Jdevloepr 10.1.3. I have created a application module. When I run the application I get following Exception. java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection      at java.io.ObjectOutputStream.writeObject0(ObjectOutput

  • ORA-19279: Query dynamic type mismatch: expected singleton sequence

    Hi, I have my xml stored in the table 'xml_table' The content of XML is a follows: <COMPANY NAME="ABC"> <DEPARTMENT_NAME>Paris</DEPARTMENT_NAME> <ADDRESS>Rue de nevers</ADDRESS> <DEPARTMENT_NAME>London</DEPARTMENT_NAME> <ADDRESS>Northampton Square</A