Sub:Filtering is not working in ALV Grid

Hi All,
I developed a new ALV report,where in the out put i can set filtering for other columns(ex:Date,Number),but i can'nt able to set Filtering for one of the column which is CHAR type.
But when we went to table for this field filtering is working,but not in the ALV Grid  of our report.
Regards,
Seshadri G

hi,
1) for filtering, we create an internak table of type <b>LVC_T_FILT</b>,
U can assign fields to the above created internal as per u requirements.
2) passing the above internal table to CHANGING parameter of method SET_TABLE FORFIRST_DISPLAY in ALV GRID.
<b>IT_FILTER = < internal table TYPE LVC_T_FLIT>.</b>
<u><b>OR call this method for setting filter criteria as per u r requirement.</b></u>
Set current filter settings. A row of the table describes the selection conditions for column entries that are not to be displayed.
You should never manually set up the internal table with the filter settings. Use this method only to set filter criteria that you got using get_filter_criteria or a layout.
Features
CALL METHOD <ref. var. to CL_GUI_ALV_GRID > ->set_filter_criteria
   EXPORTING
      IT_FILTER  =   <internal table of type LVC_T_FILT > .
Parameter
Meaning
IT_FILTER
Table with filter settings
regards,
AshokReddy.
Message was edited by:
        Ashok Reddy
Message was edited by:
        Ashok Reddy

