Regarding Editable Quantity field in ALV Grid

Hi Experts,
I need your advice in this 2 scenarios.
1.I have a scenario where quantity field in output is editable and the user wants the quantity field printed without thousand separator. If i take a char field and display the field is editable then user may mistakenly type a,bcd...z/ special characters which it should not capture. Is there any char data type data element which accepts only integers. Because after that i need to save that value in z database table quantity field.
2. when there i raised an error message after validation of that editable field in alv output(by events), the user wants all other rows in that grid as uneditable except the row which has got error till this error is solved. Is this possible. If yes how.
Please share your valuable suggestions.

Hi abilash n      
as in dictionary, all quantity fields should have a reference to the unit field which then defines the number of decimals.
The rest is done automatically as long as you do it standard way. In field catalog you have to set the fcat-qfieldname to the name of the field that has the unit.
If you do so, also totals will be grouped by unit.
SAP has really done a great thing by inventing  units for quantities (and currency keys for currency amounts). Only developers do not understand and thus refuse to use it.
Regards,
Clemens

Similar Messages

  • Group Quantity field in ALV GRID

    hi all,
        how to group the Quantity fileds in ALV grid output here fldcat-group = 'X' is not useful.
    ex : in my for a order qty column values are 10.00,10.00,10.00,10.00 for a given sales order then i have to display only one 10.00 instead of 4 times.
    any idea..?
    Regards
    Ashok P

    Hi Ashok,
          If can you check this using Onchange of in a loop statement.
    Regards,
    Prashanth

  • Quantity field in ALV Grid

    I am using KWMENG data element in my ALV grid which is a quantity field. In normal dialog programming this field does not allows entering characters in editable cells. But in ALV grid I am not able to restrict it from entering characters.
    Eg: In VA01 if we try to enter any character "ABC...Z" then it wouldn't be typed in the screen. But when using the same data element in ALV grid iot allows to enter alphanumeric values. Since it's a quantity field so character value gives a short dump. I know I can restrict the dump by using "NA" in comparing string but I want to knw is there a way by which I restrict character field entry in alv grid, the same way this field works in VA01. I checked with a simple dialog prog and in that also it doesn not allows character typing in editable fields.

    simple solution
    mention the ref_fieldname and ref_tablename in the fieldcatalog for that column.
    ex:
    fieldcat-ref_fieldname = 'KWMENG'.
    fieldcat-ref_tablename = 'VBAP'.

  • How to make a field of ALV Grid to use a Search Help?

    Hi;
    I have a ALV grid with a field catalog. Say the field is 'USR000'.
    F4availabl = 'X' . for the field in the field catalog.
    I have prepared search help named ZEV_PROTYPE that uses tha table ZEV_PROTYPES.(two fields in the table :ProType and Text).
    Is it possible to make the field in ALV grid to use this search help if F4 is pressed on the field. ?
    Which structure of the ALV must be used for that ? Is it Field Catalog ?
    Would you please help me ?
    erk.

    Hi,
    If you have a Z data element and the search help is attached to it, you can just give the reference table and field in the field catalog for the editable ALV field, and the search help should appear.
    Regards,
    Sagar

  • How can we sort up currency field in alv grid??

    Hi GUrus,
    Can any one suggest me how to sort the currency field in alv grid...Please help me out of this issue..
    Thanks in advance!!!
    regards,
    Kranthi.

    hii,
    SAP provides a set of ALV (ABAP List Viewer) & function modules, which can be used to enhance the readability and functionality of any report output.
    ALV is a flexible tool used for displaying lists.The tool provides common list functions & can be enhanced by self-defined options.
    so u will get the option for sorting in your alv report.
    Thanks

  • Total for a Numeric field in ALV Grid display

    Hi all,
    I am not getting the Total for a Numeric field in ALV Grid output. What might be the problem.
    Regards,
    Balavardhan.K

    Check this code for subtotals and totals..
    REPORT ZYFI_REPT007
           NO STANDARD PAGE HEADING
           LINE-SIZE 300
           LINE-COUNT 50
           MESSAGE-ID ZYFI.
    TABLES : COOI, " Commitments Management: Line Items
             LFA1,                         " Vendor master (general section)
             VBEP,
             RKPLN.
          TABLE TYPES AND INTERNAL TABLES                                *
    DATA : BEGIN OF TYP_COOI ,
           OBJNR LIKE COOI-OBJNR,
           SAKTO LIKE COOI-SAKTO,
           MEGBTR LIKE COOI-MEGBTR,
           MEINH LIKE COOI-MEINH,
           WKGBTR LIKE COOI-WKGBTR,
           REFBN LIKE COOI-REFBN,
           RFPOS LIKE COOI-RFPOS,
           SGTXT LIKE COOI-SGTXT,
           BUDAT LIKE COOI-BUDAT,
           LIFNR LIKE COOI-LIFNR,
           END OF TYP_COOI.
    DATA : BEGIN OF TYP_LFA1 ,
            LIFNR LIKE LFA1-LIFNR,
            NAME1 LIKE LFA1-NAME1,
           END OF TYP_LFA1.
    DATA : BEGIN OF IT_OUTTAB OCCURS 0,
             OBJNR LIKE COOI-OBJNR,
             SAKTO LIKE COOI-SAKTO,
             MEGBTR LIKE COOI-MEGBTR,
             MEINH LIKE COOI-MEINH,
             WKGBTR LIKE COOI-WKGBTR,
             REFBN LIKE COOI-REFBN,
             RFPOS LIKE COOI-RFPOS,
             SGTXT LIKE COOI-SGTXT,
             BUDAT LIKE COOI-BUDAT,
             LIFNR LIKE COOI-LIFNR,
             NAME1 LIKE LFA1-NAME1,
           END OF IT_OUTTAB.
    DATA : IT_COOI LIKE TYP_COOI OCCURS 0 WITH HEADER LINE,
           IT_LFA1 LIKE TYP_LFA1 OCCURS 0 WITH HEADER LINE.
    *-- ALV Declarations
    TYPE-POOLS SLIS.
    DATA: IT_EVENTS            TYPE SLIS_T_EVENT,
          GS_EVENT             TYPE SLIS_ALV_EVENT,
          wa_fldcat            type slis_fieldcat_alv.
    DATA: S_LAYOUT TYPE SLIS_LAYOUT_ALV,
          GT_PRINT TYPE SLIS_PRINT_ALV.
    DATA: IT_FLDCAT       TYPE SLIS_T_FIELDCAT_ALV.
    DATA: IT_SORT             TYPE SLIS_T_SORTINFO_ALV.
    DATA: V_REPID LIKE SY-REPID.
                        SELECTION SCREEN                                 *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_KOKRS FOR COOI-KOKRS NO-EXTENSION NO INTERVALS,
                                           " Controlling Area
                     S_BUKRS FOR COOI-BUKRS NO-EXTENSION NO INTERVALS,
                                           " Company code
                     S_GJAHR FOR COOI-GJAHR NO-EXTENSION NO INTERVALS,
                                           " Fiscal Year
                     S_OBJNR FOR RKPLN-AUFNR MATCHCODE OBJECT ORDE,
                                                            " Internal order
                     S_SAKTO FOR COOI-SAKTO MATCHCODE OBJECT KART,
                                                              " Cost Element
                     S_BUDAT FOR COOI-BUDAT, " Debit Date
                     S_LIFNR FOR COOI-LIFNR. " Vendor
    SELECTION-SCREEN END OF BLOCK B1.
           S T A R T   O F   S E L E C T I O N                           *
    START-OF-SELECTION.
    *-- Read data
      PERFORM GET_DATA.
           E N D   O F   S E L E C T I O N                               *
    END-OF-SELECTION.
    *-- Process the data and prepare the output data
      PERFORM CALCULATE_FINAL_INFO.
    *--Display Report output
      PERFORM DISPLAY_REPORT.
          FORM CALCULATE_FINAL_INFO                                     *
        Process the data and prepare final internal table               *
    FORM CALCULATE_FINAL_INFO.
      DATA : L_OBJNR LIKE COOI-OBJNR.
      SORT IT_LFA1 BY LIFNR.
      DELETE ADJACENT DUPLICATES FROM IT_LFA1 COMPARING LIFNR.
      LOOP AT IT_COOI.
        L_OBJNR = IT_COOI-OBJNR+2(20).
        SHIFT L_OBJNR LEFT DELETING LEADING '0'.
        IF L_OBJNR IN S_OBJNR.
          READ TABLE IT_LFA1 WITH KEY LIFNR  = IT_COOI-LIFNR.
          IF SY-SUBRC EQ 0.
            IT_OUTTAB-NAME1 = IT_LFA1-NAME1.
          ENDIF.
          MOVE-CORRESPONDING IT_COOI TO IT_OUTTAB.
          CLEAR IT_OUTTAB-OBJNR.
          IT_OUTTAB-OBJNR = L_OBJNR.
          APPEND IT_OUTTAB.
          CLEAR IT_OUTTAB.
          CLEAR IT_LFA1.
          CLEAR L_OBJNR.
        ENDIF.
      ENDLOOP.
    ENDFORM.
    *&      Form  GET_DATA
         Fetch the Data from the table COOI and LFA1
    FORM GET_DATA.
      SELECT OBJNR
            SAKTO
            MEGBTR
            MEINH
            WKGBTR
            REFBN
            RFPOS
            SGTXT
            BUDAT
            LIFNR
            FROM COOI
            INTO TABLE IT_COOI
            WHERE   BUDAT IN S_BUDAT
            AND LIFNR IN S_LIFNR
            AND KOKRS IN S_KOKRS
            AND BUKRS IN S_BUKRS
            AND GJAHR IN S_GJAHR
            AND SAKTO IN S_SAKTO.
      IF SY-SUBRC EQ 0 .
    Get the Vendor name from LFA1
        SELECT LIFNR
               NAME1
               FROM LFA1
               INTO TABLE IT_LFA1
               FOR ALL ENTRIES IN IT_COOI
               WHERE LIFNR EQ IT_COOI-LIFNR.
      ELSE.
        MESSAGE I999 WITH TEXT-013.
      ENDIF.
    ENDFORM.                               " GET_DATA
    *&      Form  DISPLAY_REPORT
           Display the output
    FORM DISPLAY_REPORT.
      PERFORM BUILD_CATALOG.
      PERFORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS.
      IF NOT IT_OUTTAB[] IS INITIAL.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
             EXPORTING
                  I_CALLBACK_PROGRAM      = V_REPID
                  I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
                  IT_FIELDCAT             = IT_FLDCAT
                  IT_SORT                 = IT_SORT
                  IT_EVENTS               = IT_EVENTS
             TABLES
                  T_OUTTAB                = IT_OUTTAB
             EXCEPTIONS
                  PROGRAM_ERROR           = 1
                  OTHERS                  = 2.
      ELSE.
        MESSAGE I999 WITH TEXT-013.
      ENDIF.
    ENDFORM.                               " DISPLAY_REPORT
    *&      Form  BUILD_CATALOG
          Build the Field catalog for the ALV Report
    FORM BUILD_CATALOG.
      DATA: V_INDEX LIKE SY-TABIX.
      V_REPID = SY-REPID.
      DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME         = V_REPID
                I_INTERNAL_TABNAME     = 'IT_OUTTAB'
                I_INCLNAME             = V_REPID
           CHANGING
                CT_FIELDCAT            = IT_FLDCAT
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'WKGBTR'
                             TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
      IF SY-SUBRC  EQ 0.
        WA_FLDCAT-DO_SUM  = 'X'.
        MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
      ENDIF.
      READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'OBJNR'
                                TABNAME =  'IT_OUTTAB' INTO WA_FLDCAT.
      IF SY-SUBRC EQ 0.
         WA_FLDCAT-SELTEXT_L = 'Order'.
         WA_FLDCAT-COL_POS = 1.
         WA_FLDCAT-DDICTXT = 'L'.
        MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
      ENDIF.
      LS_SORT-FIELDNAME = 'OBJNR'.
      LS_SORT-SPOS      = 1.
      LS_SORT-UP        = 'X'.
      LS_SORT-SUBTOT    = 'X'.
      APPEND LS_SORT TO IT_SORT.
    ENDFORM.                               " BUILD_CATALOG
    *&      Form  FRM_PREPARE_EVENT_LIST
          Build the Events
    FORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS TYPE SLIS_T_EVENT.
      CLEAR GS_EVENT.
      GS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
      GS_EVENT-FORM = 'TOP_OF_PAGE_REPORT'.
      APPEND GS_EVENT TO IT_EVENTS.
    ENDFORM.                               " FRM_PREPARE_EVENT_LIST
         TOP OF PAGE
    FORM TOP_OF_PAGE_REPORT.
      CALL FUNCTION 'Z_YREPORT_HEADER'
           EXPORTING
                DL_TITLE = SY-TITLE
                DL_REPID = SY-CPROG
                DL_LINSZ = SY-LINSZ
           EXCEPTIONS
                OTHERS   = 1.
    ENDFORM.                               " FRM_TOP_OF_PAGE_REPORT
    *&      Form  USER_COMMAND
      Drill Down Functionality to Call the Transaction ME23
    FORM USER_COMMAND USING    P_UCOMM    LIKE SY-UCOMM
                               P_SELFIELD TYPE SLIS_SELFIELD.
      DATA : L_INDEX LIKE SY-INDEX,
             L_REFBN LIKE COOI-REFBN.
      L_INDEX = P_SELFIELD-TABINDEX.       " holds the selected table index
      CLEAR L_REFBN.
      CASE P_UCOMM.
    *-- On Double Click
        WHEN '&IC1'.
          CLEAR L_REFBN.
    *-- Read the Current Line
          READ TABLE IT_OUTTAB INDEX L_INDEX.
          IF SY-SUBRC EQ 0.
            L_REFBN = IT_OUTTAB-REFBN.
            IF NOT L_REFBN IS INITIAL.
    *-- Set the BES Paramater Id to the Current line Purchase Order Number
              SET PARAMETER ID 'BES' FIELD L_REFBN.
    *-- Call the Transaction Purchase Order Display with the above PO Number
              CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
            ENDIF.
          ELSE.
            MESSAGE E999 WITH TEXT-014.
          ENDIF.
      ENDCASE.
    ENDFORM.                               " USER_COMMAND

  • Add List box for one field in ALV GRID

    Hi All,
      I need to add drop down list box for one field in ALV Grid.
      If any body knows, please help.
    Thanks in advance.
    Regards
    Manglesh

    Hi,
    Here is the ex where i have used for date parameter in the sel screen
    type-pools: vrm.
    data: name type vrm_id,
          list type vrm_values,
          value like line of list.
    parameters :    p_date like p_date2
                                  as listbox visible length 15.
    at selection-screen output.
      name = 'P_DATE'.
      value-key = '1'.
      value-text = 'Today'.
      append value to list.
      value-key = '2'.
      value-text = 'Last 7 days'.
      append value to list.
      value-key = '3'.
      value-text = 'Last 30 days'.
      append value to list.
      value-key = '4'.
      value-text = 'Last 90 days'.
      append value to list.
      value-key = '5'.
      value-text = 'Last year'.
      append value to list.
    Call the ''VRM_SET_VALUES' to display the values in Listbox
      call function 'VRM_SET_VALUES'
        exporting
          id     = name
          values = list.
    at selection-screen.
      if sy-ucomm = 'CLI1'.
        sscrfields-ucomm = 'ONLI'(001).
      endif.
      if p_date = '1'.
        p_date11 =  sy-datum .
      elseif p_date = '2'.
        p_date11 = ( sy-datum - 7 ).
      elseif p_date = '3'.
        p_date11 = ( sy-datum - 30 ).
      elseif p_date = '4'.
        p_date11 = ( sy-datum - 90 ).
      elseif p_date = '5'.
        p_date11 = ( sy-datum - 365 ).
      endif.
    Hope this helps u..
    Please reward points if useful.
    Regards,
    Sreenivas

  • F4 - Help for field in ALV Grid Output

    Hi,
    I generated a report which gives output in ALV Grid output.
    In the output, 1 of the field is editable.Here, for this field I need to have my own F4-Help.
    I think the procedure to be followed is:--
    Create a Search Help in SE11.
    Link the Search Help to the editable field.
    Please let me know if its the correct procedure.
    I f yes, how can I link user defined Search Help to the editable field?
    Thanks,
    Shivaa........

    Hi siva,
    you can also do that way.
    while filling the fieldcatalog use the parameter F4AVAILABL
    for more info check
    F4 help in ALV Grid...
    f4 help for a field in alv grid
    hope it helps you
    Thanks!
    Edited by: Prasanth on Mar 6, 2009 3:59 PM

  • F4 help for field in ALV grid control (using ABAP objects)

    Hi All,
        I have created a z table ZTAB which is a master table( with single column X). field X should be a input field in ALV Grid through F4 key. I have created searchelp and assigned it to data element of X feild, and in domain level I have assigned ZTAB as value table.
        And in ALV field catalog wrote ls_fcat-ref_tab = 'ZTAB'. But still I'm not getting list of values when I press F4.
    Can anyone help me to understand what is missing here? How to call standardard F4 help?
    This is very urgent..
    Regards
    Jaker.

    u can refer to this standard program :BCALV_EDIT_08
    also u wont get the list of values automatically..
    declare a class :
    CLASS LCL_EVENT_HANDLER DEFINITION.
      PUBLIC SECTION.
        METHODS :
        handle_on_f4 for event onf4 of cl_gui_alv_grid
        importing e_fieldname es_row_no er_event_data,
    ENDCLASS.               "LCL_EVENT_HANDLER
    implementation of class
    here u pass ur internal table what u want to display as pop up for f4 help.
    *&       Class (Implementation)  LCL_EVENT_HANDLER
           Text
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    *Method to handle F4 click.
      Method handle_on_f4.
    Function to create a popup and passing the values of internal table in it.
          CALL FUNCTION 'POPUP_WITH_TABLE'
            EXPORTING
              ENDPOS_COL   = 60
              ENDPOS_ROW   = 60
              STARTPOS_COL = 5
              STARTPOS_ROW = 5
              TITLETEXT    = 'pop up'
            IMPORTING
              CHOICE       = wa_grid-zfield
            TABLES
              VALUETAB     = ITAB
            EXCEPTIONS
              BREAK_OFF    = 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.
            RETURN.
          ENDIF.
      endmethod.                    "handle_on_f4
    ENDCLASS.               "LCL_EVENT_HANDLER
    hope this gives u some idea.

  • CL_GUI_ALV_GRID problem: editable quantity field

    Hi,
    I have this ALV with editable quantity field type MEINS.
    The quantity is displayed with 3 decimals.
    eg. 1.000
    when I try to change the value to 99
    and call method CHECK_CHANGED_DATA to get the updated value.
    it turns into 0.099 in my internal table.
    same thing happens when i change the value to 99.000.
    Did i miss out anything?
    Please help.

    Hi Jeff,
    This can be done by setting ref_fieldname and ref_tabname in the field catalogue for Currency and Quantity fields .
    Hope this helps.

  • How to add an editable checkbox to an alv grid

    Hi..
    I need to add an editable checkbox to a alv grid.
    I wouls appreciatet it if anyone could provide some sample code.
    The standard example  BCALV_EDIT_05 is an oops example... I need a simple example
    Please help
    thanks
    Karen

    hi
    after you pass a field as checkbox in fieldcat
    then in layout populate edit
    ex wa_layout-edit = 'X'.
    try the following code
    REPORT  ZALV5.
    TYPE-POOLS: slis.
    tables: mara.
    DATA: begin of it_mara OCCURS 0,
          matnr like mara-matnr,
          mbrsh like mara-mbrsh,
          matkl like mara-matkl,
          meins like mara-meins,
          ersda like mara-ersda,
          ernam like mara-ernam,
          W_CHK type c ,
         END OF it_mara.
    *data: it_mara like  mara occurs 0 with header line.
    data:it_feildtab type slis_t_fieldcat_alv,
         wa_fieldcat type slis_fieldcat_alv.
    *DATA: i_private TYPE slis_data_caller_exit,
    data:     i_selfield TYPE slis_selfield,
          W_exit(1) TYPE c.
    PARAMETERS: p_title TYPE sy-title default 'ALV'.
    START-OF-SELECTION.
      SELECT matnr mbrsh matkl meins  ersda ernam FROM mara
        INTO corresponding fields of  table it_mara.
    wa_fieldcat-col_pos   = '1'.
    wa_fieldcat-fieldname = 'W_CHK'.
    *wa_FIELDCAT-KEY = 'X'.
    *wa_fieldcat-tabname   = 'IT_MARA'.
    *wa_fieldcat-seltext_s = 'units of measure'.
    wa_fieldcat-checkbox = 'X'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos   = '2'.
    wa_fieldcat-tabname   = 'IT_MARA'.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-key = 'X'.
    wa_fieldcat-hotspot = 'X'.
    wa_fieldcat-seltext_s = 'no'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
    wa_fieldcat-col_pos   = '3'.
    wa_fieldcat-fieldname = 'MBRSH'.
    *wa_FIELDCAT-KEY = 'X'.
    wa_fieldcat-tabname   = 'IT_MARA'.
    wa_fieldcat-seltext_s = 'Ind.sec'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
    wa_fieldcat-col_pos   = '4'.
    wa_fieldcat-fieldname = 'MATKL'.
    *wa_FIELDCAT-KEY = 'X'.
    wa_fieldcat-tabname   = 'IT_MARA'.
    wa_fieldcat-seltext_s = 'Description'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
    wa_fieldcat-col_pos   = '5'.
    wa_fieldcat-fieldname = 'MEINS'.
    *wa_FIELDCAT-KEY = 'X'.
    wa_fieldcat-tabname   = 'IT_MARA'.
    wa_fieldcat-edit      = 'X'.
    wa_fieldcat-seltext_s = 'units of measure'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
      CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
           EXPORTING
                i_title                 = p_title
                i_selection             = 'X'
                i_zebra                 = 'X'
               I_SCREEN_START_COLUMN   = 0
               I_SCREEN_START_LINE     = 0
                I_SCREEN_END_COLUMN     = 0
               I_SCREEN_END_LINE       = 0
                i_checkbox_fieldname    = 'W_CHK'
              I_LINEMARK_FIELDNAME    =
              I_SCROLL_TO_SEL_LINE    = 'X'
                i_tabname               = 'IT_MARA'
              i_structure_name        = 'IT_MARA'
               IT_FIELDCAT             = it_feildtab
              IT_EXCLUDING            =
              I_CALLBACK_PROGRAM      =
              I_CALLBACK_USER_COMMAND =
               IS_PRIVATE             = I_PRIVATE
         IMPORTING
                es_selfield             = i_selfield
                e_exit                  = w_exit
           TABLES
                t_outtab                = it_mara
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
       MESSAGE i000(0k) WITH sy-subrc.
      ENDIF.
      LOOP AT it_mara WHERE W_CHK = 'X'.
        WRITE: /  it_mara-ersda, it_mara-ernam.
      ENDLOOP.
    reward if helpful
    prasanth

  • How to add F1 help for a field on ALV grid

    Hi All,
    When we execute a program, the output is displayed using ALV grid.
    on the ALV grid, if we press F1 on a field, it should popup the help document.
    How to add F1 help for a field on ALV grid.
    Thank you all in advance.

    fill field LVC_S_FCAT-ROLLNAME of your fieldcatalog in method SET_TABLE_FOR_FIRST_DISPLAY
    A.

  • Disable editable field in ALV grid using OOPS

    I have following requirements,
    Displaying ALV grid output with most of the fields editable.
    Validations on data entered for each fields,for error messages
    Query :
    I want to make all the fields except the field in ERROR in display only mode
    similar to case when we do validation of fields in table controls.

    HI
    check the below links lot of info and examples r there for OOPS
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    Check these sample code
    data : begin of it_mara occurs 0,
    mark type flag,
    matnr type matnr,
    mtart type mtart,
    meins type meins,
    end of it_mara.
    data : begin of it_mara1 occurs 0,
    mark type flag,
    matnr type matnr,
    mtart type mtart,
    meins type meins,
    end of it_mara1.
    data : begin of it_mara2 occurs 0,
    mark type flag,
    matnr type matnr,
    mtart type mtart,
    meins type meins,
    end of it_mara2.
    data : t_fieldcat type lvc_t_fcat,
    t_fieldcat1 type lvc_t_fcat,
    s_fieldcat like line of t_fieldcat.
    data : s_layout type lvc_s_layo.
    data : control type ref to cl_gui_custom_container,
    grid type ref to cl_gui_alv_grid.
    data: begin of wa ,
    mark type flag,
    matnr type matnr,
    mtart type mtart,
    meins type meins,
    end of wa.
    class lcl_events_box definition.
    public section.
    methods :
    *Handler_Data_Changed for event Data_Changed of cl_gui_alv_grid
    *imporTing er_data_changed,
    Handler_User_Command for event User_Command of cl_gui_alv_grid
    imporTing e_ucomm,
    Handler_ToolBar for event ToolBar of cl_gui_alv_grid
    importing E_object E_interactive.
    endclass.
    class lcl_events_box implementation.
    method Handler_user_command.
    PERFORM FORM_USERCOMMAND CHANGING E_UCOMM.
    endmethod.
    method Handler_ToolBar.
    PERFORM FORM_TOOLBAR CHANGING E_OBJECT E_INTERACTIVE
    E_OBJECT->MT_TOOLBAR.
    endmethod.
    ENDCLASS.
    start-of-selection.
    data : w_events type ref to lcl_events_box.
    select matnr mtart meins from mara into corresponding fields of table
    it_mara.
    call screen 100.
    *& Module pbo_module OUTPUT
    text
    MODULE pbo_module OUTPUT.
    if GRID is initial.
    CREATE OBJECT CONTROL
    EXPORTING
    CONTAINER_NAME = 'CUST_CTRL'.
    CREATE OBJECT GRID
    EXPORTING
    I_PARENT = CONTROL.
    PERFORM BUILD_CATALOG.
    PERFORM BUILD_CATALOG1.
    PERFORM BUILD_LAYOUT.
    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    IS_LAYOUT = s_layout
    CHANGING
    IT_OUTTAB = it_mara[]
    IT_FIELDCATALOG = t_fieldcat.
    CREATE OBJECT W_EVENTS.
    SET HANDLER : W_EVENTS->HANDLER_TOOLBAR FOR GRID,
    W_EVENTS->HANDLER_USER_COMMAND FOR GRID.
    CALL METHOD GRID->SET_TOOLBAR_INTERACTIVE.
    ELSE.
    call method grid->refresh_table_display.
    ENDIF.
    ENDMODULE. " pbo_module OUTPUT
    *& Form BUILD_CATALOG
    FORM BUILD_CATALOG .
    S_FIELDCAT-COL_POS = '1'.
    S_FIELDCAT-FIELDNAME = 'MARK'.
    S_FIELDCAT-CHECKBOX = 'X'.
    S_FIELDCAT-eDIT = 'X'.
    APPEND S_FIELDCAT TO T_FIELDCAT.
    CLEAR S_FIELDCAT.
    S_FIELDCAT-COL_POS = '2'.
    S_FIELDCAT-FIELDNAME = 'MATNR'.
    S_FIELDCAT-SCRTEXT_M = 'MATERIAL'.
    APPEND S_FIELDCAT TO T_FIELDCAT.
    S_FIELDCAT-COL_POS = '3'.
    S_FIELDCAT-FIELDNAME = 'MTART'.
    S_FIELDCAT-SCRTEXT_M = 'MATERL TYPE'.
    APPEND S_FIELDCAT TO T_FIELDCAT.
    S_FIELDCAT-COL_POS = '4'.
    S_FIELDCAT-FIELDNAME = 'MEINS'.
    S_FIELDCAT-SCRTEXT_M = 'UOM'.
    APPEND S_FIELDCAT TO T_FIELDCAT.
    ENDFORM. " BUILD_CATALOG
    *& Form BUILD_LAYOUT
    text
    --> p1 text
    <-- p2 text
    FORM BUILD_LAYOUT .
    S_LAYOUT-ZEBRA = 'X'.
    S_LAYOUT-CWIDTH_OPT = 'X'.
    S_LAYOUT-GRID_TITLE = 'Material Details'.
    ENDFORM.
    " BUILD_LAYOUT////////////////////////////////////
    " USER_COMMAND_0100 INPUT
    *& Form FORM_USERCOMMAND
    text
    <--P_E_UCOMM text
    form FORM_USERCOMMAND changing p_e_ucomm.
    CASE P_E_UCOMM.
    WHEN 'INT1'.
    DO.
    READ TABLE IT_MARA INDEX SY-INDEX TRANSPORTING MARK MATNR.
    IF SY-SUBRC <> 0.
    EXIT.
    ENDIF.
    IF IT_MARA-MARK = 'X'.
    read table it_mara into wa TRANSPORTING MATNR MTART MEINS .
    MOVE-CORRESPONDING WA TO IT_MARA1.
    READ TABLE IT_MARA1 TRANSPORTING MATNR MTART MEINS .
    MOVE-CORRESPONDING IT_MARA1 TO IT_MARA2.
    APPEND IT_MARA2.
    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    IS_LAYOUT = s_layout
    CHANGING
    IT_OUTTAB = it_mara2[]
    IT_FIELDCATALOG = t_fieldcat1.
    SET PARAMETER ID 'MAT' FIELD IT_MARA-MATNR.
    CALL TRANSACTION 'MM02'.
    . ENDIF.
    ENDIF.
    ENDDO.
    ENDCASE.
    endform. " FORM_USERCOMMAND
    *& Form FORM_TOOLBAR
    text
    <--P_E_OBJECT text
    <--P_E_INTERACTIVE text
    <--P_E_OBJECT_>MT_TOOLBAR text
    FORM FORM_TOOLBAR CHANGING P_E_OBJECT TYPE REF TO
    CL_ALV_EVENT_TOOLBAR_SET
    P_E_INTERACTIVE
    MT_TOOLBAR TYPE TTB_BUTTON.
    DATA WAL_BUTTON TYPE STB_BUTTON.
    *WAL_BUTTON-ICON = ICON_status_reverse.
    WAL_BUTTON-TEXT = 'GO'.
    WAL_BUTTON-QUICKINFO = 'PROCEED'.
    waL_button-FUNCTION = 'INT1'.
    WAL_BUTTON-BUTN_TYPE = 0.
    WAL_BUTTON-DISABLED = SPACE.
    insert WAL_BUTTON INTO P_E_OBJECT->MT_TOOLBAR index 1.
    endform. " FORM_TOOLBAR
    *& Module PF-STATUS OUTPUT
    text
    module PF-STATUS output.
    set pf-status 'Z7PSTAT'.
    endmodule. " PF-STATUS OUTPUT
    *& Module USER_COMMAND_0100 INPUT
    text
    module USER_COMMAND_0100 input.
    CASE SY-UCOMM.
    WHEN 'BACK'.
    LEAVE PROGRAM.
    WHEN 'CANCEL'.
    LEAVE PROGRAM.
    ENDCASE.
    endmodule. " USER_COMMAND_0100 INPUT
    *& Form BUILD_CATALOG1
    text
    --> p1 text
    <-- p2 text
    form BUILD_CATALOG1 .
    S_FIELDCAT-COL_POS = '1'.
    S_FIELDCAT-FIELDNAME = 'MATNR'.
    S_FIELDCAT-SCRTEXT_M = 'MATERIAL'.
    APPEND S_FIELDCAT TO T_FIELDCAT1.
    S_FIELDCAT-COL_POS = '2'.
    S_FIELDCAT-FIELDNAME = 'MTART'.
    S_FIELDCAT-SCRTEXT_M = 'MATERL TYPE'.
    APPEND S_FIELDCAT TO T_FIELDCAT1.
    S_FIELDCAT-COL_POS = '3'.
    S_FIELDCAT-FIELDNAME = 'MEINS'.
    S_FIELDCAT-SCRTEXT_M = 'UOM'.
    APPEND S_FIELDCAT TO T_FIELDCAT1.
    endform. " BUILD_CATALOG1
    check the below link may be useful for you
    http://www.sapdevelopment.co.uk/reporting/alvhome.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
    BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
    BCALV_GRID_DEMO Simple ALV Control Call Demo Program
    BCALV_TREE_DEMO Demo for ALV tree control
    BCALV_TREE_SIMPLE_DEMO
    BC_ALV_DEMO_HTML_D0100
    <b>Reward all helpfull answers</b>
    Regards

  • Editable fields on ALV grid

    hi
    can i make the fields of one of the columns of one of the rows as editable in ALV_GRID FM..?
    if so pls guide me how do i do it..
    after the user edits the data in the field, can i save that in another variable or another internal table? or modify the same internal table?
    pls send me an example code also...
    thanks in advance
    srini

    hi,
    editable alv:
    chk this link.
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_editable.htm
    then u can capture the events in USER COMMAND.
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_ucomm.htm
    See these threads
    Re: Making selected alv rows editable
    Re: selective edit in ALV grid
    REPORT ZSRI_REPORT6 NO STANDARD PAGE HEADING
    MESSAGE-ID ZZ
    LINE-SIZE 132
    LINE-COUNT 65 .
    TABLES: MARA.
    TYPE-POOLS: SLIS.
    TYPES: BEGIN OF T_MARA,
    MATNR TYPE MARA-MATNR, "Material Number
    ERSDA TYPE MARA-ERSDA, "Creation date
    BRGEW TYPE MARA-BRGEW, "Gross weight
    NTGEW TYPE MARA-NTGEW, "Net weight
    MTART TYPE MARA-MTART, "Material type
    MBRSH TYPE MARA-MBRSH, "Industry Sector
    REC_SEL TYPE C , "checkbox
    END OF T_MARA.
    V A R I A B L E S
    DATA: V_REPID LIKE SY-REPID,
    V_FLAG(1) TYPE C.
    CONSTANTS :
    C_X(1) TYPE C VALUE 'X',
    C_PF_STATUS TYPE SLIS_FORMNAME VALUE 'F_SET_PF_STATUS',
    C_FC_DELETE(6) TYPE C VALUE 'DELETE',
    C_FC_MODIFY(6) TYPE C VALUE 'MODIFY',
    C_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'F_USER_COMMAND',
    C_USER_COMMAND_MODIFY TYPE SLIS_FORMNAME
    VALUE 'F_USER_COMMAND_MODIFY',
    C_ICON_DELETE TYPE ICON-NAME VALUE 'ICON_DELETE', " Icon,Delete'
    C_ICON_CANCEL TYPE ICON-NAME VALUE 'ICON_CANCEL', " Icon,Cancel'
    C_FC_SAVE(4) TYPE C VALUE 'SAVE'.
    *internal table declarations.
    DATA: IT_MARA TYPE STANDARD TABLE OF T_MARA WITH HEADER LINE,
    IT_MODIFY TYPE STANDARD TABLE OF T_MARA WITH HEADER LINE,
    IT_TEMP TYPE STANDARD TABLE OF MARA WITH HEADER LINE,
    *-ALV Internal Tables.
    *--Field Catalog
    IT_FIELDCAT TYPE STANDARD TABLE OF
    SLIS_FIELDCAT_ALV WITH HEADER LINE,
    *--Layout
    WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
    *--Sort
    IT_SORT TYPE SLIS_T_SORTINFO_ALV,
    WA_SORT TYPE SLIS_SORTINFO_ALV ,
    **-Structure for excluding function codes
    WA_EXTAB TYPE SLIS_EXTAB,
    **-To hold function codes to be excluded in ALV toolbar
    IT_EXTAB TYPE SLIS_T_EXTAB.
    *selection screen.
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_MATNR FOR MARA-MATNR,
    S_ERSDA FOR MARA-ERSDA.
    SELECTION-SCREEN: END OF BLOCK B1.
    *--Radio buttons to select either Display/Delete/Modify
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME
    TITLE TEXT-002.
    SELECTION-SCREEN : BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) TEXT-003.
    PARAMETERS: P_DISP RADIOBUTTON GROUP RAD1 DEFAULT 'X'.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) TEXT-005.
    PARAMETERS: P_UPD RADIOBUTTON GROUP RAD1.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) TEXT-004.
    PARAMETERS: P_DEL RADIOBUTTON GROUP RAD1.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN END OF BLOCK B2 .
    AT SELECTION-SCREEN.
    PERFORM VALIDATE_SCREEN.
    *start of selection
    START-OF-SELECTION.
    *clear the internal tables to be used.
    CLEAR: IT_MARA,IT_MARA[],
    V_FLAG.
    *get the data
    PERFORM GET_DATA.
    *end of selection
    END-OF-SELECTION.
    IF IT_MARA[] IS INITIAL.
    MESSAGE I000 WITH
    'No Records found for the given Selection Criteria'(012).
    ELSE.
    *do alv process
    V_REPID = SY-REPID.
    *--Sort the Output Fields
    PERFORM SORT_FIELDS.
    *--Build Field catalog for the Output fields
    PERFORM BUILD_FIELDCAT.
    *--Set the Layout for ALV
    PERFORM SET_LAYOUT.
    IF P_DISP = C_X.
    *--Exclude any Buttons on the Appn tool bar
    perform change_default_pf_status.
    MOVE C_FC_DELETE TO WA_EXTAB-FCODE. " DELETE button on ALV
    APPEND WA_EXTAB TO IT_EXTAB.
    MOVE C_FC_MODIFY TO WA_EXTAB-FCODE. " MODIFY button on ALV
    APPEND WA_EXTAB TO IT_EXTAB.
    ELSEIF P_UPD = C_X.
    *--Exclude DELETE Button on the appn tool bar
    MOVE C_FC_DELETE TO WA_EXTAB-FCODE. " DELETE button on ALV
    APPEND WA_EXTAB TO IT_EXTAB.
    ELSEIF P_DEL = C_X.
    *--Exclude MODIFY button on appn tool bar
    MOVE C_FC_MODIFY TO WA_EXTAB-FCODE. " MODIFY button on ALV
    APPEND WA_EXTAB TO IT_EXTAB.
    ENDIF.
    *--Exclude SAVE button for all options
    MOVE 'SAVE' TO WA_EXTAB-FCODE. " SAVE button on ALV
    APPEND WA_EXTAB TO IT_EXTAB.
    *--Display ALV output
    PERFORM LIST_DISPLAY TABLES IT_MARA
    USING C_USER_COMMAND.
    ENDIF.
    *& Form get_data
    FORM GET_DATA .
    SELECT MATNR
    ERSDA
    BRGEW
    NTGEW
    MTART
    MBRSH
    FROM MARA
    INTO TABLE IT_MARA
    WHERE MATNR IN S_MATNR
    AND ERSDA IN S_ERSDA.
    IF SY-SUBRC <> 0.
    *no records selected leave processing
    STOP.
    ENDIF.
    SORT IT_MARA.
    ENDFORM. " get_data
    *& Form sort_fields
    text
    --> p1 text
    <-- p2 text
    FORM SORT_FIELDS .
    CLEAR WA_SORT.
    WA_SORT-FIELDNAME = 'MATNR'.
    WA_SORT-SPOS = '1'.
    WA_SORT-UP = 'X'.
    APPEND WA_SORT TO IT_SORT.
    CLEAR WA_SORT.
    WA_SORT-FIELDNAME = 'ERSDA'.
    WA_SORT-SPOS = '2'.
    WA_SORT-UP = 'X'.
    APPEND WA_SORT TO IT_SORT.
    ENDFORM. " sort_fields
    *& Form build_fieldcat
    text
    --> p1 text
    <-- p2 text
    FORM BUILD_FIELDCAT .
    IT_FIELDCAT-COL_POS = '1'.
    IT_FIELDCAT-FIELDNAME = 'MATNR'.
    IT_FIELDCAT-KEY = 'X'.
    IT_FIELDCAT-OUTPUTLEN = '15'.
    IT_FIELDCAT-SELTEXT_L = 'Material number'(022).
    APPEND IT_FIELDCAT.
    CLEAR IT_FIELDCAT.
    IT_FIELDCAT-COL_POS = '2'.
    IT_FIELDCAT-FIELDNAME = 'ERSDA'.
    IT_FIELDCAT-KEY = 'X'.
    IT_FIELDCAT-OUTPUTLEN = '10'.
    IT_FIELDCAT-SELTEXT_L = 'Created on'(023).
    APPEND IT_FIELDCAT.
    CLEAR IT_FIELDCAT.
    IT_FIELDCAT-COL_POS = '3'.
    IT_FIELDCAT-FIELDNAME = 'BRGEW'.
    IT_FIELDCAT-OUTPUTLEN = '10'.
    IT_FIELDCAT-SELTEXT_L = 'GROSS WEIGHT'(024).
    APPEND IT_FIELDCAT.
    CLEAR IT_FIELDCAT.
    IT_FIELDCAT-COL_POS = '4'.
    IT_FIELDCAT-FIELDNAME = 'NTGEW'.
    IT_FIELDCAT-OUTPUTLEN = '15'.
    IT_FIELDCAT-SELTEXT_L = 'NET WEIGHT'(025).
    APPEND IT_FIELDCAT.
    CLEAR IT_FIELDCAT.
    IT_FIELDCAT-COL_POS = '5'.
    IT_FIELDCAT-FIELDNAME = 'MTART'.
    IT_FIELDCAT-OUTPUTLEN = '3'.
    IT_FIELDCAT-SELTEXT_L = 'Material type'(026).
    APPEND IT_FIELDCAT.
    CLEAR IT_FIELDCAT.
    IT_FIELDCAT-COL_POS = '6'.
    IT_FIELDCAT-FIELDNAME = 'MBRSH'.
    IT_FIELDCAT-OUTPUTLEN = '25'.
    IT_FIELDCAT-SELTEXT_L = 'Industry sector'(027).
    APPEND IT_FIELDCAT.
    CLEAR IT_FIELDCAT.
    IT_FIELDCAT-FIELDNAME = 'REC_SEL'.
    IT_FIELDCAT-NO_OUT = C_X.
    APPEND IT_FIELDCAT.
    CLEAR IT_FIELDCAT.
    ENDFORM. " build_fieldcat
    *& Form list_display
    text
    -->P_IT_MARA text
    -->P_C_USER_COMMAND text
    FORM LIST_DISPLAY TABLES P_IT_MARA
    USING P_USER_COMMAND TYPE SLIS_FORMNAME.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = V_REPID
    I_CALLBACK_PF_STATUS_SET = C_PF_STATUS
    I_CALLBACK_USER_COMMAND = P_USER_COMMAND
    IS_LAYOUT = WA_LAYOUT
    IT_FIELDCAT = IT_FIELDCAT[]
    IT_EXCLUDING = IT_EXTAB[]
    IT_SORT = IT_SORT[]
    TABLES
    T_OUTTAB = P_IT_MARA
    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.
    ENDFORM. " list_display
    *& Form F_SET_PF_STATUS
    Set PF_STATUS STANDARD modifying the standard toolbar
    by excluding some buttons
    -->P_IT_EXTAB -- TABLE OF EXCLUDING FUNCTIONS
    FORM F_SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
    CLEAR : WA_EXTAB,
    IT_EXTAB.
    *--Set the Modified PF status for the ALV.
    SET PF-STATUS 'ALV_STATUS_01' EXCLUDING RT_EXTAB.
    ENDFORM. " SET_PF_STATUS
    *& Form f_user_command
    Handle user action on ALV toolbar
    FORM F_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
    RS_SELFIELD-REFRESH = C_X.
    IF R_UCOMM = C_FC_DELETE.
    *--User Selected DELETE button.
    PERFORM DELETE_SELECTED_RECORDS.
    ELSEIF R_UCOMM = C_FC_MODIFY.
    *--If user selects MODIFY button.
    PERFORM CHANGE_RECORDS.
    ENDIF.
    ENDFORM. "F_USER_COMMAND
    *& Form POP_UP_CONFIRMATION
    text
    <--P_ANSWER text
    FORM POP_UP_CONFIRMATION
    CHANGING P_ANSWER TYPE C.
    DATA:
    L_TITLE(14) TYPE C, " Title of pop-up
    L_TXT_QUESTION(52) TYPE C, " Text displayed in pop-up
    L_DISP_CANCEL TYPE C, " Display 'Cancel' button?
    L_BTN1 TYPE ICON-NAME, " Icon on button 1
    L_BTN2 TYPE ICON-NAME. " Icon on button 2
    L_TITLE = 'Delete'(017). " delete
    L_TXT_QUESTION = 'Are you sure to delete?'(018).
    L_BTN1 = C_ICON_DELETE.
    L_BTN2 = C_ICON_CANCEL.
    **-Display pop-up asking user for confirmation
    CALL FUNCTION 'POPUP_TO_CONFIRM'
    EXPORTING
    TITLEBAR = L_TITLE
    TEXT_QUESTION = L_TXT_QUESTION
    TEXT_BUTTON_1 = 'Yes'
    ICON_BUTTON_1 = L_BTN1
    TEXT_BUTTON_2 = 'No'
    ICON_BUTTON_2 = L_BTN2
    DEFAULT_BUTTON = '2'
    DISPLAY_CANCEL_BUTTON = 'X'
    IMPORTING
    ANSWER = P_ANSWER
    EXCEPTIONS
    TEXT_NOT_FOUND = 1
    OTHERS = 2.
    IF SY-SUBRC <> 0.
    MESSAGE E000 WITH 'Error executing function module:'(019)
    'POPUP_TO_CONFIRM'.
    ENDIF.
    ENDFORM. "pop_up_confirmation
    *& Form set_layout
    text
    --> p1 text
    <-- p2 text
    FORM SET_LAYOUT .
    IF P_DEL = C_X OR P_UPD = C_X.
    *--Allow Input only if user choose 'UPDATE'/ 'DELETE' radio buttons
    WA_LAYOUT-BOX_FIELDNAME = 'REC_SEL'.
    WA_LAYOUT-BOX_TABNAME = 'IT_MARA'.
    ENDIF.
    *--Display Header based on the user selection
    IF P_DISP = C_X.
    WA_LAYOUT-WINDOW_TITLEBAR =
    'Display '(036).
    ELSEIF P_DEL = C_X.
    WA_LAYOUT-WINDOW_TITLEBAR =
    'Delete '(037).
    ELSEIF P_UPD = C_X.
    WA_LAYOUT-WINDOW_TITLEBAR =
    'Change '(038).
    ENDIF.
    ENDFORM. " set_layout
    *& Form change_default_pf_status
    text
    --> p1 text
    <-- p2 text
    FORM CHANGE_DEFAULT_PF_STATUS .
    MOVE C_FC_DELETE TO WA_EXTAB-FCODE. " DELETE button on ALV
    APPEND WA_EXTAB TO IT_EXTAB.
    MOVE C_FC_MODIFY TO WA_EXTAB-FCODE. " MODIFY button on ALV
    APPEND WA_EXTAB TO IT_EXTAB.
    ENDFORM. " change_default_pf_status
    *& Form f_user_command
    Handle user action on ALV toolbar
    FORM F_USER_COMMAND_MODIFY USING R_UCOMM LIKE SY-UCOMM "#EC *
    RS_SELFIELD TYPE SLIS_SELFIELD.
    DATA : L_ANSWER TYPE C. "#EC *
    IF R_UCOMM = C_FC_SAVE.
    *user selected save button
    READ TABLE IT_MODIFY WITH KEY REC_SEL = 'X'.
    *check if user selected atleast one line.
    IF SY-SUBRC <> 0.
    MESSAGE I000 WITH 'No record(s) Selected to Modify'(016).
    EXIT.
    ENDIF.
    LOOP AT IT_MODIFY WHERE REC_SEL = 'X'.
    *--Check the entered values are valid or not.
    IF NOT ( it_modify-status = 'A' OR
    it_modify-status = 'C' OR
    it_modify-status = 'E' ).
    *--User Entered invalid value for STATUS field,so Display Error Msg
    CLEAR R_UCOMM.
    MESSAGE e000 WITH 'Invalid value '''(031)
    '' for Status in the Record # '(032)
    sy-tabix.
    ENDIF.
    ENDLOOP.
    CLEAR: IT_TEMP,
    IT_TEMP[].
    LOOP AT IT_MODIFY WHERE REC_SEL = 'X'.
    MOVE-CORRESPONDING IT_MODIFY TO IT_TEMP.
    APPEND IT_TEMP.
    CLEAR IT_TEMP.
    ENDLOOP.
    *--start new code
    DATA : IT_TEMP2 LIKE STANDARD TABLE OF MARA WITH HEADER LINE.
    SELECT * FROM MARA
    INTO TABLE IT_TEMP2
    FOR ALL ENTRIES IN IT_TEMP
    WHERE MATNR = IT_TEMP-MATNR.
    IF SY-SUBRC = 0.
    LOOP AT IT_MODIFY WHERE REC_SEL = 'X'.
    READ TABLE IT_TEMP2 WITH KEY MATNR = IT_MODIFY-MATNR.
    IF SY-SUBRC = 0.
    IT_TEMP2-NTGEW = IT_MODIFY-NTGEW.
    IT_TEMP2-BRGEW = IT_MODIFY-BRGEW.
    MODIFY IT_TEMP2 INDEX SY-TABIX.
    ENDIF.
    ENDLOOP.
    ENDIF.
    *modify mara table with the changed values
    MODIFY MARA FROM TABLE IT_TEMP2 .
    *--end new code
    IF SY-SUBRC = 0.
    COMMIT WORK AND WAIT.
    *--Display message with Success in Updating database
    MESSAGE I000 WITH SY-DBCNT
    ' Record(s) has been Updated'(020).
    CLEAR :
    IT_MARA,
    IT_MARA[].
    *get-data again from database.
    PERFORM GET_DATA.
    RS_SELFIELD-REFRESH = C_X.
    ELSE.
    *--Error occurred
    MESSAGE I000 WITH 'Error occured in Modifying the database'(021).
    ENDIF.
    ENDIF.
    ENDFORM. "f_user_command_modify
    *& Form validate_screen
    text
    --> p1 text
    <-- p2 text
    FORM VALIDATE_SCREEN .
    DATA : LV_MATNR LIKE MARA-MATNR.
    *--validate product
    IF NOT S_MATNR[] IS INITIAL.
    SELECT MATNR
    INTO MARA-MATNR
    FROM MARA
    WHERE MATNR IN S_MATNR.
    ENDSELECT.
    IF SY-SUBRC <> 0.
    *--Error
    MESSAGE E000 WITH 'Invalid Material'(034).
    ENDIF.
    ENDIF.
    ENDFORM. " validate_screen
    *& Form delete_records
    text
    --> p1 text
    <-- p2 text
    FORM DELETE_RECORDS .
    LOOP AT IT_MARA.
    MOVE-CORRESPONDING IT_MARA TO IT_TEMP.
    APPEND IT_TEMP.
    CLEAR IT_TEMP.
    ENDLOOP.
    DELETE MARA FROM TABLE IT_TEMP.
    IF SY-SUBRC = 0.
    *--Successfully selected records Deleted.
    COMMIT WORK AND WAIT.
    *--Display Success Message to the user
    MESSAGE I000 WITH SY-DBCNT
    ' Record(s) deleted Successfully'(010).
    ELSE.
    *--Error occured in deletion
    MESSAGE I000 WITH 'Error occured in Deleting the Record(s)'(011).
    ENDIF.
    CLEAR: IT_MARA,
    IT_MARA[],
    IT_TEMP,
    IT_TEMP[].
    V_FLAG = C_X.
    STOP.
    ENDFORM. " delete_records
    *& Form delete_selected_records
    text
    --> p1 text
    <-- p2 text
    FORM DELETE_SELECTED_RECORDS .
    DATA : L_ANSWER(1) TYPE C.
    READ TABLE IT_MARA WITH KEY REC_SEL = C_X.
    IF SY-SUBRC <> 0.
    MESSAGE I000 WITH 'No record(s) Selected to Delete'(013).
    EXIT.
    ELSE.
    *--Ask for delete confirmation
    PERFORM POP_UP_CONFIRMATION
    CHANGING L_ANSWER.
    IF L_ANSWER = '1'. " 'Yes'
    CLEAR: IT_TEMP,
    IT_TEMP[].
    LOOP AT IT_MARA WHERE REC_SEL = 'X'.
    MOVE-CORRESPONDING IT_MARA TO IT_TEMP.
    APPEND IT_TEMP.
    CLEAR IT_TEMP.
    ENDLOOP.
    DELETE MARA FROM TABLE IT_TEMP.
    IF SY-SUBRC = 0.
    *--Successfully selected records Deleted.
    COMMIT WORK AND WAIT.
    *--Display completed work information to the user
    MESSAGE I000 WITH SY-DBCNT
    ' Record(s) deleted Successfully'(014).
    *--Clear the Internal tables
    CLEAR: IT_MARA,
    IT_MARA[].
    *--Reselects entries from Database again & display in ALV
    PERFORM GET_DATA.
    ELSE.
    *--Error occured
    MESSAGE I000 WITH
    'Error occured in Deleting the Record(s)'(015).
    ENDIF.
    ENDIF.
    ENDIF.
    ENDFORM. " delete_selected_records
    *& Form change_records
    text
    --> p1 text
    <-- p2 text
    FORM CHANGE_RECORDS .
    READ TABLE IT_MARA WITH KEY REC_SEL = 'X'.
    *--check user selected at least 1 record to MODIFY or not
    IF SY-SUBRC <> 0.
    MESSAGE I000 WITH 'No record(s) Selected to Modify'(016).
    EXIT.
    ELSE.
    CLEAR : IT_MODIFY,
    IT_MODIFY[].
    LOOP AT IT_MARA WHERE REC_SEL = 'X'.
    IT_MODIFY = IT_MARA.
    APPEND IT_MODIFY.
    CLEAR IT_MODIFY.
    ENDLOOP.
    *--Change PF status for this new ALV list.
    PERFORM CHANGE_PF_STATUS_AGAIN.
    *--Change Field Catalog to make INPUT enabled.
    READ TABLE IT_FIELDCAT WITH KEY FIELDNAME = 'NTGEW'.
    IT_FIELDCAT-INPUT = C_X.
    MODIFY IT_FIELDCAT INDEX SY-TABIX.
    *--Call ALV LIST DISPLAY with this new values.
    PERFORM LIST_DISPLAY TABLES IT_MODIFY
    USING C_USER_COMMAND_MODIFY.
    ENDIF.
    ENDFORM. " change_records
    *& Form change_pf_status_again
    text
    --> p1 text
    <-- p2 text
    FORM CHANGE_PF_STATUS_AGAIN .
    MOVE C_FC_DELETE TO WA_EXTAB-FCODE. " DELETE button on ALV
    APPEND WA_EXTAB TO IT_EXTAB.
    MOVE C_FC_MODIFY TO WA_EXTAB-FCODE. " MODIFY button on ALV
    APPEND WA_EXTAB TO IT_EXTAB.
    ENDFORM. " change_pf_status_again

  • Editable field in ALV GRID/LIST

    Hi All,
    I developed an alv program in which 10 rows is there. In alv grid/list first column is check box. I want 1,5 and 10th row is editable for first column (check box) while rest is not editable. Can you please give solution for same. Please tell me simple method not oops methos
    coz I have taken FM REUSE_ALV_GRID_DISPLAY or REUSE_ALV_LIST_DISPLAY.
    Thanks,
    Rakesh

    goto se38.
    BCALVEDIT*
    press F4
    many examples are there..
    BCALV_GRID_EDIT try this...