Similar Messages

  • Filter Not working in ALV grid

    Hi All,
    The filter button in ALV Grid is not working for some fields. if the filter button is selected for a particular field in the ALV grid then no entries are getting displayed in the ALV. For few fields it is working. for few fields is it not displaying any entries after selecting filter.
    Please let me know what may be the possible causes for this issue.
    Thanks in Advance!
    Thanks & Regards,
    Preethi G

    Hi,
      Ex: your output is something like this
      A                     B                         C
      1                    2                             3
      4                    2                              5
      5                    3                              6
    When you filter B for value 2, then internally it creates one more internal table like this
    A                    B                         C
    1                002                         3
    4                002                         5
    5                003                         6
    it tries to matches value 2 to 002 and it fails to retrive the record.
    The solution is try to do the conversion exit on the column/field you are trying to filter it. It will work.
    Regards,
    Ramesh.

  • Colwidth_optimize not working for alv grid report

    Hi friends,
             I have developed an ALV grid report using 'REUSE_ALV_GRID_DISPLAY'.  The field catalog field columns are having the heading size more than 30 characters. So, to optimize the size of the headings, I am using SLIS_LAYOUT_ALV  and passing the value 'X' to colwidth_optimize.
    but still the column heading is not getting fully display. Rather it is display first 20 characters only.
    For your reference please find the code snippet
    *bold* **************** declarations ************************ *bold*
    DATA : fieldcat       TYPE slis_fieldcat_alv,
                 t_fieldcat     TYPE slis_t_fieldcat_alv,
                ws_layout      TYPE slis_layout_alv.
    *bold* **************** field catalogue ********************** *bold*
      CLEAR fieldcat.
      fieldcat-fieldname     = 'RFWRT_PD_MTRL'.
      fieldcat-seltext_m = 'Pending Quotation Spares Value'.   {quote} this heading not getting fully displayed {quote}
      fieldcat-tabname       = 'IT_FNL'.
    ***    FIELDCAT-REF_TABNAME   = 'VBFA'.
      fieldcat-col_pos       = col_pos.
      APPEND fieldcat TO t_fieldcat.
      ADD 1 TO col_pos.
      CLEAR fieldcat.
      fieldcat-fieldname     = 'RFWRT_PD_SERV'.
      fieldcat-seltext_m = 'Pend Quot-JobWorkVal'.
      fieldcat-tabname       = 'IT_FNL'.
      fieldcat-col_pos       = col_pos.
      APPEND fieldcat TO t_fieldcat.
      ADD 1 TO col_pos.
      ws_layout-colwidth_optimize = 'X'.
    *bold* ****************************** alv grid function call ******************** *bold*
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *    i_buffer_active                         = space
          i_callback_program                  = sy-repid
         i_callback_user_command        = 'USER_COMMAND'
    ***   i_callback_pf_status_set           = 'PF_STATUS'
    *   I_STRUCTURE_NAME                  =
         it_fieldcat                        = t_fieldcat[]
         is_layout                          =  ws_layout
        TABLES
          t_outtab                          = it_fnl
       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.
      CLEAR wa_fnl.
    Please look into it.
    Searched the forum for the similar issue. but didnt got any solution.
    Thanks and regards,
    Murali Krishna

    Hi DaveL,
    Thanks alot for your help. My problem solved.
    Can you please suggest me how we can optimize the column based on the total amount which is summed up (fieldcat-do_sum)
    Regards,
    Murali.

  • Action for ENTER KEY is not working in alv grid output (Classical)

    Hi Experts,
      I have searched SDN around 8 hours and could not get any help on my below issue.
      I am developing ALV report using function module (Classical ALV). ALV output has 4 input enable fields, if user enters data in any of those fields and clicks on enter button from key pad..the remaining fields needs to be filled automatically.
      I am facing the issue with enter key, even if i press enter key in the output there is no action and hence no user command triggered. May be i am using wrong funcion code in wrong way.
      Could any one tell me what function code can we assign for ENTER action in PF-STATUS?
    Regards,
    Murali Mohan

    Hi
    Try this simple code, it works fine:
    TYPE-POOLS: SLIS.
    DATA: BEGIN OF ITAB1 OCCURS 0,
           BUKRS LIKE T001-BUKRS,
           BUTXT LIKE T001-BUTXT,
          END OF ITAB1.
    DATA: GT_FIELDCAT   TYPE SLIS_T_FIELDCAT_ALV,
          GT_REPID    LIKE SY-REPID.
    START-OF-SELECTION.
      SELECT BUKRS BUTXT INTO TABLE ITAB1
         FROM T001.
    END-OF-SELECTION.
      GT_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          I_PROGRAM_NAME     = GT_REPID
          I_INTERNAL_TABNAME = 'ITAB1'
          I_INCLNAME         = GT_REPID
        CHANGING
          CT_FIELDCAT        = GT_FIELDCAT.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = GT_REPID
          I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
          IT_FIELDCAT              = GT_FIELDCAT
        TABLES
          T_OUTTAB                 = ITAB1.
    FORM USER_COMMAND USING R_UCOMM     LIKE SY-UCOMM
                          RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'ENTER'. MESSAGE I208(00) WITH 'Pressed ENTER key'.
        WHEN OTHERS.
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    FORM SET_PF_STATUS  USING RT_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'LIST_ALV' EXCLUDING RT_EXTAB.
    ENDFORM.                    "SET_PF_STATUS
    Max

  • Filter is not working in ALV GRID output using FM 'REUSE_ALV_GRID_DISPLAY'

    Hello Experts,
    I have searched SCN before posting this thread.
    In my report output (by using 'REUSE_ALV_GRID_DISPLAY'), i am trying to filter values which is of type CHAR.
    Unable to filter by char30 field in the report output.
    Tried to filter using the following steps:
    Selected the column which i want to filter-> then selected filter symbol of ALV toolbar.
    Selection screen appeared where select-option of that field displayed.
    Selection screen only allows user to enter 1 character.
    Even though the field contains 30 characters the filed in selection screen appeared with 1char length.
    This is the same for all the fields in that ALV. Please suggest how can i change the field length to original field length.

    In field catalog pass:
    wa_alv_fieldcat-outputlen   = p_len
    Set p_len as 30.
    'FIELD'            text-001   '01' 'X'  '30'  'L'

  • ** Filtering is not working correctly in ALV (REUSE_ALV_GRID_DISPLAY)

    Hi Friends,
    We have one Z report that output is displayed in ALV. We are using the standard FM 'REUSE_ALV_GRID_DISPLAY. 
    We have requirement to remove leading zeros for the field like Material Number (MATNR), Equipment Number (EQUNR) etc. We did the changes by applying the field catalog properties as below.
    lw_fieldcat-lzero = space.
    lw_fieldcat-no_zero = 'X'.
    After this, the MATNR and EQUNR is displayed correctly in the ALV. (Leading zeros are suppressed). But, when we do filter for these fields, in the filter window it displays all the values with leading zeros.
    1. We don't understand why it is showing in the Filter widow with all leading zeros. All it shows all the records instead of unique items.
    Later on, we removed the above fieldcat coding. Then, we have called the CONVERSION_EXIT routines (in the domain) for the fields to remove leading zeros.
    Now, the MATNR and EQUNR is displayed correctly (without leading zeros) in ALV. When we do filter, it is also doing filtering correctly. But, when we do filter which have EQUNR having long values (after zero suppression), it is not working correctly. i.e no items are displayed in the ALV.
    Not only for this items. If we filter character columns which have long text, it is not filtering correctly.
    2. It is not able to understand why the filtering is not working for long items. But in the standard report, the filtering is working correctly.
    We are using SAP ECC 6.0.
    Friends, can you clarify the about doubts. It is surprising for me.
    Kind regards,
    Jegathees P.
    Our customer is asked to remove the leading zeros for the numeric field

    Hi Clemens Li
    I agreed on your point. When we define the Internal table the type for element EQUNR & QUMNR , we are referring the SAP data element for EQUNR, QMNUM field.
    Our doubt is even though we refer the standard data element, in the ALV display, it shows with leading zeros and also it creates problems in the filtering and in the filter window all values instead of unique nos.
    Hi Abhii
    I have given below the fieldcat coding.
    Friends, can you kindly clarify the above said problems. Since we use SAP ECC 6.0 any notes or patches apply is required. ( this is the basic functionality in ALV, that is my doubt).
        wls_fieldcat-col_pos   = wpv_pos.
        wls_fieldcat-fieldname = wpv_champ.
        wls_fieldcat-tabname   = wlc_tabname.
      wls_fieldcat-seltext_s = wls_fieldcat-seltext_m
        wls_fieldcat-seltext_l = wpv_libelle.
        wls_fieldcat-ddictxt   = 'L'.
        wls_fieldcat-no_out    = wv_no_out.
        APPEND wls_fieldcat TO gt_fieldcat.
    Kind regards,
    Jegathees P.

  • Search help (PREM) for personal no. is not coming in ALV grid table control

    hi experts,
    Search help (PREM) for personal no. is not coming in ALV grid table control.
    i have assigned the srch help (prem) to my 'ZFIEXP_PROJALLOC' table for the emp_id.
    but in output it is now showing the help.
    ls_fcat-fieldname = 'EMPLOYEE CODE'.
      ls_fcat-ref_table = 'ZFIEXP_PROJALLOC'.
      ls_fcat-ref_field = 'EMP_ID'.
      ls_fcat-outputlen = '10'.
      ls_fcat-key = 'X'.
      ls_fcat-edit = 'X'.
      ls_fcat-coltext = 'EMPLOYEE CODE'.
      ls_fcat-seltext = 'EMPLOYEE CODE'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    Then i tried to solve it using the PA0002 . ie.,
    ls_fcat-fieldname = 'EMPLOYEE CODE'.
      ls_fcat-ref_table = 'PA0002'.
      ls_fcat-ref_field = 'PERNR'.
      ls_fcat-outputlen = '10'.
      ls_fcat-key = 'X'.
      ls_fcat-edit = 'X'.
      ls_fcat-coltext = 'EMPLOYEE CODE'.
      ls_fcat-seltext = 'EMPLOYEE CODE'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    with this it is showing the help in employee code, but, when i click on an empl number, it is not added to my table control and allowing me to add the number by typing them.
    plz help me.
    thanks.

    Hi 
    In the layout give layout-sel_mode  = 'A'.  and
    pass  'A'    to  i_save  exporting parameter to method  set_table_for_first_display.
    The same thing if you are working with function module
    reuse_alv_grid_display.
    Reward points for useful answer.
    Venkat

  • CC 2014 nik efex - My Nik Efex filters are not working in Photoshop CC 2014 - they appear under plug-ins and seem to work, but after running and clicking okay, no new layer appears - seems to have no effect.  The separate menu panel does not appear either

    My Nik Efex filters are not working in Photoshop CC 2014 - they appear under plug-ins and seem to work, but after running and clicking okay, no new layer appears - seems to have no effect.  The separate menu panel does not appear either.  Help with this?

    BINGO !!!!
    Thanks so much Woodsroad. I had the exact same problem with my Dell Windows 7 64 bit with AMD Radeon 6700 Video card.
    All the video tests passed with flying colors.
    The sniffer rename trick fixed the problem.
    Thank goodness for the internet!

  • Sub menu buttons not working on mobiles

    Why are my sub menu buttons not working on mobile phones but working fine on computers?
    Sub menu buttons come under these buttons, Our funerals services, Advice and information.
    http://www.vanessaroberts.co.uk/

    You are using a Spry menubar widget. Spry was created pre-touch-screen systems and hence not designed for touch screens.
    There are a number of solutions available to you
    1. Don't have an active link on the main menu item
    2. Place submenus in the page that is opened by the main menu item, e.g. as a vertical menu
    3. Use Spry Menu Bar ver 2.0
    3. Use a different menu system that is geared to accommodate touch screens
    Because of the demise of Spry, see here http://blogs.adobe.com/dreamweaver/2012/08/update-on-adobe-spry-framework-availability.htm l, option 3 looks like the best option.
    There are a number of free-of-charge jQuery menubars, you could also opt for one of the commercial menubars such as PVII, WebAssist or DMXZone

  • Quartz filters are not working (for PDF)

    It seems that quartz filters are not working for me under Mountin Lion. I have tried to export, print, etc everything in Preview, Automator, ColorSync. It simply won't apply the filters to my PDFs.
    Anyone experienced similar issues? Is it a known bug?

    I kinda have the same problem, except its only my custom filters that aren´t working in ColorSynch. The other filters get applied as usual, but I can not change any of the preformed filters within ColorSynch, and the "live update from filter inspector" doesn´t work if I try to apply changes or use my custom filters.
    The custom filters I have, were created prior to my upgrade from snow leopard to moutain lion.
    I´ve understood that there has been multiple problems with the filters in lion ++
    If there isn´t a quick fix to this, does anybody know of any programs I can use to apply filters without having to buy Adobe Pro, my use is not for simply decreasing file size, but mostly for editing colors prior to prinitng. And its  not sufficient to use the preformed filters unfortunately.

  • Download Option Not Working in ALV Using Classes

    Hi,
    Can anyone let me know what im missing since i get only my header downloaded when i download my output to EXCEL.
    Im using ALV using CLASSES.
    Thanks,
    Anita

    REPORT ZTMM_STOCK  MESSAGE-ID zmsg
                    LINE-SIZE 270
                    LINE-COUNT 58
                    NO STANDARD PAGE HEADING.
    tables: YGFMLINV,  "Material Ledger - Inventory Data Extract
            lfa1,      "Vendor Master (General Section)
            setheader, "Set Header and Directory(checking profit center grp)
            mseg,
            t001w,
            mslbh,
            mslb,
            t001.
    Internal Tables Declaration
    data: begin of i_ygfmlinv occurs 0,
           BDATJ like ygfmlinv-bdatj,     "Posting date YYYY
           POPER like ygfmlinv-poper,     "Posting period
           BUKRS like ygfmlinv-bukrs,     "Company Code
           PRCTR like ygfmlinv-prctr,     "Profit center
           WERKS like ygfmlinv-werks,     "Plant
           BKLAS like ygfmlinv-bklas,     "Valuation class
           MATNR like ygfmlinv-matnr,     "Material number
           BWTAR  like ygfmlinv-bwtar,    "Valuation type
           STOCK_IND like ygfmlinv-stock_ind, "Stock indicators
           MEINS like ygfmlinv-meins,    "Base unit of measure
           MLAST like ygfmlinv-mlast,  "Material Price Dtermination: Control
           LBKUM like ygfmlinv-lbkum,      "Total valuated stock
           vprsv like ygfmlinv-vprsv,     "Price control indicator
           lc_mvp_prc like ygfmlinv-lc_mvp_prc, "LC:Moving Avg/Periodic Prc
           LC_CURTP like ygfmlinv-LC_CURTP, "Currency Type
           LC_CURRENCY like ygfmlinv-lc_currency, "Currency Key
           gc_curtp like ygfmlinv-gc_curtp, "Grp.Curr Type
           gc_currency like ygfmlinv-gc_currency, " Grp.Curr
           LC_TOT_AMT like ygfmlinv-lc_tot_amt, "LC: Total Amount
           KONTS   LIKE T030-KONTS,       "G/L Account No
           XBILK   LIKE SKA1-XBILK,
           lc_cogs like ygfmlinv-lc_var_amt,
           lifnr like mslbh-lifnr,
           lc_trfix_amt like ygfmlinv-lc_trfix_amt,
           lc_lofix_amt like ygfmlinv-lc_lofix_amt,
           lc_var_amt like ygfmlinv-lc_var_amt,
           lc_utp_amt like ygfmlinv-lc_utp_amt,
          end of i_ygfmlinv.
    data: begin of i_mslbh occurs 0,
          MATNR like mslbh-matnr, "Material number
          SOBKZ like mslbh-sobkz, "Special stock indicator
          LIFNR like mslbh-lifnr, "Account number of vendor or creditor
          WERKS like mslbh-werks, "Plant
          CHARG like mslbh-charg, "Batch number
          LFGJA like mslbh-lfgja, "Fiscal year of current period
          LFMON like mslbh-lfmon, "Current period (posting period)
          LBLAB like mslbh-lblab, "Current period (posting period)
          LBINS like mslbh-lbins, "Stock in quality inspection
         end of i_mslbh.
    data: begin of i_MSLB occurs 0,
           MATNR like mslb-matnr,
           WERKS like mslb-werks,
           SOBKZ like mslb-sobkz,
           LIFNR like mslb-lifnr,
           LFGJA like mslb-lfgja,
           LFMON like mslb-lfmon,
           LBLAB like mslb-lblab,
           LBINS like mslb-lbins,
           LBEIN like mslb-lbein,
          end of i_mslb.
    *data: begin of i_t030 occurs 0,
         KTOPL like t030-ktopl,
         BKLAS like t030-bklas,
         KONTS like t030-konts,
         end of i_t030.
    *data: begin of i_ska1 occurs 0,
         SAKNR like ska1-saknr,
         XBILK like ska1-xbilk,
         end of i_ska1.
    DATA : BEGIN OF i_non_subc OCCURS 0,
          MATNR         LIKE YGFMLINV-MATNR,        "Material
          WERKS         LIKE YGFMLINV-WERKS,    "Plant,
          bukrs         like ygfmlinv-bukrs,    "Company Code
          BKLAS         LIKE YGFMLINV-BKLAS,    "Val Class
          PRCTR         LIKE YGFMLINV-PRCTR,   "Profit Center
          BWTAR         LIKE YGFMLINV-BWTAR,    "Val Type
          LBKUM         LIKE YGFMLINV-LBKUM,        "QTY
          PEINH         LIKE YGFMLINV-PEINH,        "Price Unit
          MEINS         LIKE YGFMLINV-MEINS,        "Unit of Measure
          lc_currency   like ygfmlinv-lc_currency,
          lc_curtp      like ygfmlinv-lc_curtp,
          gc_currency   like ygfmlinv-gc_currency,
          gc_curtp   like ygfmlinv-gc_currency,
          LC_VAR_AMT    LIKE YGFMLINV-LC_VAR_AMT,   "LC :Variable Amt
          LC_TRFIX_AMT  LIKE YGFMLINV-LC_TRFIX_AMT, "LC :Trnsfer Fixed Amt
          LC_LOFIX_AMT  LIKE YGFMLINV-LC_LOFIX_AMT, "LC:Local Fixed Amt.
          LC_COGS       LIKE YGFMLINV-LC_VAR_AMT,  "Total LC fixed COGS
                                                   "added as per CC01507
          LC_UTP_AMT    LIKE YGFMLINV-LC_UTP_AMT,   "LC:UTP Amount.
          LC_TR_VAL     LIKE YGFMLINV-LC_LOFIX_AMT,"TotalLC Transfer value
          XBILK         LIKE SKA1-XBILK,            "Balance Indicator
          gc_var_amt    like ygfmlinv-gc_var_amt,
          gc_trfix_amt like ygfmlinv-gc_trfix_amt,
          gc_lofix_amt like ygfmlinv-gc_lofix_amt,
          gc_cogs      like ygfmlinv-gc_var_amt,
          gc_utp_amt   like ygfmlinv-gc_utp_amt,
          gc_tr_val    like ygfmlinv-gc_lofix_amt,
    END OF i_non_subc.
    Final Output Table
    types: begin of t_output,
          matnr like ygfmlinv-matnr,
          lifnr like mslbh-lifnr,
          werks like ygfmlinv-werks,
          spstk like mslbh-lblab,
          totstk like ygfmlinv-lbkum,
          lc_currency like ygfmlinv-LC_CURRENCY,
          lc_curtp like ygfmlinv-lc_curtp,
          gc_curtp like ygfmlinv-gc_curtp,
          gc_currency like ygfmlinv-gc_currency,
          name1 like lfa1-name1,
          vprsv like ygfmlinv-vprsv,
          bukrs like ygfmlinv-bukrs,
          mlast like ygfmlinv-mlast,
          meins like ygfmlinv-meins,
          bklas like ygfmlinv-bklas,
          maktx like makt-maktx,
          stdprice(18),
          totval like ygfmlinv-lc_tot_amt,
          sobkz like mslbh-sobkz,
          end of t_output.
    Work Area for Final Output Table
    data: wa_output type t_output.
    ALV Display
    Name of Custom Container added on the screen
    data: G_CONTAINER TYPE SCRFNAME VALUE 'ZGRID_CTRL',
    ALV GRID Instance Reference
          G_GRID1 TYPE REF TO CL_GUI_ALV_GRID, "Grid
    Instance Reference to Custom Container
          G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    PBO Status
    data: ok_code like sy-ucomm,
    Field Catalog Table
          gT_FIELDCAT      TYPE LVC_T_FCAT,
    Layout Structure
          gs_layout type lvc_s_layo,
    Sorting anf Subtotal
          gt_sort TYPE lvc_s_sort occurs 0,
    gt_output  type standard table  of t_output.
    data: g_curr(2).
          CLASS lcl_event_receiver DEFINITION
    class lcl_event_receiver definition.
      public section.
    Add SUB TOTAL TEXT to the ALV DISPLAY
        methods handle_subtotal_text
            for event subtotal_text of cl_gui_alv_grid
            importing es_subtottxt_info ep_subtot_line e_event_data.
    endclass.
    Declaration for EVENT Receiver
    data: event_receiver type ref to lcl_event_receiver,
         l_subtxt(60) value 'Subtotal Text'.
    field-symbols: <fs> type t_output,
                   <fs1>.
          CLASS LCL_EVENT_RECEIVER IMPLEMENTATION
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD HANDLE_SUBTOTAL_TEXT.
    FIELD for which the SUBTOTAL is Calculated
        if es_subtottxt_info-criteria = 'MATNR'.
          ASSIGN EP_SUBTOT_LINE->* TO <FS1>.
          ASSIGN  E_EVENT_DATA->M_DATA->* TO <FS>.
          CONCATENATE es_subtottxt_info-keyword ':MATERIAL'
        <fs>-matnr INTO <fs1>.
        ENDIF.
      ENDMETHOD.                 "HANDLE_SUBTOTAL_TEXT
    ENDCLASS.                    "LCL_EVENT_RECEIVER IMPLEMENTATION
    Constants
    constants: c_eb(2) value 'EB',
               c_m value 'M',
               C_KTOPL(4) VALUE 'TCOA',
               C_KTOSL(3) VALUE 'BSX',
               C_KONTS(4) VALUE '002%'.
    Selection Screen
    selection-screen:begin of block b1 with frame title text-001.
    select-options: s_lifnr for lfa1-lifnr ,       "Vendor
            s_werks for YGFMLINV-werks obligatory, "Plant
            s_prctr for YGFMLINV-prctr, "Pr.Ctr
            s_matnr for ygfmlinv-matnr, "Mat.No
            s_bwtar for mseg-bwtar no-display.
    parameters: p_bukrs like YGFMLINV-bukrs obligatory, "C.Code
          p_pctrgp like  SETHEADER-SETNAME, "Pf.ct.Grp
          p_poper like YGFMLINV-poper obligatory, " Period
          p_bdatj like YGFMLINV-bdatj obligatory, " Year
          r_ccode  radiobutton group rad1 default 'X',
          r_grpcur radiobutton group rad1.
    selection-screen: end of block b1.
    Ranges Declaration
    RANGES : R_PROFIT_CTR FOR CEPC-PRCTR.
           INITIALIZATON
    *initialization.
      Validations for Selection Screen
    Validation for Vendor
    at selection-screen on s_lifnr.
      select single lifnr
               from lfa1
               into lfa1-lifnr
               where lifnr in s_lifnr.
      if sy-subrc ne 0.
        message e039.
      endif.
    Validation for Plant
    at selection-screen on s_werks.
      select single werks
             from t001w
             into t001w-werks
             where werks in s_werks.
      if sy-subrc ne 0.
        message e040.
      endif.
    Validation for Profit Center
    at selection-screen on s_prctr.
      select single prctr
              from ygfmlinv
              into ygfmlinv-prctr
             where prctr in s_prctr.
      if sy-subrc ne 0.
        message e041.
      endif.
    Validation for Company Code
    at selection-screen on p_bukrs.
      select single bukrs
             from t001
             into t001-bukrs
             where bukrs eq p_bukrs.
      if sy-subrc ne 0.
        message e042.
      endif.
    Validation for Profit Center Group
    at selection-screen on p_pctrgp.
      if not p_pctrgp is initial.
        select single setname
              from setheader
              into setheader-setname
              where setname eq p_pctrgp.
        if sy-subrc ne 0.
          message e043.
        endif.
      endif.
    Validation for Fiscal Period
    *at selection-screen on p_poper.
    select single poper
            from YGFMLINV
            into YGFMLINV-poper
            where poper eq p_poper.
    if sy-subrc ne 0.
       message e045.
    endif.
    Validation for Fiscal Year
    *at selection-screen on p_bdatj.
    select single bdatj
            from YGFMLINV
            into YGFMLINV-bdatj
            where bdatj eq p_bdatj.
    if sy-subrc ne 0.
       message e046.
    endif.
    start-of-selection.
      if p_pctrgp ne ' '.
        perform f_profit_center_select.
      endif.
      perform f_data_selection. "using p_profit_center..
    end-of-selection.
      call screen 100.
    *&      Form  f_data_selection
          text
    -->  p1        text
    <--  p2        text
    FORM f_data_selection.
      data: l_flg,
            l_lblab like mslbh-lblab,
            l_name1 like lfa1-name1,
            l_rate like mslbh-lblab,
            l_maktx like makt-maktx,
            l_diff_stk like mslbh-lblab,
            l_totval like ygfmlinv-lc_tot_amt.
    From profit center group get Profit Center
      LOOP AT R_PROFIT_CTR.
        IF R_PROFIT_CTR-LOW EQ R_PROFIT_CTR-HIGH.
          R_PROFIT_CTR-OPTION = 'EQ'.
          R_PROFIT_CTR-HIGH = SPACE.
          MODIFY R_PROFIT_CTR.
        ENDIF.
      ENDLOOP.
      if r_ccode eq 'X'.
        g_curr = '10'.
      else.
        g_curr = '30'.
      endif.
      if g_curr eq '10'.
    Fetch TOTAL STOCK ,VALUE from ML - Inv. Data Extract Table
        select BDATJ POPER BUKRS PRCTR WERKS BKLAS MATNR
                 BWTAR  STOCK_IND MEINS MLAST LBKUM
                 vprsv lc_mvp_prc LC_CURTP
                 LC_CURRENCY LC_TOT_AMT
                 lc_var_amt LC_UTP_AMT
                 lc_trfix_amt lc_lofix_amt
                 gc_curtp gc_currency
                 from YGFMLINV
                 into corresponding fields of table i_YGFMLINV
                 where bdatj eq p_bdatj and
                       poper eq p_poper and
                       bukrs eq p_bukrs and
                       werks in s_werks and
                       matnr in s_matnr and
                     STOCK_IND eq c_m and
                       trans_type eq c_eb and
                       lc_curtp eq g_curr.
      else.
    Fetch TOTAL STOCK ,VALUE from ML - Inv. Data Extract Table
        select BDATJ POPER BUKRS PRCTR WERKS BKLAS MATNR
                 BWTAR  STOCK_IND MEINS MLAST LBKUM
                 vprsv lc_mvp_prc LC_CURTP
                 LC_CURRENCY LC_TOT_AMT
                 lc_var_amt LC_UTP_AMT
                 lc_trfix_amt lc_lofix_amt
                 gc_curtp gc_currency
                 from YGFMLINV
                 into corresponding fields of table i_YGFMLINV
                 where bdatj eq p_bdatj and
                       poper eq p_poper and
                       bukrs eq p_bukrs and
                       werks in s_werks and
                       matnr in s_matnr and
                     STOCK_IND eq c_m and
                       trans_type eq c_eb and
                       gc_curtp eq g_curr.
      endif.
    Delete Entries not in Profit Center range
      LOOP AT I_YGFMLINV.
        IF  NOT I_YGFMLINV-PRCTR IN R_PROFIT_CTR.
          DELETE I_YGFMLINV.
        ENDIF.
      ENDLOOP.
      if not i_ygfmlinv[] is initial.
        data l_date like mkpf-budat.
        move : p_bdatj to l_date(4),
               p_poper to l_date+4(2),
               '31' to l_date+6(2).
    Get the TOTAL STOCK for Vendor and Material
        SELECT     MATNR
                   WERKS
                   CHARG
                   SOBKZ
                   LIFNR
                   LFGJA
                   LFMON
                   LBLAB
                   LBINS
                   FROM MSLBH INTO corresponding fields of TABLE I_MSLBH
                   for all entries in i_ygfmlinv
                   WHERE MATNR eq i_ygfmlinv-matnr and
                        WERKS EQ i_ygfmlinv-WERKS AND
                       SOBKZ in p_stkind AND
                        LIFNR in s_LIFNR AND
                        LFGJA GE P_BDATJ and
                        lfmon eq p_poper.
        if sy-subrc eq 0.
          DELETE I_MSLBH WHERE LFGJA EQ P_BDATJ AND
                               LFMON LT P_POPER.
        endif.
      endif.
      sort i_mslbh by matnr lifnr werks lfgja lfmon.
      sort i_ygfmlinv by matnr  werks bdatj poper.
      loop at i_mslbh.
        l_lblab = l_lblab + i_mslbh-lblab.
        at end of lifnr.
          l_flg = 'X'.
        endat.
        read table i_ygfmlinv with key matnr = i_mslbh-matnr
                                       werks = i_mslbh-werks
                                       bdatj = i_mslbh-lfgja
                                       poper = i_mslbh-lfmon
                                       binary search.
        if sy-subrc eq 0.
          select single name1 from lfa1 into l_name1
                   where lifnr eq i_mslbh-lifnr.
          if sy-subrc eq 0.
            select single maktx
                      from makt
                      into l_maktx
                      where matnr eq i_mslbh-matnr and
                            spras eq sy-langu.
            if l_flg eq 'X'.
    Subtract Total stk from Special Stock Vendor to get the difference
              l_diff_stk =   i_ygfmlinv-lbkum - l_lblab.
              move : i_mslbh-matnr to wa_output-matnr,
                     i_mslbh-lifnr to wa_output-lifnr,
                     i_mslbh-werks to wa_output-werks,
                     l_lblab to wa_output-totstk,
                     l_name1 to wa_output-name1,
                     i_ygfmlinv-vprsv to wa_output-vprsv,
                     i_ygfmlinv-meins to wa_output-meins,
                     i_ygfmlinv-lc_mvp_prc to wa_output-stdprice,
                     i_ygfmlinv-mlast to wa_output-mlast,
                     i_ygfmlinv-bukrs to wa_output-bukrs,
                     i_ygfmlinv-bklas to wa_output-bklas,
                     i_mslbh-sobkz to wa_output-sobkz.
              if g_curr eq '10'.
                move: i_ygfmlinv-lc_curtp to wa_output-lc_curtp,
                      i_ygfmlinv-lc_currency to wa_output-lc_currency.
              else.
                move: i_ygfmlinv-gc_curtp to wa_output-gc_curtp,
                      i_ygfmlinv-gc_currency to wa_output-gc_currency.
              endif.
              if wa_output-totstk ne 0.
                l_rate = i_ygfmlinv-LC_TOT_AMT  / i_ygfmlinv-lbkum.
                wa_output-totval =  l_rate * l_lblab.
              endif.
              append wa_output to gt_output.
              move wa_output-totval to l_totval.
              clear: l_rate,wa_output.
              if l_diff_stk ne 0.
                wa_output-totval = i_ygfmlinv-LC_TOT_AMT  -  l_totval.
                move: i_mslbh-matnr to wa_output-matnr,
    *Included - Remove
                      i_mslbh-matnr to wa_output-matnr,
                      i_mslbh-werks to wa_output-werks,
                      l_diff_stk to wa_output-totstk,
                      i_ygfmlinv-vprsv to wa_output-vprsv,
                      i_ygfmlinv-meins to wa_output-meins,
                      i_ygfmlinv-lc_mvp_prc to wa_output-stdprice,
                      i_ygfmlinv-mlast to wa_output-mlast,
                      i_ygfmlinv-bukrs to wa_output-bukrs,
                      i_ygfmlinv-bklas to wa_output-bklas.
                if g_curr eq '10'.
                  move: i_ygfmlinv-lc_curtp to wa_output-lc_curtp,
                        i_ygfmlinv-lc_currency to wa_output-lc_currency.
                else.
                  move: i_ygfmlinv-gc_curtp to wa_output-gc_curtp,
                        i_ygfmlinv-gc_currency to wa_output-gc_currency.
                endif.
                append wa_output to gt_output.
                clear: i_ygfmlinv,l_flg,l_lblab,l_name1,wa_output,
                       i_mslbh.
              endif.
            endif.
          endif.
        endif.
      endloop.
      sort: i_ygfmlinv by matnr werks,
                i_mslbh by matnr werks.
      LOOP AT I_YGFMLINV.
        read table i_mslbh with key matnr = i_ygfmlinv-matnr
                                        binary search.
        if sy-subrc eq 0.
          delete i_ygfmlinv.
          clear i_ygfmlinv.
        else.
          MOVE-CORRESPONDING I_YGFMLINV TO i_non_subc.
          APPEND i_non_subc.
          CLEAR I_YGFMLINV.
        endif.
      ENDLOOP.
      sort i_non_subc by matnr werks.
      data: l_lc_cogs(16) type p decimals 2,
            l_lc_tr_val(16) type p decimals 2,
            l_gc_cogs(16) type p decimals 2,
            l_gc_tr_val(16) type p decimals 2.
      LOOP AT i_non_subc.
        if g_curr eq '10'.
          l_LC_COGS   = i_non_subc-LC_TRFIX_AMT +
                        i_non_subc-LC_LOFIX_AMT.
          l_LC_TR_VAL = i_non_subc-LC_VAR_AMT + l_LC_COGS +
                        i_non_subc-LC_UTP_AMT.
        else.
          l_gc_cogs  = i_non_subc-gc_trfix_amt + i_non_subc-gc_lofix_amt.
          l_gc_tr_val = i_non_subc-gc_var_amt + i_non_subc-gc_cogs +
                        i_non_subc-gc_utp_amt.
        endif.
        at end of matnr.
          l_flg = 'X'.
        endat.
        if l_flg eq 'X'.
          move: i_non_subc-matnr to wa_output-matnr,
                i_non_subc-werks to wa_output-werks,
                i_non_subc-lbkum to wa_output-totstk,
                i_non_subc-meins to wa_output-meins,
                i_non_subc-bukrs to wa_output-bukrs,
                i_non_subc-bklas to wa_output-bklas,
                i_non_subc-lc_curtp to wa_output-lc_curtp,
                i_non_subc-lc_currency to wa_output-lc_currency,
                i_non_subc-gc_curtp to wa_output-gc_curtp,
                i_non_subc-gc_currency to wa_output-gc_currency.
          if g_curr eq '10'.
            move l_lc_tr_val to wa_output-totval.
          else.
            move  l_gc_tr_val to wa_output-totval.
          endif.
             i_non_subc-mlast to wa_output-mlast.
          select single maktx
                    from makt
                    into l_maktx
                    where matnr eq i_non_subc-matnr and
                          spras eq sy-langu.
          if sy-subrc eq 0.
            move l_maktx to wa_output-maktx.
            append wa_output to gt_output .
            clear: wa_output,l_flg,l_lc_tr_val,l_lc_cogs,
                   l_gc_cogs,l_gc_tr_val.
          endif.
        endif.
      ENDLOOP.
    ENDFORM.                    " f_data_selection
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'ZPF_STATUS'.
      SET TITLEBAR 'ZTITLE'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  alv_display  OUTPUT
          text
    MODULE alv_display OUTPUT.
      data: total type ref to data,
            subtotal1 type ref to data.
    field-symbols <total> like gt_output .
    field-symbols <subtotal1> like gt_output.
      if g_grid1 is initial.
        perform f_create_objects.
        perform f_build_field_catalog changing gt_fieldcat.
        perform f_prepare_layout changing gs_layout.
        perform f_sort_sub_total changing  gt_sort.
        CALL METHOD G_GRID1->GET_SORT_CRITERIA
          IMPORTING
            ET_SORT = gt_sort[]  .
       CALL METHOD g_grid1->GET_SUBTOTALS
         IMPORTING
           EP_COLLECT00   = total
           EP_COLLECT01   = subtotal1 .
               EP_COLLECT02   =
               EP_COLLECT03   =
               EP_COLLECT04   =
               EP_COLLECT05   =
               EP_COLLECT06   =
               EP_COLLECT07   =
               EP_COLLECT08   =
               EP_COLLECT09   =
               ET_GROUPLEVELS =             .
       assign total->* to <total>.
       assign subtotal1->* to <subtotal1>.
    *ALV Display - Specify Sorting,Filtering Criteria
        if gt_output[] is initial.
          message i015.
        endif.
        CALL METHOD G_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
       I_BYPASSING_BUFFER            =
       I_BUFFER_ACTIVE               =
       I_CONSISTENCY_CHECK           =
       I_STRUCTURE_NAME              =
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
            IS_LAYOUT                  = gs_layout
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
          CHANGING
            IT_OUTTAB                  = gt_output[]
            IT_FIELDCATALOG            = gt_fieldcat
            IT_SORT                    = gt_sort[]
       IT_FILTER                     =
          EXCEPTIONS
            INVALID_PARAMETER_COMBINATION = 1
            PROGRAM_ERROR                 = 2
            TOO_MANY_LINES                = 3
            others                        = 4        .
        IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      else.
        CALL METHOD G_GRID1->REFRESH_TABLE_DISPLAY
    EXPORTING
       IS_STABLE      =
       I_SOFT_REFRESH =
          EXCEPTIONS
            FINISHED       = 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.
      endif.
    ENDMODULE.                 " alv_display  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      case ok_code.
        when 'BACK'.
          set screen '0'.
          leave screen.
        when 'EXIT' or 'CANCEL'.
          PERFORM EXIT_PROGRAM.
      endcase.
      clear ok_code.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  f_create_objects
          text
    -->  p1        text
    <--  p2        text
    FORM f_create_objects.
    Creating Custom Container Objects and GRID
      IF G_grid1 IS INITIAL.
    *Creating Custom Container Instance
    Pass the name of the control that you have created on the screen
        CREATE OBJECT G_CUSTOM_CONTAINER
               EXPORTING CONTAINER_NAME = 'ZGRID_CTRL'.
    *Creating ALV Grid Instance
        CREATE OBJECT G_GRID1 EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
      endif.
    ENDFORM.                    " f_create_objects
    *&      Form  f_build_field_catalog
          text
    -->  p1        text
    <--  p2        text
    FORM f_build_field_catalog changing pt_fieldcat type lvc_t_fcat.
      data ls_fcat type lvc_s_fcat.
    Val Type
      ls_fcat-fieldname = 'BUKRS'.
      ls_fcat-inttype    = 'C'.
      ls_fcat-outputlen = '4'.
      ls_fcat-coltext   = 'Val.Type'.
      ls_fcat-seltext   = 'Val.Type'.
      ls_fcat-col_pos   = '1'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    Val.Class
      ls_fcat-fieldname = 'BKLAS'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-outputlen = '4'.
      ls_fcat-coltext   = 'Val.Class'.
      ls_fcat-seltext   = 'Val.Class'.
      ls_fcat-col_pos   = '2'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Plant
      ls_fcat-fieldname = 'WERKS'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-outputlen = '4'.
      ls_fcat-coltext   = 'Plant'.
      ls_fcat-seltext   = 'Plant'.
      ls_fcat-col_pos   = '3'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Material
      ls_fcat-fieldname = 'MATNR'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-outputlen = '18'.
      ls_fcat-coltext   = 'Material'.
      ls_fcat-seltext   = 'Material'.
      ls_fcat-col_pos   = '4'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Description
      ls_fcat-fieldname = 'MAKTX'.
      ls_fcat-TABNAME = 'MAKT'.
      ls_fcat-outputlen = '40'.
      ls_fcat-coltext   = 'Description'.
      ls_fcat-seltext   = 'Description'.
      ls_fcat-col_pos   = '5'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Price Control
      ls_fcat-fieldname = 'VPRSV'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-outputlen = '1'.
      ls_fcat-coltext   = 'Price Control'.
      ls_fcat-seltext   = 'Price Control'.
      ls_fcat-col_pos   = '6'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Price Determination
      ls_fcat-fieldname = 'MLAST'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-outputlen = '1'.
      ls_fcat-coltext   = 'Price Determination'.
      ls_fcat-seltext   = 'Price Determination'.
      ls_fcat-col_pos   = '7'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    Total Stock
      ls_fcat-fieldname = 'TOTSTK'.
      ls_fcat-REF_TABLE = 'YGFMLINV'.
      ls_fcat-REF_FIELD = 'LBKUM'.
      ls_fcat-QFIELDNAME = 'MEINS'.
      ls_fcat-IFIELDNAME = 'YGFMLINV'.
      ls_fcat-coltext   = 'Total Stock'.
      ls_fcat-seltext   = 'Total Stock'.
      ls_fcat-col_pos   = '8'.
      ls_fcat-do_sum = 'X'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    Std. Price
      ls_fcat-fieldname = 'STDPRICE'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-REF_TABLE = 'YGFMLINV'.
      ls_fcat-ref_field = 'LC_MVP_PRC'.
      ls_fcat-coltext = 'Std.Price'.
      ls_fcat-col_pos   = '9'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
      if g_curr eq '10'.
    Currency Type
        ls_fcat-fieldname = 'LC_CURTP'.
        ls_fcat-TABNAME = 'YGFMLINV'.
        ls_fcat-coltext = 'Currency Type'.
        ls_fcat-seltext = 'Currency Type'.
        ls_fcat-col_pos = '10'.
        append ls_fcat to pt_fieldcat.
        clear ls_fcat.
      else.
    Currency Type
        ls_fcat-fieldname = 'GC_CURTP'.
        ls_fcat-TABNAME = 'YGFMLINV'.
        ls_fcat-coltext = 'Currency Type'.
        ls_fcat-seltext = 'Currency Type'.
        ls_fcat-col_pos = '10'.
        append ls_fcat to pt_fieldcat.
        clear ls_fcat.
      endif.
    *Per Unit Price
      ls_fcat-fieldname = 'STDPRICE'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-ref_table = 'YGFMLINV'.
      ls_fcat-ref_field = 'LC_MVP_PRC'.
    ls_fcat-currency  = 'LC_CURRENCY'.
      ls_fcat-coltext = 'Per.Unit.Price'.
      ls_fcat-seltext = 'Per.Unit.Price'.
      ls_fcat-col_pos   = '11'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    Quantity Measurement
      ls_fcat-fieldname = 'MEINS'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-coltext = 'Base Unit'.
      ls_fcat-seltext = 'Base Unit'.
      ls_fcat-col_pos = '12'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Total Value
      ls_fcat-fieldname = 'TOTVAL'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-currency  = 'GC_CURRENCY'.
      ls_fcat-coltext   = 'Total Value'.
      ls_fcat-seltext   = 'Total Value'.
      ls_fcat-col_pos   = '13'.
      ls_fcat-do_sum = 'X'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Value/period
      ls_fcat-fieldname = 'TOTVAL'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-currency  = 'GC_CURRENCY'.
      ls_fcat-coltext   = 'Value/Period'.
      ls_fcat-seltext   = 'Value/Period'.
      ls_fcat-col_pos   = '14'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Vendor
      ls_fcat-fieldname = 'LIFNR'.
      ls_fcat-TABNAME = 'LFA1'.
      ls_fcat-coltext   = 'Vendor'.
      ls_fcat-seltext   = 'Vendor'.
      ls_fcat-col_pos   = '15'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Vendor Description
      ls_fcat-fieldname = 'NAME1'.
      ls_fcat-TABNAME = 'LFA1'.
      ls_fcat-coltext = 'Vend.Desc'.
      ls_fcat-seltext = 'Vend.Desc'.
      ls_fcat-col_pos   = '16'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Special Stock Indicator
      ls_fcat-fieldname = 'SOBKZ'.
      ls_fcat-TABNAME = 'MSLBH'.
      ls_fcat-coltext = 'Spl.Stock Ind'.
      ls_fcat-seltext = 'Spl.Stock Ind'.
      ls_fcat-col_pos   = '17'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    ENDFORM.                    " f_build_field_catalog
    *&      Form  f_prepare_layout
          text
         <--P_GS_LAYOUT  text
    FORM f_prepare_layout CHANGING P_GS_LAYOUT type lvc_s_layo.
      p_gs_layout-zebra = 'X'.
      p_gs_layout-grid_title = 'Material List: Prices and Inventory Values'.
      p_gs_layout-smalltitle ='X'.
    p_gs_layout-no_totline = 'X'.
      p_gs_layout-no_totarr = 'X'.
    p_gs_layout-no_totexp = 'X'.
    p_gs_layout-totals_bef = 'X'.
    ENDFORM.                    " f_prepare_layout
    *&      Form  f_profit_center_select
    Validate the Profit Center Groups with Profit Center
    -->  p1        text
    <--  p2        text
    FORM f_profit_center_select.
      DATA:V_RETCODE LIKE BAPIRET2,
           V_GROUPNAME LIKE  BAPICO_GROUP-GROUPNAME ,
           p_kokrs like CEPC-KOKRS  value 'DU01',
           I_HIERARCHYNODES LIKE BAPISET_HIER OCCURS 0 WITH HEADER LINE,
           I_PRCTR LIKE BAPI1116_VALUES OCCURS 0 WITH HEADER LINE.
      V_GROUPNAME = P_PCTRGP.
      CALL FUNCTION 'BAPI_PROFITCENTERGRP_GETDETAIL'
           EXPORTING
                CONTROLLINGAREA = P_KOKRS
                GROUPNAME       = V_GROUPNAME
           IMPORTING
                RETURN          = V_RETCODE
           TABLES
                HIERARCHYNODES  = I_HIERARCHYNODES
                HIERARCHYVALUES = I_PRCTR.
      LOOP AT I_PRCTR.
        R_PROFIT_CTR-LOW = I_PRCTR-VALFROM.
        R_PROFIT_CTR-HIGH = I_PRCTR-VALTO.
        R_PROFIT_CTR-SIGN = 'I'.
        R_PROFIT_CTR-OPTION = 'BT'.
        APPEND R_PROFIT_CTR.
      ENDLOOP.
    ENDFORM.                    " f_profit_center_select
    *&      Form  f_sort_sub_total
          text
         <--P_GT_SORT  text
    FORM f_sort_sub_total CHANGING P_GT_SORT.
      DATA: ls_sort TYPE lvc_s_sort occurs 0 with header line.
    ls_sort-spos = '1' .
      ls_sort-fieldname = 'MATNR'.
      ls_sort-up = 'X'.
      ls_sort-subtot = 'X'.
      ls_sort-expa ='X'.
      ls_sort-group = 'UL'.
      append ls_sort TO gt_sort.
    ENDFORM.                    " f_sort_sub_total
    *&      Form  EXIT_PROGRAM
          text
    -->  p1        text
    <--  p2        text
    FORM EXIT_PROGRAM.
      data: g_repid like sy-repid.
      g_repid = sy-repid.
      CALL METHOD G_CUSTOM_CONTAINER->FREE.
      CALL METHOD CL_GUI_CFW=>FLUSH.
      IF SY-SUBRC NE 0.
    add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  TITEL = G_REPID
                  TXT2  = SY-SUBRC
                  TXT1  = 'Error in Flush'(009).
      ENDIF.
      LEAVE PROGRAM.
    ENDFORM.                    " EXIT_PROGRAM

  • Top_of_page is not working in ALV hierarchy?

    Hi,
          I have written following code for top_of_page using event but which is not working...This report is developed for interactive report.
    Note: passed the it_events into ALV hierarchy functional module.
    FORM build_event_tab .
       CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
         EXPORTING
           i_list_type = 1
         IMPORTING
           et_events   = it_events[].
       READ TABLE it_events INTO wa_events WITH KEY form = 'TOP_OF_PAGE'.
       IF sy-subrc = 0.
         wa_events-form = 'TOP_OF_PAGE'.
         APPEND wa_events TO it_events.
       ENDIF.
    ENDFORM. "Get_events
    FORM top_of_page USING document TYPE REF TO cl_dd_document.
       DATA: dl_text(255) TYPE c,
             lv_cutime TYPE sy-uzeit,
             lv_cudt(20) TYPE c.
       lv_cudt = sy-datum.
    *--Passing Date----*
       WRITE  lv_cudt TO dl_text.
       CONCATENATE 'Date : ' lv_cudt+6(2) '-'
                             lv_cudt+4(2) '-'
                             lv_cudt+0(4) INTO dl_text.
       CALL METHOD document->add_text
         EXPORTING
           text = dl_text.
       CLEAR : dl_text.
       CALL METHOD document->add_gap
         EXPORTING
           width = 50.
       WRITE 'Company Name' TO dl_text.
       CALL METHOD document->add_text
         EXPORTING
           text         = dl_text
           sap_emphasis = cl_dd_area=>heading
           sap_style    = cl_dd_area=>heading
           sap_color    = cl_dd_area=>list_total_inv.
       CLEAR : dl_text.
       CALL METHOD document->add_gap
         EXPORTING
           width = 150.
       lv_cutime = sy-uzeit.
       CONCATENATE 'Time : ' lv_cutime+0(2) ':'
                             lv_cutime+2(2) ':'
                             lv_cutime+4(2) INTO dl_text.
       CALL METHOD document->add_text
         EXPORTING
           text = dl_text.
       CALL METHOD document->add_gap
         EXPORTING
           width = 60.
       WRITE 'Title' TO dl_text.
       CALL METHOD document->add_text
         EXPORTING
           text         = dl_text
           sap_emphasis = cl_dd_area=>heading
           sap_style    = cl_dd_area=>heading
           sap_color    = cl_dd_area=>list_total_inv.
       CLEAR : dl_text.
       CALL METHOD document->add_gap
         EXPORTING
           width = 50.
    ENDFORM.                    "html_top_of_page
    Thanks
    Shree

    PERFORM build_fieldcat.
      PERFORM build_event_tab.
      PERFORM alv_display.
    *---Build fieldcat
    FORM build_fieldcat.
      wa_fieldcat-tabname = 'IT_VENDOR'.
      wa_fieldcat-fieldname = 'LIFNR'.
      wa_fieldcat-col_pos   = '2'.
      wa_fieldcat-seltext_l = 'SUPPLIER'.
      wa_fieldcat-outputlen = 20.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_VENDOR'.
      wa_fieldcat-fieldname = 'NAME1'.
      wa_fieldcat-col_pos   = '2'.
      wa_fieldcat-seltext_l = 'VENDOR NAME'.
      wa_fieldcat-outputlen = 40.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'WERKS'.
      wa_fieldcat-col_pos   = '1'.
      wa_fieldcat-seltext_l = 'Plant'.
      wa_fieldcat-outputlen = 5.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'AWKEY'.
      wa_fieldcat-col_pos   = '2'.
      wa_fieldcat-seltext_l = ' Document'.
      wa_fieldcat-hotspot = 'X'.
      wa_fieldcat-outputlen = 16.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'BELNR'.
      wa_fieldcat-col_pos   = '3'.
      wa_fieldcat-seltext_l = 'A/c Document'.
      wa_fieldcat-hotspot = 'X'.
      wa_fieldcat-outputlen = 16.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'BUDAT'.
      wa_fieldcat-col_pos   = '4'.
      wa_fieldcat-seltext_l = 'PJ Date'.
      wa_fieldcat-outputlen = 16.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'XBLNR'.
      wa_fieldcat-col_pos   = '5'.
      wa_fieldcat-seltext_l = 'Inv'.
      wa_fieldcat-outputlen = 16.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'BLDAT'.
      wa_fieldcat-col_pos   = '6'.
      wa_fieldcat-seltext_l = 'PJ Date'.
      wa_fieldcat-outputlen = 16.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'DMBTR'.
      wa_fieldcat-col_pos   = '7'.
      wa_fieldcat-seltext_l = 'Bill.Amount'.
      wa_fieldcat-outputlen = 19.
      wa_fieldcat-do_sum   = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'HKONT'.
      wa_fieldcat-col_pos   = '8'.
      wa_fieldcat-seltext_l = 'Cost Ctr'.
      wa_fieldcat-outputlen = 16.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
    ENDFORM.                    "Build_fieldcat
    *----ALV Display-----*
    FORM alv_display.
      key-header01 = 'LIFNR'.
      key-item01   = 'LIFNR'.
      DELETE ADJACENT DUPLICATES FROM it_vendor.
      DELETE ADJACENT DUPLICATES FROM it_final.
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_pf_status_set = 'PFSTATUS'
          it_fieldcat              = it_fieldcat[]
          i_tabname_header         = 'IT_VENDOR'
          i_tabname_item           = 'IT_FINAL'
          it_events                = it_events[]
          is_keyinfo               = key
        TABLES
          t_outtab_header          = it_vendor[]
          t_outtab_item            = it_final[].
    ENDFORM.                    "alv_display
    *----interactive method--
    FORM user_command USING r_ucomm TYPE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&IC1'.
          READ TABLE it_final INTO wa_final INDEX rs_selfield-tabindex.
          IF sy-subrc = 0.
            IF rs_selfield-fieldname = 'BELNR'.
              SET PARAMETER ID 'BLN' FIELD wa_final-belnr.
              SET PARAMETER ID 'BUK' FIELD pa_bukrs.
              SET PARAMETER ID 'GJA' FIELD pa_gjahr.
              CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
            ELSEIF rs_selfield-fieldname = 'AWKEY'.
              SET PARAMETER ID 'RBN' FIELD wa_final-awkey.
              SET PARAMETER ID 'GJR' FIELD pa_gjahr.
              CALL TRANSACTION 'MIR4' AND SKIP FIRST SCREEN.
            ELSEIF rs_selfield-fieldname = 'LFBNR'.
              SET PARAMETER ID 'BLN' FIELD it_bsak-lfbnr.
              SET PARAMETER ID 'BUK' FIELD pa_bukrs.
              SET PARAMETER ID 'GJA' FIELD pa_gjahr.
              CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
            ELSEIF rs_selfield-fieldname = 'EBELN'.
              SELECT SINGLE
                     ebeln
                     INTO wk_ebeln
                     FROM ekko
                     WHERE ebeln = it_bsak-ebeln
                     AND bstyp = 'F'.
              IF sy-subrc EQ 0.
                SET PARAMETER ID 'BES' FIELD it_bsak-ebeln.
                CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
              ELSE.
                SET PARAMETER ID 'VRT' FIELD it_bsak-ebeln.
                CALL TRANSACTION 'ME33' AND SKIP FIRST SCREEN.
              ENDIF.
            ENDIF.
          ENDIF.
      ENDCASE.
    ENDFORM.                    "user_command
    FORM pfstatus USING ut_extab TYPE slis_t_extab.
      SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'.
    ENDFORM.                    "pfstatus
    *---Authorization check---
    FORM bukrs_check.
      SELECT SINGLE
             butxt "Name of the Company Code / Company
             ort01 "City
             INTO (wk_company, wk_city) FROM t001
             WHERE  bukrs = pa_bukrs.
      IF sy-subrc <> 0.
        MESSAGE 'create your own message' TYPE 'I'.
      ENDIF.
    ENDFORM.                    " BUKRS_CHECK
    FORM build_event_tab.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = it_events[].
      READ TABLE it_events INTO wa_events
         WITH KEY name = 'SLIS_EV_TOP_OF_PAGE'.
      IF sy-subrc = 0.
        wa_events-form = 'TOP_OF_PAGE'.
        MODIFY it_events FROM wa_events INDEX sy-tabix.
      ENDIF.
      READ TABLE it_events INTO wa_events WITH KEY name =
                    'SLIS_EV_END_OF_PAGE'.
      IF sy-subrc = 0.
        wa_events-form = 'END_OF_PAGE'.
        MODIFY it_events FROM wa_events INDEX sy-tabix.
      ENDIF.
    ENDFORM. "Get_events
    FORM end_of_page.
      DATA: it_header TYPE slis_t_listheader,
            wa_header TYPE slis_listheader.
      wa_header-typ = 'S'.
      wa_header-key = 'MATERIAL'.
    *  wa_line-info = p1.
      APPEND wa_header TO it_header.
      CLEAR wa_header.
    *  READ TABLE it_maktx WITH KEY matnr = p1.
      wa_header-typ = 'S'.
      wa_header-key = 'DESCRIPTION'.
    *  wa_line-info = it_maktx-maktx.
      APPEND  wa_header TO it_header.
      CLEAR wa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
         EXPORTING
    *      i_logo             = 'ENJOYSAP_LOGO'
           it_list_commentary = it_header.
    ENDFORM.                    "END_OF_PAGE
    FORM top_of_page USING document TYPE REF TO cl_dd_document.
      DATA: dl_text(255) TYPE c,
            lv_cutime TYPE sy-uzeit,
            lv_cudt(20) TYPE c.
      lv_cudt = sy-datum.
    *--Passing Date----*
      WRITE  lv_cudt TO dl_text.
      CONCATENATE 'Date : ' lv_cudt+6(2) '-'
                            lv_cudt+4(2) '-'
                            lv_cudt+0(4) INTO dl_text.
      CALL METHOD document->add_text
        EXPORTING
          text = dl_text.
      CLEAR : dl_text.
      CALL METHOD document->add_gap
        EXPORTING
          width = 50.
      WRITE 'INCAP CON MFG SER (P) LTD' TO dl_text.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_style    = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_total_inv.
      CLEAR : dl_text.
      CALL METHOD document->add_gap
        EXPORTING
          width = 150.
      lv_cutime = sy-uzeit.
      CONCATENATE 'Time : ' lv_cutime+0(2) ':'
                            lv_cutime+2(2) ':'
                            lv_cutime+4(2) INTO dl_text.
      CALL METHOD document->add_text
        EXPORTING
          text = dl_text.
      CALL METHOD document->add_gap
        EXPORTING
          width = 60.
      WRITE 'Purchase Journal' TO dl_text.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_style    = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_total_inv.
      CLEAR : dl_text.
      CALL METHOD document->add_gap
        EXPORTING
          width = 50.
    ENDFORM.                    "html_top_of_page

  • Filters are not working in Bex report

    Hi All,
    I got a strange issue in my project.
    There is a report in Bex analyzer, after got the report result user trying to put filter on one navigational attribute, unfortunaltely filter is not working.
    For example:
    User ran the report and got the output, now user tried to filter on country with the value"India", but the report showing all the countries in the result.
    What could be the problem, I have checked all the settings.
    I did not get any clue. Could you please throw some light and help me.
    Thanks & Regards,
    Venkat

    Hi Rama,
    I mean, it is working fine in listcube and variable screen, but it is not working while filtering data in report output.
    Please advice me how to solve this.
    Thanks & Regards,
    Venkat

  • F4 help not reflecting in ALV Grid for fixed values specified in domain

    Hi experts,
       As per subject i have a field for which i have assigned 5 fixed values in the domain level (of that field) . The problem is when i am displaying my ALV grid output i need a F4 help and F4 Option for the same is not reflecting and i have assigned in the field catlog as shown bellow.
    wa_fcat-fieldname = 'ZDEPLOY'.
      wa_fcat-tabname = 'IT_FINAL'.
    wa_fcat-f4availabl = 'X'.
    wa_fcat-key     =  'X'.
      WA_FCAT-SELTEXT_L = 'Deployment Planned'.
      wa_fcat-outputlen = '25'.
       WA_FCAT-EDIT = 'X'.
       WA_FCAT-REF_FIELDNAME = 'ZDEPLOY'.
       WA_FCAT-REF_TABNAME = 'ZETMDEPL'.
      APPEND WA_FCAT TO IT_FIELDCAT.
      CLEAR WA_FCAT.
    for the above field the f4 help is not reflecting.
    Intrestingly i have another field which i have declared using the same procedure for which my F4 help (with fixed values ) is reflecting in the same program .with the values as shown below
        wa_fcat-fieldname = 'ZFINAL'.
      wa_fcat-tabname = 'IT_FINAL'.
      WA_FCAT-SELTEXT_L = 'Final Status'.
      wa_fcat-outputlen = '10'.
       WA_FCAT-EDIT = 'X'.
       wa_fcat-ref_fieldname = 'ZFINAL'.
       wa_fcat-ref_tabname = 'ZETMDEPL'.
      APPEND WA_FCAT TO IT_FIELDCAT.
      CLEAR WA_FCAT.
    can u plz suggest me with a solution .
    Regards,
    Edited by: abhilash aswath on Oct 20, 2010 3:32 PM
    Moderator message: please do not use SMS speak.
    Edited by: Thomas Zloch on Oct 20, 2010 3:58 PM

    hi,
    There was a mismatch of characteristics. I resolved by matching the same.

  • Scrollup and down icons not working in ALV. Please help!

    Hi Experts,
           I have a ALV webdynpro ABAP report. I have to show only fixed no of rows.
           But the scrollup and scroll down icons in the ALV (^) not working when I use subtotal (aggregation).
           Interestingly scrolling works perfectly if I remove my subtotal code.  
           My subtotal code is like this:
    *...Sort PRODUCT and group it for subtotal
    *lr_field_settings ?= l_value.
    *lr_field = lr_field_settings->get_field( 'PRODUCT' ).
    *lr_field->if_salv_wd_sort~set_group_aggregation_allowed( ABAP_TRUE ).
    *lr_field->if_salv_wd_sort~create_sort_rule( ).
    *l_sortrule = lr_field->if_salv_wd_sort~GET_SORT_RULE(  ).
    *l_sortrule->set_sort_order( if_salv_wd_c_sort=>sort_order_ascending ).
    *l_sortrule->set_group_aggregation( ABAP_TRUE ).
    **...Aggregate Field QTY
    *lr_field = lr_field_settings->get_field( 'QTY' ).
    *lr_field->if_salv_wd_aggr~create_aggr_rule( ).
    *lr_aggr_rule = lr_field->if_salv_wd_aggr~get_aggr_rule(  ).
    *lr_aggr_rule->set_aggregation_type( if_salv_wd_c_aggregation=>aggrtype_total ).
    **lr_field_settings ?= l_value.
    **lr_field_settings->set_group_aggr_displayed( abap_true ).
           One more thing, In addition to subtotal it also shows grand total in the end. Is this the normal feature or my code for subtotal is wrong?
           So what could be the problem?
           Any sample code will be really helpfull. Please help!
    Thanks
    Gopal
    Message was edited by:
            gopalkrishna baliga

    Hi Gopal,
    Please try to build the effect you commented out in the settings of the ALV. You can save it as a special layout. If scrolling works then, you should check which part of your coding leads to the problem and possibly correct it.
    If this is not possible, just create an OSS message.
    Ciao, Regina