Maybe you are looking for

  • I get the message "rnpag has stopped working" followed by "firfoxx has stopped working", what can I do to get firefox working again?

    Over the past few months firefox has been crashing unexpectedly but just today it crashed and will not reopen even after shutting down and restarting my laptop. The message that appears when I start my laptop and again when I try to open firefox is "

  • HT1926 ITunes 11 install issue, Error 7 (Windows error 126)

    While trying to install ITunes11 on a Windows Desktop with MS XP SP3 I keep getting an error message that states "ITunes was not installed correctly.Please reinstall ITunes.Error 7(Windows error 126)".There is an initial message that states that "App

  • How to set the state of browser frame?

    hello all, can u suggest some way to set the state of applet broser from minimized to maximized. the class name for browser window is shown as "com.ms.applet.BrowserAppletFrame." i can type cast the browser frame reference to Frame class, but the met

  • EJB handle containing t3://null:7001

    I'm working on a cluster, using in-memory replication, on SunOs 5.6 (WLS           5.01 sp1).           I've 102 stateless session bean, and only 1 stateful.           The stateful has in weblogic-ejb-home.xml the following:           <weblogic-ejb-j

  • XI Adapter

    Hi All, I'am doing a sample scenario(XI--->XI). 1.I dont know the structure of XI adapter.I've taken 2 data types for sender and receiver and 2 datatypes for request and response. 2.As my observation in HTTP--->RFC we need to create 1 http req and 1