Maybe you are looking for

  • RFC to IDOCs

    Hi Experts, I have a scenario for RFC -- XI -- IDOC In my XI dev. system already i have imported RFC and IDOC's I have 2 Custom IDOC's First IDOC is for Create Second IDOC is for Change/Delete Based on the condition i should select either one of the

  • How can I disable a PCI or USB device (including the video card)?

    Hi I'd like to save some power and reduce the heat of my fanless barebone (an atom-based arctic mc001, see here; http://www.amazon.fr/gp/product/B005DL6 - 5DL6V8G%22 It consumes 25W idle, and gets a bit hot. So I'd like to disable some of the devices

  • Detect and save an event and the previous 60s data in a R32 file

    Hello I am a new user of Diadem. I perform long reliability test, and so the R32 file reach often 1 Giga byte (with a measure frequency of 500hz) when I stop manually the measure after the event . And after I only use the last 60s. I acquire a Voltag

  • ITunes match not syncing normal playlists correctly

    I have iTunes match enabled on my computer and on my iOS device. I made a playlist that consists of 195 songs on my computer. I opened Music on my phone, and I see the playlist there with all 195 songs no problem. I open iTunes on my computer and del

  • Elements catalogue restoration

    A Happy New Year to all.  I think I've made a fundamental mistake and would appreciate any help in resolving it. On old PC, ran Elements 6 - had a number of albums set up to organise my photos.  Upgraded my PC.  Foolishly did not run Elements catalog