Get checkbox values from alv grid

Hi,
I'm using the function REUSE_ALV_GRID_DISPLAY and I'm showing a table with a field like a checkbox.
In USER_COMMAND FORM to get selected values do as follow:
    CALL METHOD REF_GRID->CHECK_CHANGED_DATA.
And then:
loop at i_pos (my table) with checkbox eq 'X'.
endloop.
The first time I execute the ALV every thing is OK but if I do any action (I use the function 'BAPI_GOODSMVT_CREATE' ...), I refresh the data and I raise the alv again. In USER COMMAND FORM the code is the same and I can not get checkbox values.
Can someone help me please?
Thanks and regards.

Hi,
Check this
    call function 'REUSE_ALV_GRID_DISPLAY'
      exporting
        it_fieldcat                 = pt_grpfcat[]
        it_excluding                = p_grpexcltab2[]
        is_layout                   = pt_grplayout2
        i_callback_program          = sy-repid
        i_callback_html_top_of_page = p_header
        i_callback_pf_status_set    = v_status_set1
        i_callback_user_command     = f_user_command1
        i_screen_start_column       = 25
        i_screen_start_line         = 5
        i_screen_end_column         = 80
        i_screen_end_line           = 20
        it_events                   = i_events[]
      tables
        t_outtab                    = i_grpoutput.
form f_user_command1 using p_ucomm type sy-ucomm
                     rs_selfield type  slis_selfield.
  data p_ref1 type ref to cl_gui_alv_grid.
  call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    importing
      e_grid = p_ref1.
  call method p_ref1->check_changed_data.
  case p_ucomm.
    when 'YCNC'.
      leave to screen 0.
   endcase.
  rs_selfield-refresh = c_x.   " Grid refresh  < You need to fill up this
endform.                                 " F_user_command1
aRs

Similar Messages

  • How to get Checkbox Value from Flex in PHP.

    Hi,
    I need to know how to get a checkbox value from flex in PHP-POST/GET because I don't know what is the value property of a checkbox in flex.
    Please Help.

    Hi,
    It is very simple. Follow the steps below to achieve the solution,
    1. Write a check-box change event to capture the value of the check box. Store this value in a variable(say bolChkSelected:Boolean).
    2. In step 1 you got the value of the check box. Now your aim is to send the value to php. Declare a httpService in your flex application(i think you are aware of using it).Ok..im writing it
    <mx:HTTPService id="sampleService" resultFormat='e4x' url='http://yourdomain/file.php' result='handleResult()' fault='handleFault()'>
    </mx:HTTPService>
    3. Now the actual solution... u need to send the shcStatus in to php..
    Declare an object to hold the data
    var objparameters:Object={};
    objparameters['CheckBoxdata'] = bolChkSelected;
    --in the above line... 'CheckBoxdata' is used as a parameter to php..you shud have the same variable name while accessing in php file also..
    in php file..
    checkboxstatus = $_POST[''CheckBoxdata''];
    echo checkboxstatus
    thats it..

  • How to get column value from DB grid

    Hi!
    I wander how to get col value from GridControl?
    My app consists of one rowsetinfo with two
    columns CODE and DESCRIPTION and a jbutton
    titled SELECT. When user clicks SELECT button
    the app should show the value of the CODE col
    of the selected row in GridControl.
    I wander how to make this action ?
    XxpsTransTimesMasterIter.setAttributeInfo( new AttributeInfo[] {
    CODEXxpsTransTimesMasterIter,
    DESCRIPTIONXxpsTransTimesMasterIter} );
    XxpsTransTimesMasterIter.setName("XxpsTransTimes");
    XxpsTransTimesMasterIter.setQueryInfo(new QueryInfo(
    "XxpsTransTimesMasterIterViewUsage",
    "lov.XxpsTransTimes",
    "CODE, DESCRIPTION",
    "XXPS_TRANS_TIMES",
    null,
    null
    ));

    Hi,
    You could attach an ActionListener on the JButton, and try the following code :
    NavigationManager fm = NavigationManager.getNavigationManager();
    DataItem dataItem = fm.getFocusedControl().getDataItem();
    ImmediateAccess col_code = null;
    String code = null;
    if (dataItem != null && dataItem instanceof RowsetAccess) {
    RowsetAccess rowset = (RowsetAccess)dataItem;
    try {
    col_code = (ImmediateAccess) rowset.getColumnItem("CODE");
    code = col_code.getValueAsString();
    } catch (DuplicateColumnException de) {
    return;
    } catch (ColumnNotFoundException ce) {
    return;
    } catch (SQLException se) {
    return;
    JTextField tf = new JtextField();
    tf.setText(code);
    I haven't tested this code.
    I am curious to know, the Object type of the dataItem.If it doesnot happen to be RowsetAccess ..try.. ScrollableRowsetAccess OR ImmediateAccess.
    Your code would change accordingly, depending on the instance.Refer to the product documentation for this.
    Do let me know, if this works.
    TIA
    Sandeep

  • Getting data back from ALV grid

    This looks like a topic discussed before but i still need some clearifications. I display an internal table in ALV grid, in editable format. user changes the data and presses A BUTTON. On doing that I need to re-capture the changes made in a internal table.
    I have used method "check_changed_data' but it doesnt seem to work. It keeps appending data in the internal table if the user changes it multiple times. please suggest me some ideas on how to go about it.
    Thanks.
    shiv

    Hi then i will give another code with OO that fits your requirement check...
    REPORT ZTEST  NO STANDARD PAGE HEADING
                            LINE-SIZE  200
                            LINE-COUNT 58
                            MESSAGE-ID ZZ.
    *                Include for Data Declarations
    INCLUDE ZSDR0057_DEL_HOLD_TOP.
    INCLUDE <ICON>.
    **Tables to Compare Before after the Data Change
    DATA: IT_VEKP_TMP LIKE IT_VEKP OCCURS 0 WITH HEADER LINE,
          IT_VEKP1 LIKE IT_VEKP OCCURS 0 WITH HEADER LINE,
          IT_VEKP1_TMP LIKE IT_VEKP OCCURS 0 WITH HEADER LINE,
          IT_FINAL_TMP LIKE IT_FINAL OCCURS 0 WITH HEADER LINE,
          IT_OCRC TYPE TABLE OF ZSD_OC_HOLD.
    DATA: L_VALID TYPE C,
          L_VALID1 TYPE C,
          V_FLAG,
          V_DATA_CHANGE.
    DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
    *       CLASS lcl_event_handler DEFINITION
    CLASS LCL_EVENT_HANDLER DEFINITION .
      PUBLIC SECTION .
        METHODS:
    **Hot spot Handler
        HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                          IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
    **User Command Handler
        HANDLE_USER_COMMAND FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
                                     IMPORTING E_UCOMM,
    **Double Click Handler
        HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                                         IMPORTING E_ROW E_COLUMN,
    **Handler to Check the Data Change
        HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
                             OF CL_GUI_ALV_GRID
                             IMPORTING ER_DATA_CHANGED
                                       E_ONF4
                                       E_ONF4_BEFORE
                                       E_ONF4_AFTER,
        HANDLE_TOOLBAR
            FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
                IMPORTING E_OBJECT E_INTERACTIVE.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    *       CLASS lcl_event_handler DEFINITION for second screen
    CLASS LCL_EVENT_HANDLER1 DEFINITION .
      PUBLIC SECTION .
        METHODS:
    **User Command Handler
        HANDLE_USER_COMMAND FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
                                     IMPORTING E_UCOMM,
        HANDLE_TOOLBAR
            FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
                IMPORTING E_OBJECT E_INTERACTIVE.
    ENDCLASS.                    "lcl_event_handler1 DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    *Handle Hotspot Click
      METHOD HANDLE_HOTSPOT_CLICK .
        PERFORM HANDLE_HOTSPOT_CLICK USING E_ROW_ID E_COLUMN_ID ES_ROW_NO .
      ENDMETHOD.                    "lcl_event_handler
    *Handle User Command
      METHOD HANDLE_USER_COMMAND.
        PERFORM EVENT_UCOMM USING E_UCOMM.
      ENDMETHOD.                    "user_command
    *Handle Double Click
      METHOD  HANDLE_DOUBLE_CLICK.
        DATA X_FINAL TYPE T_FINAL.
        IF V_DATA_CHANGE IS INITIAL.
          IF E_COLUMN = 'ZZPROMDT' OR E_COLUMN = 'ZZOCHOLDRC'.
            READ TABLE IT_FINAL INDEX E_ROW INTO X_FINAL
                                             TRANSPORTING
                                             VBELN
                                             VGBEL
                                             VGPOS
                                             ZZPROMDT
                                             ZZOCHOLDRC.
            IF SY-SUBRC = 0.
              PERFORM GET_HU_DATA USING X_FINAL.
              PERFORM POPULATE_FIELDCAT2.
            ENDIF.
            CALL SCREEN 200.
          ENDIF.
        ELSE.
       MESSAGE I002 WITH 'Please save the data first and then double click'.
        ENDIF.
      ENDMETHOD.                    "handle_double_click
    **Handle Data Change
      METHOD HANDLE_DATA_CHANGED.
        DATA: X_CHANGE TYPE LVC_S_MODI,
              X_FINAL TYPE T_FINAL,
              X_OCRC TYPE ZSD_OC_HOLD,
              L_FLAG.
        LOOP AT ER_DATA_CHANGED->MT_GOOD_CELLS INTO X_CHANGE.
          IF X_CHANGE-FIELDNAME = 'ZZOCHOLDRC'.
            READ TABLE IT_FINAL INTO X_FINAL INDEX X_CHANGE-ROW_ID.
            IF SY-SUBRC = 0.
              READ TABLE IT_OCRC INTO X_OCRC WITH KEY
                                             ZZOCHOLDRC = X_CHANGE-VALUE
                                            TRANSPORTING ZZRCDESC.
              IF SY-SUBRC = 0.
                X_FINAL-ZZRCDESC = X_OCRC-ZZRCDESC.
                MODIFY IT_FINAL FROM X_FINAL INDEX X_CHANGE-ROW_ID
                                             TRANSPORTING ZZRCDESC.
                L_FLAG = 'X'.
              ENDIF.
            ENDIF.
          ENDIF.
          IF X_CHANGE-FIELDNAME = 'ZZPROMDT'.
            READ TABLE IT_FINAL INTO X_FINAL INDEX X_CHANGE-ROW_ID.
            IF SY-SUBRC = 0.
              X_FINAL-ZZPROMDT = X_CHANGE-VALUE.
              MODIFY IT_FINAL FROM X_FINAL INDEX X_CHANGE-ROW_ID
                                           TRANSPORTING ZZPROMDT.
              L_FLAG = 'X'.
            ENDIF.
          ENDIF.
        ENDLOOP.
        IF L_FLAG = 'X'.
          CLEAR V_DATA_CHANGE.
          V_DATA_CHANGE = 'X'.
        ENDIF.
      ENDMETHOD.                    "data_changed
      METHOD HANDLE_TOOLBAR.
        DATA: LS_TOOLBAR  TYPE STB_BUTTON.
    * append a separator to normal toolbar
        CLEAR LS_TOOLBAR.
        MOVE 3 TO LS_TOOLBAR-BUTN_TYPE.
        APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
    * append SAVE icon
        CLEAR LS_TOOLBAR.
        MOVE 'SAVE' TO LS_TOOLBAR-FUNCTION.
        MOVE ICON_SYSTEM_SAVE TO LS_TOOLBAR-ICON.
        MOVE 'Save' TO LS_TOOLBAR-QUICKINFO.
        MOVE '  Save  '  TO LS_TOOLBAR-TEXT.
        MOVE ' '  TO LS_TOOLBAR-DISABLED.
        APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
        CLEAR LS_TOOLBAR.
    * append a separator to normal toolbar
        CLEAR LS_TOOLBAR.
        MOVE 3 TO LS_TOOLBAR-BUTN_TYPE.
        APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
    * append BACK icon
        CLEAR LS_TOOLBAR.
        MOVE 'BACK' TO LS_TOOLBAR-FUNCTION.
        MOVE ICON_SYSTEM_BACK TO LS_TOOLBAR-ICON.
        MOVE 'Back' TO LS_TOOLBAR-QUICKINFO.
        MOVE ' Back '  TO LS_TOOLBAR-TEXT.
        MOVE ' '  TO LS_TOOLBAR-DISABLED.
        APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
        CLEAR LS_TOOLBAR.
      ENDMETHOD.                    "handle_toolbar
    ENDCLASS.                    "lcl_event_handler IMPLEMENTATION
    *       CLASS lcl_event_handler1 IMPLEMENTATION
    CLASS LCL_EVENT_HANDLER1 IMPLEMENTATION.
    *Handle User Command
      METHOD HANDLE_USER_COMMAND.
        PERFORM EVENT_UCOMM1 USING E_UCOMM.
      ENDMETHOD.                    "user_command
      METHOD HANDLE_TOOLBAR.
        DATA: LS_TOOLBAR  TYPE STB_BUTTON.
    * append a separator to normal toolbar
        CLEAR LS_TOOLBAR.
        MOVE 3 TO LS_TOOLBAR-BUTN_TYPE.
        APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
    * append SAVE icon
        CLEAR LS_TOOLBAR.
        MOVE 'SAVE' TO LS_TOOLBAR-FUNCTION.
        MOVE ICON_SYSTEM_SAVE TO LS_TOOLBAR-ICON.
        MOVE 'Save' TO LS_TOOLBAR-QUICKINFO.
        MOVE ' Save  '  TO LS_TOOLBAR-TEXT.
        MOVE ' '  TO LS_TOOLBAR-DISABLED.
        APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
        CLEAR LS_TOOLBAR.
    * append a separator to normal toolbar
        CLEAR LS_TOOLBAR.
        MOVE 3 TO LS_TOOLBAR-BUTN_TYPE.
        APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
    * append an Back icon
        CLEAR LS_TOOLBAR.
        MOVE 'BACK' TO LS_TOOLBAR-FUNCTION.
        MOVE ICON_SYSTEM_BACK TO LS_TOOLBAR-ICON.
        MOVE 'Back' TO LS_TOOLBAR-QUICKINFO.
        MOVE ' Back  '  TO LS_TOOLBAR-TEXT.
        MOVE ' '  TO LS_TOOLBAR-DISABLED.
        APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
        CLEAR LS_TOOLBAR.
      ENDMETHOD.                    "handle_toolbar
    ENDCLASS.                    "lcl_event_handler1 IMPLEMENTATION
    *&             Global Definitions
    DATA: "G_GRID TYPE REF TO CL_GUI_ALV_GRID,   "Grid for first report
          G_GRID1 TYPE REF TO CL_GUI_ALV_GRID,  "grid for second report
          G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
          G_CUSTOM_CONTAINER1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"container
          G_HANDLER TYPE REF TO LCL_EVENT_HANDLER, "handler
          G_HANDLER1 TYPE REF TO LCL_EVENT_HANDLER1. "handler
    DATA: OK_CODE LIKE SY-UCOMM,
          SAVE_OK LIKE SY-UCOMM,
          G_CONTAINER1 TYPE SCRFNAME VALUE 'ZSDR0057_DEL_HOLD_CONT1',
          G_CONTAINER2 TYPE SCRFNAME VALUE 'ZSDR0057_DEL_HOLD_CONT2',
          GS_LAYOUT TYPE LVC_S_LAYO,
          GS_LAYOUT1 TYPE LVC_S_LAYO.
    *- Fieldcatalog for First and second Report
    DATA: IT_FIELDCAT  TYPE  LVC_T_FCAT,
          X_FIELDCAT TYPE LVC_S_FCAT,
          IT_FIELDCAT1  TYPE  LVC_T_FCAT,
          X_FIELDCAT1 TYPE LVC_S_FCAT,
          LS_VARI  TYPE DISVARIANT.
    *                Selection screen
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_VBELN FOR V_LIKP-VBELN, "Delivery
                    S_VSTEL FOR V_LIKP-VSTEL, "Shipping Point
                    S_WERKS FOR V_LIPS-WERKS, "Plant
                    S_WADAT FOR V_VBEP-WADAT, "Pgi Date
                    S_TRSPG FOR V_LIKP-TRSPG OBLIGATORY,"Shp bolck Reason
                    S_OCHRC FOR V_VEKP-ZZOCHOLDRC MATCHCODE OBJECT
                                       ZZOCHOLDRC, "OC Reason Code
                    S_USERID FOR V_VBAK-ZZREP_USERID1."Rep User ID
    SELECTION-SCREEN END OF BLOCK B1.
    *                START-OF_SELECTION
    START-OF-SELECTION.
      CLEAR IT_LIKP.
      REFRESH IT_LIKP.
      SELECT VBELN
             VSTEL
             LFDAT
             KUNNR
             FROM LIKP
             INTO TABLE IT_LIKP
             WHERE VBELN IN S_VBELN
              AND  VSTEL IN S_VSTEL
              AND  WADAT IN S_WADAT
              AND  WADAT_IST = '00000000'
              AND TRSPG IN S_TRSPG.
      IF SY-SUBRC <> 0.
        CLEAR V_FLAG.
        V_FLAG = 'X'.
      ENDIF.
      IF V_FLAG = ' '.
    **Populating the Delivery Item Data
        PERFORM GET_DEL_ITEM_DATA.
    **Getting the PGI DATE & USERID
        PERFORM GET_USERID.
    **Getting the Promise DATE & OC HOLD RC
        PERFORM GET_VEKP_DATA.
    **get the Reason codes
        PERFORM SELECT_OCHOLDRC.
        IF NOT IT_LIPS[] IS INITIAL
         AND  NOT IT_VBAK[] IS INITIAL
         AND  NOT IT_VEKP_TMP[] IS INITIAL.
    ** Populating the Final Internaltable
          PERFORM POPULATE_FINAL_TABLE.
        ENDIF.
      ENDIF.
    *                END-OF-SELECTION.
    END-OF-SELECTION.
      IF NOT IT_FINAL[] IS INITIAL.
        CALL SCREEN 100. "Calling the First Screen
      ELSE.
        MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
      ENDIF.
    *       MODULE PBO OUTPUT                                             *
    MODULE PBO OUTPUT.
      DATA: LS_EDIT TYPE LVC_S_STYL, "to find the edit in output
            LT_EDIT TYPE LVC_T_STYL, "to find the edit in output
            V_INDEX LIKE SY-TABIX,
            LS_OUTTAB TYPE T_FINAL.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      IF G_CUSTOM_CONTAINER IS INITIAL.
    **Initializing the grid and calling the fm to Display the O/P
        PERFORM CREATE_AND_INIT_ALV.
      ENDIF.
    ENDMODULE.                    "PBO OUTPUT
    *       MODULE PAI INPUT                                              *
    MODULE PAI INPUT.
      SAVE_OK = OK_CODE.
      CLEAR OK_CODE.
      CASE SAVE_OK.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CANC'.
          LEAVE TO SCREEN 0.
        WHEN OTHERS.
    *     do nothing
      ENDCASE.
    ENDMODULE.                    "pai INPUT
    *&      Form  GET_DEL_ITEM_DATA
    *       Populating the Delivery Item Data
    FORM GET_DEL_ITEM_DATA .
      IF NOT IT_LIKP[] IS INITIAL.
    **-Getting the name of Ship-to-party
        SELECT KUNNR
              NAME1
              INTO TABLE IT_KNA1
              FROM KNA1
              FOR ALL ENTRIES IN IT_LIKP[]
              WHERE KUNNR = IT_LIKP-KUNNR.
    **-Getting Delivery Item Data
        SELECT VBELN
               POSNR
               MATNR
               WERKS
               ARKTX
               VGBEL
               VGPOS
               ZZCONPATH
               INTO TABLE IT_LIPS
               FROM LIPS
               FOR ALL ENTRIES IN IT_LIKP[]
               WHERE VBELN = IT_LIKP-VBELN
                   AND WERKS IN S_WERKS.
      ENDIF.
    ENDFORM.                    " GET_DEL_ITEM_DATA
    *&      Form  get_userid
    *       Getting the  USERID
    FORM GET_USERID .
      IF NOT IT_LIPS[]  IS INITIAL.
    **-Getting the USERID
        SELECT VBELN
               ZZREP_USERID1
               INTO TABLE IT_VBAK
               FROM VBAK
               FOR ALL ENTRIES IN IT_LIPS[]
               WHERE VBELN = IT_LIPS-VGBEL
                  AND ZZREP_USERID1 IN S_USERID.
      ENDIF.
    ENDFORM.                    " get_userid
    *&      Form  populate_final_table
    *       Populating the Final Internaltable
    FORM POPULATE_FINAL_TABLE .
      DATA: L_TABIX LIKE SY-TABIX.
      CLEAR IT_FINAL.
      REFRESH IT_FINAL.
      SORT IT_VEKP_TMP BY ZZPROMDT ZZSONUM ZZOCHOLDRC.
      DATA IT_TMP LIKE IT_VEKP OCCURS 0 WITH HEADER LINE.
      DATA IT_VEKP_TMP1 LIKE IT_VEKP OCCURS 0 WITH HEADER LINE.
      CLEAR IT_VEKP_TMP1[].
      IT_VEKP_TMP1[] = IT_VEKP_TMP[].
      LOOP AT IT_VEKP_TMP.
        MOVE IT_VEKP_TMP TO IT_TMP.
        CLEAR IT_TMP-EXIDV.
        COLLECT IT_TMP.
      ENDLOOP.
      CLEAR IT_VEKP_TMP[].
      IT_VEKP_TMP[] =  IT_TMP[] .
    LOOP AT IT_VEKP_TMP.
        L_TABIX = SY-TABIX.
        READ TABLE IT_VEKP_TMP1 WITH KEY INHALT = IT_VEKP_TMP-INHALT
                                    ZZSONUM = IT_VEKP_TMP-ZZSONUM
                                    ZZPROMDT = IT_VEKP_TMP-ZZPROMDT
                                    ZZOCHOLDRC = IT_VEKP_TMP-ZZOCHOLDRC
                                    VEMNG = IT_VEKP_TMP-VEMNG.
        IF SY-SUBRC = 0.
          IT_VEKP_TMP-EXIDV = IT_VEKP_TMP1-EXIDV.
          MODIFY IT_VEKP_TMP INDEX L_TABIX.
        ENDIF.
      ENDLOOP.
      LOOP AT IT_LIPS.
        MOVE-CORRESPONDING IT_LIPS TO IT_FINAL.
        READ TABLE IT_LIKP WITH KEY VBELN = IT_LIPS-VBELN.
        IF SY-SUBRC = 0.
          IT_FINAL-VSTEL = IT_LIKP-VSTEL.
          IT_FINAL-LFDAT = IT_LIKP-LFDAT.
        ENDIF.
        READ TABLE IT_KNA1 WITH KEY KUNNR = IT_LIKP-KUNNR.
        IF SY-SUBRC = 0.
          IT_FINAL-NAME1 = IT_KNA1-NAME1.
        ENDIF.
        READ TABLE IT_VBAK WITH KEY VBELN = IT_LIPS-VGBEL.
        IF SY-SUBRC = 0.
          IT_FINAL-ZZREP_USERID1 = IT_VBAK-ZZREP_USERID1.
        ENDIF.
        READ TABLE IT_SONUM WITH KEY VGBEL = IT_LIPS-VGBEL
                                     VGPOS = IT_LIPS-VGPOS.
        IF SY-SUBRC = 0.
          LOOP AT IT_VEKP_TMP WHERE ZZSONUM = IT_SONUM-ZZSONUM
                                 AND INHALT = IT_LIPS-VBELN.
            IF NOT IT_VEKP_TMP-ZZPROMDT+0(4) = '0000'.
              IT_FINAL-ZZPROMDT = IT_VEKP_TMP-ZZPROMDT.
            ELSE.
              IT_FINAL-ZZPROMDT = '00000000'.
            ENDIF.
            IT_FINAL-ZZOCHOLDRC = IT_VEKP_TMP-ZZOCHOLDRC.
            IT_FINAL-VEMNG = IT_VEKP_TMP-VEMNG.
            IT_FINAL-ZZSONUM = IT_VEKP_TMP-ZZSONUM.
            IT_FINAL-EXIDV = IT_VEKP_TMP-EXIDV.
            APPEND IT_FINAL.
          ENDLOOP.
          IF SY-SUBRC <> 0.
            IT_FINAL-ZZPROMDT = '00000000'.
            IT_FINAL-ZZOCHOLDRC = ' '.
            IT_FINAL-VEMNG = '  '.
            IT_FINAL-FLAG = 'X'.
            APPEND IT_FINAL.
            CLEAR IT_FINAL.
          ENDIF.
        ENDIF.
      ENDLOOP.
      DELETE IT_FINAL WHERE ZZOCHOLDRC NOT IN S_OCHRC[].
      DELETE IT_FINAL WHERE ZZREP_USERID1 NOT IN S_USERID[].
      DELETE IT_FINAL WHERE WERKS NOT IN S_WERKS[].
      IF NOT IT_ZSDOCHOLD[] IS INITIAL.
        LOOP AT IT_FINAL.
          READ TABLE IT_ZSDOCHOLD WITH KEY ZZOCHOLDRC = IT_FINAL-ZZOCHOLDRC.
          IF SY-SUBRC = 0.
            IT_FINAL-ZZRCDESC = IT_ZSDOCHOLD-ZZRCDESC.
            MODIFY IT_FINAL.
          ENDIF.
        ENDLOOP.
      ENDIF.
      IT_FINAL_TMP[] = IT_FINAL[].
      CLEAR IT_FINAL.
    ENDFORM.                    " populate_final_table
    *&      Form  get_vekp_data
    *       Populating Promise Date and Order Control Hold Reason Code
    FORM GET_VEKP_DATA .
      CLEAR: IT_SONUM,IT_VEKP,IT_VEKP_TMP.
      REFRESH: IT_SONUM,IT_VEKP,IT_VEKP_TMP.
      LOOP AT IT_LIPS.
        MOVE-CORRESPONDING IT_LIPS TO IT_SONUM.
        CONCATENATE IT_LIPS-VGBEL IT_LIPS-VGPOS INTO IT_SONUM-ZZSONUM.
        APPEND IT_SONUM.
        CLEAR IT_SONUM.
      ENDLOOP.
      IF NOT IT_SONUM[] IS INITIAL.
        SELECT EXIDV
               INHALT
               ZZSONUM
               ZZPROMDT
               ZZOCHOLDRC
              INTO TABLE IT_VEKP
              FROM VEKP
              FOR ALL ENTRIES IN IT_SONUM[]
              WHERE ZZSONUM = IT_SONUM-ZZSONUM
                 AND ZZOCHOLDRC IN S_OCHRC.
        SELECT  EXIDV INHALT VEMNG
                ZZSONUM
                INTO TABLE IT_QUANT
                FROM ZVEKPO
                FOR ALL ENTRIES IN IT_SONUM[]
                WHERE ZZSONUM = IT_SONUM-ZZSONUM.
        IF SY-SUBRC = 0.
          LOOP AT IT_VEKP.
            READ TABLE IT_QUANT WITH KEY EXIDV = IT_VEKP-EXIDV
                                         INHALT = IT_VEKP-INHALT
                                         ZZSONUM = IT_VEKP-ZZSONUM.
            IF SY-SUBRC = 0.
              IT_VEKP-VEMNG = IT_QUANT-VEMNG.
              MODIFY IT_VEKP.
            ENDIF.
          ENDLOOP.
          IT_VEKP_TMP[] = IT_VEKP[].
          SELECT ZZOCHOLDRC
                 ZZRCDESC
                 INTO TABLE IT_ZSDOCHOLD
                 FROM ZSD_OC_HOLD
                 FOR ALL ENTRIES IN IT_VEKP[]
                 WHERE ZZOCHOLDRC = IT_VEKP-ZZOCHOLDRC.
        ENDIF.
      ENDIF.
    ENDFORM.                    " get_vekp_data
    *&      Form  SELECT_OCHOLDRC
    *       Selecting the Reason Codes and Descriptions
    FORM SELECT_OCHOLDRC .
      SELECT *
             FROM ZSD_OC_HOLD
             INTO TABLE IT_OCRC.
    ENDFORM.                    " select_OCHOLDRC
    *&      Form  CREATE_AND_INIT_ALV
    *       Creating the ALV grid and initializing
    FORM CREATE_AND_INIT_ALV .
      DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
      CREATE OBJECT G_CUSTOM_CONTAINER
             EXPORTING CONTAINER_NAME = G_CONTAINER1.
      CREATE OBJECT G_GRID
             EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
    * Set a titlebar for the grid control
      GS_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
      GS_LAYOUT-GRID_TITLE = TEXT-003.
      GS_LAYOUT-CWIDTH_OPT = 'X'.
      GS_LAYOUT-NO_ROWMARK = 'X'.
      GS_LAYOUT-ZEBRA = SPACE."'X'.
      GS_LAYOUT-INFO_FNAME  = SPACE.
      GS_LAYOUT-CTAB_FNAME  = SPACE.
      CALL METHOD G_GRID->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
      CREATE OBJECT G_HANDLER.
      SET HANDLER G_HANDLER->HANDLE_USER_COMMAND FOR G_GRID.
      SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
      SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
      SET HANDLER G_HANDLER->HANDLE_DATA_CHANGED FOR G_GRID.
      SET HANDLER G_HANDLER->HANDLE_TOOLBAR FOR G_GRID.
    * setting focus for created grid control
      CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
        EXPORTING
          CONTROL = G_GRID.
    * Build fieldcat and set editable for date and reason code
    * edit enabled. Assign a handle for the dropdown listbox.
      PERFORM BUILD_FIELDCAT.
    * Optionally restrict generic functions to 'change only'.
    *   (The user shall not be able to add new lines).
      PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
      PERFORM DISABLE_EDIT_FIELDS.
    **Vaiant to save the layout
      LS_VARI-REPORT      = SY-REPID.
      LS_VARI-HANDLE      = SPACE.
      LS_VARI-LOG_GROUP   = SPACE.
      LS_VARI-USERNAME    = SPACE.
      LS_VARI-VARIANT     = SPACE.
      LS_VARI-TEXT        = SPACE.
      LS_VARI-DEPENDVARS  = SPACE.
    * Define a drop down table.
      PERFORM SET_DRDN_TABLE.
    **Calling the Method for ALV output
      CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
          IS_VARIANT           = LS_VARI
          IS_LAYOUT            = GS_LAYOUT
          I_SAVE               = 'A'
        CHANGING
          IT_FIELDCATALOG      = IT_FIELDCAT
          IT_OUTTAB            = IT_FINAL[].
    * Set editable cells to ready for input initially
      CALL METHOD G_GRID->SET_READY_FOR_INPUT
        EXPORTING
          I_READY_FOR_INPUT = 1.
      CALL METHOD G_GRID->SET_TOOLBAR_INTERACTIVE.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    *&      Form  EXCLUDE_TB_FUNCTIONS
    *       Excluding the ALV functions
    FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
    * Only allow to change data not to create new entries (exclude
    * generic functions).
      DATA LS_EXCLUDE TYPE UI_FUNC.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
    ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
    *&      Form  build_fieldcat
    *       Fieldcatalog
    FORM BUILD_FIELDCAT .
      DATA:L_POS TYPE I VALUE 1.
      CLEAR: L_POS.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Shpt'(012).
      X_FIELDCAT-FIELDNAME = 'VSTEL'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '4'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Con Path'(013).
      X_FIELDCAT-FIELDNAME = 'ZZCONPATH'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '8'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Plant'(014).
      X_FIELDCAT-FIELDNAME = 'WERKS'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '5'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Del Date'(015).
      X_FIELDCAT-FIELDNAME = 'LFDAT'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '10'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-COLTEXT = 'Prom Date'(016).
    *  X_FIELDCAT-SCRTEXT_M = 'Prom Date'(016).
      X_FIELDCAT-FIELDNAME = 'ZZPROMDT'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '10'.
      X_FIELDCAT-EMPHASIZE = ' '.
      X_FIELDCAT-EDIT = 'X'.
    *  X_FIELDCAT-HOTSPOT = 'X'.
      X_FIELDCAT-DATATYPE = 'DATS'.
      X_FIELDCAT-INTTYPE = 'D'.
      X_FIELDCAT-REF_TABLE = 'VEKP'.
      X_FIELDCAT-REF_FIELD = 'ZZPROMDT'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR  X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Ship-To-Name'(017).
      X_FIELDCAT-FIELDNAME = 'NAME1'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '40'.
      X_FIELDCAT-EMPHASIZE = ' '.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'SalesOrder#'(018).
      X_FIELDCAT-FIELDNAME = 'VGBEL'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '10'.
      X_FIELDCAT-EMPHASIZE = ' '.
      X_FIELDCAT-HOTSPOT = 'X'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Item'(019).
      X_FIELDCAT-FIELDNAME = 'VGPOS'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-EMPHASIZE = ' '.
      X_FIELDCAT-OUTPUTLEN = '5'.
      X_FIELDCAT-HOTSPOT = ' '.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Material'(020).
      X_FIELDCAT-FIELDNAME = 'MATNR'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '18'.
      X_FIELDCAT-EMPHASIZE = ' '.
      X_FIELDCAT-HOTSPOT = ' '.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Materal Desc'(021).
      X_FIELDCAT-FIELDNAME = 'ARKTX'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '40'.
      X_FIELDCAT-EMPHASIZE = ' '.
      X_FIELDCAT-HOTSPOT = ' '.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'D.O.Item Qty'(022).
      X_FIELDCAT-FIELDNAME = 'VEMNG'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '13'.
      X_FIELDCAT-EMPHASIZE = ' '.
      X_FIELDCAT-HOTSPOT = ' '.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'RC'(023).
      X_FIELDCAT-FIELDNAME = 'ZZOCHOLDRC'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '3'.
      X_FIELDCAT-EDIT = 'X'.
      X_FIELDCAT-DRDN_HNDL = '1'.
      X_FIELDCAT-DRDN_ALIAS = 'X'.
    *  X_FIELDCAT-DRDN_FIELD = 'DROP_DOWN_HANDLE'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
    *  X_FIELDCAT-SCRTEXT_M = 'OC HOLD RC Desc'.
    *  X_FIELDCAT-FIELDNAME = 'ZZRCDESC'.
    *  X_FIELDCAT-TABNAME = 'IT_FINAL'.
    *  X_FIELDCAT-COL_POS    = L_POS.
    *  X_FIELDCAT-OUTPUTLEN = '20'.
    *  X_FIELDCAT-EDIT = 'X'.
    *  X_FIELDCAT-HOTSPOT = ' '.
    *  APPEND X_FIELDCAT TO IT_FIELDCAT.
    *  CLEAR X_FIELDCAT.
    *  L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
      X_FIELDCAT-FIELDNAME = 'VBELN'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '10'.
      X_FIELDCAT-EMPHASIZE = ' '.
      X_FIELDCAT-HOTSPOT = 'X'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Item'(025).
      X_FIELDCAT-FIELDNAME = 'POSNR'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '5'.
      X_FIELDCAT-EMPHASIZE = ' '.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Rep User Id'(026).
      X_FIELDCAT-FIELDNAME = 'ZZREP_USERID1'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '11'.
      X_FIELDCAT-EMPHASIZE = ' '.
      X_FIELDCAT-HOTSPOT = ' '.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
    ENDFORM.                    " build_fieldcat
    *&      Form  set_drdn_table
    *       Setting the Drop down for the Reason code
    FORM SET_DRDN_TABLE.
      DATA: X_OCRC LIKE LINE OF IT_OCRC.
      DATA:LT_DRAL TYPE LVC_T_DRAL,
            LS_DRAL TYPE LVC_S_DRAL,
            L_DRDN(25) TYPE C.
      LOOP AT IT_OCRC INTO X_OCRC.
      CONCATENATE X_OCRC-ZZOCHOLDRC ' ' ' ' ' ' X_OCRC-ZZRCDESC INTO L_DRDN
    SEPARATED BY SPACE.
    * First listbox (handle '1').
        LS_DRAL-HANDLE = '1'.
        LS_DRAL-VALUE =  L_DRDN.
        LS_DRAL-INT_VALUE = X_OCRC-ZZOCHOLDRC.
        APPEND LS_DRAL TO LT_DRAL.
      ENDLOOP.
    **Setting the Drop down table for Reason Code
      CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
        EXPORTING
          IT_DROP_DOWN_ALIAS = LT_DRAL.
    ENDFORM.                               " set_drdn_table
    *&      Form  handle_hotspot_click
    *      Handling the Hotspot
    FORM HANDLE_HOTSPOT_CLICK USING I_ROW_ID TYPE LVC_S_ROW
                                    I_COLUMN_ID TYPE LVC_S_COL
                                    IS_ROW_NO TYPE LVC_S_ROID.
      READ TABLE IT_FINAL INDEX I_ROW_ID  .
      IF SY-SUBRC = 0.
        IF I_COLUMN_ID-FIELDNAME = 'VGBEL'.
          PERFORM FORM_REFRESH.
          SET PARAMETER ID 'AUN' FIELD IT_FINAL-VGBEL.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
        ENDIF.
    **if user clicks on Delivery
        IF I_COLUMN_ID-FIELDNAME = 'VBELN'.
          PERFORM FORM_REFRESH.
          SET PARAMETER ID 'VL' FIELD IT_FINAL-VBELN.
          CALL TRANSACTION 'VL02N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDIF.
    ENDFORM .                    "handle_hotspot_click
    *&      Form  FORM_REFRESH for first list
    FORM FORM_REFRESH .
      CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY
        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.
    ENDFORM .                    "FORM_REFRESH
    *&      Form  event_ucomm
    *       Handling User Commands
    FORM EVENT_UCOMM  USING    E_UCOMM TYPE SY-UCOMM.
      SORT IT_FINAL.
      SORT IT_FINAL_TMP.
      CASE E_UCOMM.
        WHEN 'BACK'.
          CALL METHOD G_GRID->CHECK_CHANGED_DATA
            IMPORTING
              E_VALID = L_VALID.
          CALL METHOD CL_GUI_CFW=>FLUSH.
          PERFORM BACK_OPERATION.
        WHEN 'SAVE'.
          CALL METHOD G_GRID->CHECK_CHANGED_DATA
            IMPORTING
              E_VALID = L_VALID.
          CALL METHOD CL_GUI_CFW=>FLUSH.
          PERFORM SAVE_OPERATION.
      ENDCASE.
    ENDFORM.                    " event_ucomm
    *&      Form  back_operation
    *       When User do Back operation
    FORM BACK_OPERATION .
    **When User Press back Button
    *    WHEN 'BACK'.
      DATA: L_ANS TYPE C,
            L_TABIX TYPE SY-TABIX,
            L_SONUM TYPE VEKP-ZZSONUM,
            X_OCRC LIKE LINE OF IT_OCRC.
    **Checking for the Data Change
      IF IT_FINAL_TMP[] <> IT_FINAL[].
        PERFORM CONFIRM_BEFORE_LEAVE CHANGING L_ANS.
        IF L_ANS = '1' .
          LOOP AT IT_FINAL.
            L_TABIX = SY-TABIX.
            READ TABLE IT_FINAL_TMP INDEX L_TABIX.
            IF SY-SUBRC  = 0.
              IF IT_FINAL <> IT_FINAL_TMP.
    *-Validate Date Field.
                PERFORM VALIDATE_AND_CONVERT_DATE.
    **Modifying the VEKP table based on changes
                IF NOT IT_FINAL_TMP-EXIDV IS INITIAL.
                  UPDATE VEKP SET ZZOCHOLDRC = IT_FINAL-ZZOCHOLDRC
                                  ZZPROMDT =  IT_FINAL-ZZPROMDT
                                WHERE EXIDV   = IT_FINAL_TMP-EXIDV
                             AND INHALT = IT_FINAL-VBELN.
                  IF SY-SUBRC = 0.
                    COMMIT WORK AND WAIT.
                  ENDIF.
                ELSE.
                  UPDATE VEKP SET ZZOCHOLDRC = IT_FINAL-ZZOCHOLDRC
                                    ZZPROMDT =  IT_FINAL-ZZPROMDT
                                  WHERE INHALT = IT_FINAL-VBELN
                               AND ZZSONUM = IT_FINAL_TMP-ZZSONUM
                               AND ZZPROMDT = IT_FINAL_TMP-ZZPROMDT
                               AND ZZOCHOLDRC = IT_FINAL_TMP-ZZOCHOLDRC.
                  IF SY-SUBRC = 0.
                    COMMIT WORK AND WAIT.
                  ENDIF.
                ENDIF.
              ENDIF.
            ENDIF.
          ENDLOOP.
          LEAVE TO SCREEN 0.
        ELSEIF L_ANS = '2'.
          LEAVE TO SCREEN 0.
        ENDIF.
      ELSE.
        LEAVE TO SCREEN 0.
      ENDIF.
    ENDFORM.                    " back_operation
    *&      Form  CONFIRM_BEFORE_LEAVE
    *       Popup for Confirm
    FORM CONFIRM_BEFORE_LEAVE  CHANGING P_ANS TYPE C.
      CALL FUNCTION 'POPUP_TO_CONFIRM'
             EXPORTING
                 TITLEBAR              = 'Confirm'(007)
                 TEXT_QUESTION = 'Do you wish to save your data first?'(006)
                 TEXT_BUTTON_1         = 'Yes'(008)
                 ICON_BUTTON_1         = 'ICON_OKAY'
                 TEXT_BUTTON_2         = 'No'(010)
                 ICON_BUTTON_2         = 'ICON_CANCEL'
                 DEFAULT_BUTTON        = '1'
                 DISPLAY_CANCEL_BUTTON = 'X'
                 START_COLUMN          = 25
                 START_ROW             = 6
            IMPORTING
                 ANSWER                = P_ANS
            EXCEPTIONS
                 TEXT_NOT_FOUND        = 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.                    " CONFIRM_BEFORE_LEAVE
    *&      Form  VALIDATE_AND_CONVERT_DATE
    *       Validating and Converting the date
    FORM VALIDATE_AND_CONVERT_DATE .
      DATA : L_DATE LIKE SY-DATUM.
      CALL FUNCTION 'CONVERT_DATE_INPUT'
        EXPORTING
          INPUT                     = IT_FINAL-ZZPROMDT
        IMPORTING
          OUTPUT                    = L_DATE
        EXCEPTIONS
          PLAUSIBILITY_CHECK_FAILED = 1
          WRONG_FORMAT_IN_INPUT     = 2
          OTHERS                    = 3.
      IF SY-SUBRC = 0.
        WRITE L_DATE TO IT_FINAL-ZZPROMDT.
        MODIFY IT_FINAL.
      ENDIF.
    ENDFORM.                    " VALIDATE_AND_CONVERT_DATE
    *&      Module  STATUS_0200  OUTPUT
    *      PBO of Second List
    MODULE STATUS_0200 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      IF G_CUSTOM_CONTAINER1 IS INITIAL.
    **Initializing the second Grid
        PERFORM CREATE_AND_INIT_ALV1.
      ENDIF.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
    *      PAI of Second list
    MODULE USER_COMMAND_0200 INPUT.
      DATA: L_ANS.
      SAVE_OK = OK_CODE.
      CLEAR OK_CODE.
      CASE SAVE_OK.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CANC'.
          LEAVE TO SCREEN 0.
        WHEN OTHERS.
    *     do nothing
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    *&      Form  CREATE_AND_INIT_ALV1
    *       Creating the Grid for Second List
    FORM CREATE_AND_INIT_ALV1 .
      DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
      CREATE OBJECT G_CUSTOM_CONTAINER1
             EXPORTING CONTAINER_NAME = G_CONTAINER2.
      CREATE OBJECT G_GRID1
             EXPORTING I_PARENT = G_CUSTOM_CONTAINER1.
      CALL METHOD G_GRID1->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
      CREATE OBJECT G_HANDLER1.
      SET HANDLER G_HANDLER1->HANDLE_USER_COMMAND FOR G_GRID1.
      SET HANDLER G_HANDLER1->HANDLE_TOOLBAR FOR G_GRID1.
      GS_LAYOUT1-GRID_TITLE = TEXT-003.
      GS_LAYOUT1-CWIDTH_OPT = 'X'.
      GS_LAYOUT1-NO_ROWMARK = 'X'.
      GS_LAYOUT1-ZEBRA = SPACE."'X'.
      GS_LAYOUT1-INFO_FNAME  = SPACE.
      GS_LAYOUT1-CTAB_FNAME  = SPACE.
    **Vaiant to save the layout
      LS_VARI-REPORT      = SY-REPID.
      LS_VARI-HANDLE      = SPACE.
      LS_VARI-LOG_GROUP   = SPACE.
      LS_VARI-USERNAME    = SPACE.
      LS_VARI-VARIANT     = SPACE.
      LS_VARI-TEXT        = SPACE.
      LS_VARI-DEPENDVARS  = SPACE.
    * setting focus for created grid control
      CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
        EXPORTING
          CONTROL = G_GRID1.
      PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
    * Define a drop down table.
      PERFORM SET_DRDN_TABLE1.
      PERFORM FORM_REFRESH.
      CALL METHOD G_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
          IS_VARIANT           = LS_VARI
          I_SAVE               = 'A'
          IS_LAYOUT            = GS_LAYOUT1
        CHANGING
          IT_FIELDCATALOG      = IT_FIELDCAT1
          IT_OUTTAB            = IT_VEKP1[].
    ** Set editable cells to ready for input initially
      CALL METHOD G_GRID1->SET_READY_FOR_INPUT
        EXPORTING
          I_READY_FOR_INPUT = 1.
      CALL METHOD G_GRID1->SET_TOOLBAR_INTERACTIVE.
    ENDFORM.                               "CREATE_AND_INIT_ALV1
    *&      Form  GET_HU_DATA
    * Get Handling Units Data
    FORM GET_HU_DATA USING X_FINAL TYPE T_FINAL.
      CLEAR IT_VEKP1.
      REFRESH IT_VEKP1.
      READ TABLE IT_SONUM WITH KEY VGBEL = X_FINAL-VGBEL
                                   VGPOS = X_FINAL-VGPOS.
      IF SY-SUBRC = 0.
        LOOP AT IT_VEKP WHERE  INHALT = X_FINAL-VBELN
                         AND     ZZSONUM = IT_SONUM-ZZSONUM
                         AND  ZZPROMDT  = X_FINAL-ZZPROMDT
                         AND  ZZOCHOLDRC = X_FINAL-ZZOCHOLDRC.
          IT_VEKP1-EXIDV  = IT_VEKP-EXIDV.
          IT_VEKP1-ZZSONUM = IT_VEKP-ZZSONUM.
          IF NOT IT_VEKP-ZZPROMDT+0(4) = '0000'.
            IT_VEKP1-ZZPROMDT = IT_VEKP-ZZPROMDT.
          ELSE.
            IT_VEKP1-ZZPROMDT = '00000000'.
          ENDIF.
          IT_VEKP1-ZZOCHOLDRC = IT_VEKP-ZZOCHOLDRC.
          APPEND IT_VEKP1.
        ENDLOOP.
      ENDIF.
      IT_VEKP1_TMP[] = IT_VEKP1[].
    ENDFORM.                    " GET_HU_DATA
    *&      Form  POPULATE_FIELDCAT2
    *       Populating the Field Catalog for Second list
    FORM POPULATE_FIELDCAT2 .
      CLEAR: IT_FIELDCAT1,X_FIELDCAT1.
      REFRESH IT_FIELDCAT1.
      DATA:L_POS TYPE I VALUE 1.
      CLEAR: L_POS.
      L_POS = L_POS + 1.
      X_FIELDCAT1-SCRTEXT_M = 'External Handling Unit Identification'(027).
      X_FIELDCAT1-FIELDNAME = 'EXIDV'.
      X_FIELDCAT1-TABNAME = 'IT_VEKP1'.
      X_FIELDCAT1-COL_POS    = L_POS.
      X_FIELDCAT1-EDIT = ' '.
      APPEND X_FIELDCAT1 TO IT_FIELDCAT1.
      CLEAR X_FIELDCAT1.
      L_POS = L_POS + 1.
    *  X_FIELDCAT1-SCRTEXT_M = 'Prom Date'(016).
      X_FIELDCAT1-COLTEXT = 'Promise Date'(033).
      X_FIELDCAT1-FIELDNAME = 'ZZPROMDT'.
      X_FIELDCAT1-TABNAME = 'IT_VEKP1'.
      X_FIELDCAT1-COL_POS    = L_POS.
      X_FIELDCAT1-OUTPUTLEN = '12'.
      X_FIELDCAT1-EMPHASIZE = ' '.
      X_FIELDCAT1-EDIT = 'X'.
      X_FIELDCAT1-DATATYPE = 'DATS'.
      X_FIELDCAT1-INTTYPE = 'D'.
      X_FIELDCAT1-REF_TABLE = 'VEKP'.
      X_FIELDCAT1-REF_FIELD = 'ZZPROMDT'.
      APPEND X_FIELDCAT1 TO IT_FIELDCAT1.
      CLEAR  X_FIELDCAT1.
      L_POS = L_POS + 1.
      X_FIELDCAT1-SCRTEXT_M = 'Order Control Hold Reason Code'(029).
      X_FIELDCAT1-FIELDNAME = 'ZZOCHOLDRC'.
      X_FIELDCAT1-TABNAME = 'IT_VEKP1'.
      X_FIELDCAT1-COL_POS    = L_POS.
      X_FIELDCAT1-DRDN_HNDL = '1'.
      X_FIELDCAT1-DRDN_ALIAS = 'X'.
      X_FIELDCAT1-EDIT = 'X'.
      APPEND X_FIELDCAT1 TO IT_FIELDCAT1.
      CLEAR X_FIELDCAT1.
    ENDFORM.                    " POPULATE_FIELDCAT2
    *&      Form  set_drdn_table
    *      Drop Down for second report
    FORM SET_DRDN_TABLE1.
      DATA:X_OCRC LIKE LINE OF IT_OCRC.
      DATA:LT_DRAL TYPE LVC_T_DRAL,
            LS_DRAL TYPE LVC_S_DRAL,
            L_DRDN(25) TYPE C.
      LOOP AT IT_OCRC INTO X_OCRC.
        CONCATENATE X_OCRC-ZZOCHOLDRC '  ' ' ' '  '  X_OCRC-ZZRCDESC INTO
      L_DRDN
      SEPARATED BY SPACE.
    * First listbox (handle '1').
        LS_DRAL-HANDLE = '1'.
        LS_DRAL-VALUE =  L_DRDN.
        LS_DRAL-INT_VALUE = X_OCRC-ZZOCHOLDRC.
        APPEND LS_DRAL TO LT_DRAL.
      ENDLOOP.
      CALL METHOD G_GRID1->SET_DROP_DOWN_TABLE
        EXPORTING
          IT_DROP_DOWN_ALIAS = LT_DRAL.
    ENDFORM.                               " set_drdn_table
    *&      Form  save_operation
    *       Saving the changes
    FORM SAVE_OPERATION .
      DATA: L_TABIX LIKE SY-TABIX.
    **CHECKING FOR THE DATA CHANGE
      IF IT_FINAL_TMP[] <> IT_FINAL[].
        LOOP AT IT_FINAL.
          L_TABIX = SY-TABIX.
          READ TABLE IT_FINAL_TMP INDEX L_TABIX.
          IF SY-SUBRC  = 0.
            IF IT_FINAL <> IT_FINAL_TMP.
    *-Validate Date Field.
              PERFORM VALIDATE_AND_CONVERT_DATE.
    **Modifying the VEKP table based on changes
              IF NOT IT_FINAL_TMP-EXIDV IS INITIAL.
                UPDATE VEKP SET ZZOCHOLDRC = IT_FINAL-ZZOCHOLDRC
                                ZZPROMDT =  IT_FINAL-ZZPROMDT
                              WHERE EXIDV   = IT_FINAL_TMP-EXIDV
                           AND INHALT = IT_FINAL-VBELN.
                IF SY-SUBRC = 0.
                  V_DATA_CHANGE = ' '.
                  COMMIT WORK AND WAIT.
                ENDIF.
              ELSE.
                UPDATE VEKP SET ZZOCHOLDRC = IT_FINAL-ZZOCHOLDRC
                                    ZZPROMDT =  IT_FINAL-ZZPROMDT
                                  WHERE INHALT = IT_FINAL-VBELN
                               AND ZZSONUM = IT_FINAL_TMP-ZZSONUM
                               AND ZZPROMDT = IT_FINAL_TMP-ZZPROMDT
                               AND ZZOCHOLDRC = IT_FINAL_TMP-ZZOCHOLDRC.
                IF SY-SUBRC = 0.
                  V_DATA_CHANGE = ' '.
                  COMMIT WORK AND WAIT.
                ENDIF.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDLOOP.
        PERFORM GET_VEKP_DATA .
        PERFORM POPULATE_FINAL_TABLE.
        PERFORM DISABLE_EDIT_FIELDS.
        PERFORM FORM_REFRESH.
        MESSAGE S002 WITH 'Data Saved'(011).
      ENDIF.
    ENDFORM.                    " save_operation
    *&      Form  BACK_SECOND_LIST
    *       When User Press Back in Second list
    FORM BACK_SECOND_LIST .
      DATA:X_OCRC LIKE LINE OF IT_OCRC.
    **Checking for the Change in the data
      IF IT_VEKP1_TMP[] <> IT_VEKP1[].
        PERFORM CONFIRM_BEFORE_LEAVE CHANGING L_ANS.
        IF L_ANS = '1'.
          LOOP AT IT_VEKP1.
            READ TABLE IT_VEKP1_TMP WITH KEY EXIDV = IT_VEKP1-EXIDV.
            IF SY-SUBRC = 0.
              IF IT_VEKP1_TMP <> IT_VEKP1.
                UPDATE VEKP SET ZZPROMDT = IT_VEKP1-ZZPROMDT
                                ZZOCHOLDRC = IT_VEKP1-ZZOCHOLDRC
                              WHERE EXIDV = IT_VEKP1-EXIDV.
                IF SY-SUBRC = 0.
                  COMMIT WORK.
                ENDIF.
              ENDIF.
            ENDIF.
          ENDLOOP.
          PERFORM GET_VEKP_DATA .
          CLEAR IT_VEKP1_TMP.
          REFRESH IT_VEKP1_TMP.
          IT_VEKP1_TMP[] = IT_VEKP1[].
          PERFORM POPULATE_FINAL_TABLE.
          PERFORM DISABLE_EDIT_FIELDS.
          PERFORM FORM_REFRESH.
          MESSAGE S002 WITH 'Data Saved'(011).
          PERFORM CLEAR_GRID_CONTAINER.
        ELSEIF L_ANS = '2'.
          PERFORM CLEAR_GRID_CONTAINER.
        ENDIF.
      ELSE.
        PERFORM CLEAR_GRID_CONTAINER.
      ENDIF.
    ENDFORM.                    " BACK_SECOND_LIST
    *&      Form  clear_grid_container
    *       Clearing the Grid
    FORM CLEAR_GRID_CONTAINER .
      CALL METHOD G_GRID1->FREE.
      CALL METHOD G_CUSTOM_CONTAINER1->FREE.
      CALL METHOD CL_GUI_CFW=>FLUSH.
      CLEAR G_CUSTOM_CONTAINER1.
      CLEAR G_GRID1.
      CLEAR G_HANDLER1.
      LEAVE TO SCREEN 0.
    ENDFORM.                    " clear_grid_container
    *&      Form  disable_edit_fields
    *       Disable edit fields
    FORM DISABLE_EDIT_FIELDS .
    **Changing the Edit option for the records which they don't have
    **Entries in HU level
      LOOP AT IT_FINAL INTO LS_OUTTAB WHERE FLAG = 'X'.
        V_INDEX = SY-TABIX.
        LS_EDIT-FIELDNAME = 'ZZOCHOLDRC'.
        LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
        LS_EDIT-STYLE2 = SPACE.
        LS_EDIT-STYLE3 = SPACE.
        LS_EDIT-STYLE4 = SPACE.
        LS_EDIT-MAXLEN = 8.
        INSERT LS_EDIT INTO TABLE LT_EDIT.
        LS_EDIT-FIELDNAME = 'ZZRCDESC'.
        LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
        LS_EDIT-STYLE2 = SPACE.
        LS_EDIT-STYLE3 = SPACE.
        LS_EDIT-STYLE4 = SPACE.
        LS_EDIT-MAXLEN = 8.
        INSERT LS_EDIT INTO TABLE LT_EDIT.
        LS_EDIT-FIELDNAME = 'ZZPROMDT'.
        LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
        LS_EDIT-STYLE2 = SPACE.
        LS_EDIT-STYLE3 = SPACE.
        LS_EDIT-STYLE4 = SPACE.
        LS_EDIT-MAXLEN = 8.
        INSERT LS_EDIT INTO TABLE LT_EDIT.
        INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
        MODIFY IT_FINAL INDEX V_INDEX FROM LS_OUTTAB  TRANSPORTING
                                          HANDLE_STYLE DROP_DOWN_HANDLE.
        MODIFY IT_FINAL_TMP INDEX V_INDEX FROM LS_OUTTAB  TRANSPORTING
                                         HANDLE_STYLE DROP_DOWN_HANDLE.
      ENDLOOP.
    ENDFORM.                    " disable_edit_fields
    *&      Form  event_ucomm
    *       Handling User Commands
    FORM EVENT_UCOMM1  USING    E_UCOMM TYPE SY-UCOMM.
      SORT IT_VEKP1.
      SORT IT_VEKP1_TMP.
      CASE E_UCOMM.
          WHEN'BACK'.
    **Checking for the change in the data of the output
          CALL METHOD G_GRID1->CHECK_CHANGED_DATA
            IMPORTING
              E_VALID = L_VALID1.
          CALL METHOD CL_GUI_CFW=>FLUSH.
          PERFORM BACK_SECOND_LIST.
        WHEN 'SAVE'.
          CALL METHOD G_GRID1->CHECK_CHANGED_DATA
            IMPORTING
              E_VALID = L_VALID1.
          CALL METHOD CL_GUI_CFW=>FLUSH.
    **Checking for the Change in the data
          IF IT_VEKP1_TMP[] <> IT_VEKP1[].
            LOOP AT IT_VEKP1.
              READ TABLE IT_VEKP1_TMP WITH KEY EXIDV = IT_VEKP1-EXIDV.
              IF SY-SUBRC = 0.
                IF IT_VEKP1_TMP <> IT_VEKP1.
                  UPDATE VEKP SET ZZPROMDT = IT_VEKP1-ZZPROMDT
                                  ZZOCHOLDRC = IT_VEKP1-ZZOCHOLDRC
                                WHERE EXIDV = IT_VEKP1-EXIDV.
                  IF SY-SUBRC = 0.
                    COMMIT WORK.
                  ENDIF.
                ENDIF.
              ENDIF.
            ENDLOOP.
            PERFORM GET_VEKP_DATA .
            CLEAR IT_VEKP1_TMP.
            REFRESH IT_VEKP1_TMP.
            IT_VEKP1_TMP[] = IT_VEKP1[].
            PERFORM POPULATE_FINAL_TABLE.
            PERFORM DISABLE_EDIT_FIELDS.
            PERFORM FORM_REFRESH.
            MESSAGE S002 WITH 'Data Saved'(011).
          ENDIF.
        WHEN OTHERS.
    *     do nothing
      ENDCASE.
    ENDFORM.                    " event_ucomm1
    check this code , in that i have used and implemented..using classes

  • How to get the value from the checkbox

    Hi All,
    Good Evening,
    i want to get the value from the check box.
    for this i wrote like this
    OAMessageCheckBoxBean cbb=(OAMessageCheckBoxBean)webBEan.findChildRecurssive("item240")
    String val=cbb.getvalue(pageContext).toString();
    val getting the value only when checkbox is checked.
    suppose check box is not checked that time i got NULL POINTER exceptionn.
    so
    i tried the following way alsoo
    string val=pageContext.getParameter("item240");
    here val return 'on' only when checkbox is checked.
    otherwise NULL value returnss.
    but i want to get the value is 'Y' when i am checked the checkbox
    otherwise returns NULL valuee.
    already i set the checkbox properties alsoo
    Checked :Y
    unchecked:N
    pls tell me

    Hi,
    use
    try
    OAMessageCheckBoxBean cbb=(OAMessageCheckBoxBean)webBEan.findChildRecurssive("item240")
    String test = cbb.getvalue(pageContext).toString();
    catch(Exception e)
    String test = "";
    this way you can handle null pointer exception.
    Thanks,
    Gaurav

  • Getting the Values from a Tiled View

    Hi,
    I have a TiledView and I have checkbox in the tiled view. I am trying
    to get the values of the checked boxes.
    I have coded like this.
    Object[] links = getRSystemLinks().getCbSystemUrl().getValues();
    if I see the links.length i get only one. In html If I see the code
    it appends the TileIndex in brackets. If I replace the TileIndex with
    0 in all the fields in endCbSystemUrl method I get the correct values.
    In the TiledView beginDisplay() method my code is like this.
    if (getPrimaryModel() == null) throw new ModelControlException
    ("Primary model is null");
    super.beginDisplay();
    resetTileIndex();
    pgCustomizeLinksViewBean parentBean = (pgCustomizeLinksViewBean)
    getParent();
    ((DatasetModel) getDefaultModel()).setSize
    (parentBean.SystemChoicesValue.size());
    Any Suggestions on this.
    Thanks
    Namburi

    Namburi--
    Remember, the getValues() method does not return the values from a column in
    a TiledView. It is strictly for use by fields that can have multiple
    values, like multi-select list boxes.
    DO NOT remove the indexing feature from the field names, especially in the
    case of checkboxes, because checkboxes aren't submitted back to the server
    unless they are checked. By overriding the automatic checkbox tracking
    feature JATO provides, you won't be able to tell which checkboxes were
    actually checked by row--you'll simply get back a list the same size as the
    number of checkboxes that were checked, without any placeholders for the
    ones that weren't checked.
    Instead, on submit, you simply need to move through the tiledView and check
    the value of checkbox on each row:
    tiledView.beforeFirst();
    while (tiledView.next())
    if (getDisplayFieldBooleanValue("myCheckBox"))
    You can use the same construct to build up an array or list:
    List checkedList=new LinkedList();
    tiledView.beforeFirst();
    while (tiledView.next())
    if (getDisplayFieldBooleanValue("myCheckBox"))
    checkedList.add(new Boolean(true))
    else
    checkedList.add(new Boolean(false))
    Todd
    Todd Fast
    Senior Engineer
    Sun Microsystems, Inc.
    todd.fast@s...
    ----- Original Message -----
    From: <vnamboori@y...>
    Sent: Wednesday, October 17, 2001 3:49 PM
    Subject: [iPlanet-JATO] Getting the Values from a Tiled View
    Hi,
    I have a TiledView and I have checkbox in the tiled view. I am trying
    to get the values of the checked boxes.
    I have coded like this.
    Object[] links = getRSystemLinks().getCbSystemUrl().getValues();
    if I see the links.length i get only one. In html If I see the code
    it appends the TileIndex in brackets. If I replace the TileIndex with
    0 in all the fields in endCbSystemUrl method I get the correct values.
    In the TiledView beginDisplay() method my code is like this.
    if (getPrimaryModel() == null) throw new ModelControlException
    ("Primary model is null");
    super.beginDisplay();
    resetTileIndex();
    pgCustomizeLinksViewBean parentBean = (pgCustomizeLinksViewBean)
    getParent();
    ((DatasetModel) getDefaultModel()).setSize
    (parentBean.SystemChoicesValue.size());
    Any Suggestions on this.
    Thanks
    Namburi
    [email protected]

  • NullPointerException - Cannot get the value from variable f_cashGiven

    In SubCheckout.java (a POS), what I want is when Payment button (f_cashPayment) is pressed, the action "Cash" is performed, get the value from Cash Given (f_cashGiven), do the subtraction and post the value as Cash Return (f_cashReturn). The code is filled in actionPerformed. But I cannot get the value by using f_cashGiven.getValue() from VNumber class. It returns NULL. This should be quite straight forward, but I do not know what is wrong. Please help!
    Enclosed please find the source code of SubCheckout.java and VNumber.java
    This is the code of SubCheckout.java :
    * The contents of this file are subject to the   Compiere License  Version 1.1
    * ("License"); You may not use this file except in compliance with the License
    * You may obtain a copy of the License at http://www.compiere.org/license.html
    * Software distributed under the License is distributed on an  "AS IS"  basis,
    * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
    * the specific language governing rights and limitations under the License.
    * The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial
    * Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke
    * are Copyright (C) 1999-2005 Jorg Janke.
    * All parts are Copyright (C) 1999-2005 ComPiere, Inc.  All Rights Reserved.
    * Contributor(s): ______________________________________.
    package org.compiere.pos;
    import java.awt.*;
    import java.awt.event.*;
    import java.math.BigDecimal;
    import javax.swing.border.*;
    import org.compiere.grid.ed.*;
    import org.compiere.swing.*;
    import org.compiere.util.*;
    *     POS Checkout Sub Panel
    *  @author Jorg Janke
    *  @version $Id: SubCheckout.java,v 1.3 2005/03/11 20:28:22 jjanke Exp $
    public class SubCheckout extends PosSubPanel implements ActionListener
          *      Constructor
          *     @param posPanel POS Panel
         public SubCheckout (PosPanel posPanel)
              super (posPanel);
         }     //     PosSubCheckout
         private CButton f_register = null;
         private CButton f_summary = null;
         private CButton f_process = null;
         private CButton f_print = null;
         private CLabel f_lcreditCardNumber = null;
         private CTextField f_creditCardNumber = null;
         private CLabel f_lcreditCardExp = null;
         private CTextField f_creditCardExp = null;
         private CLabel f_lcreditCardVV = null;
         private CTextField f_creditCardVV = null;
         private CButton f_cashPayment = null;
         private CLabel f_lcashGiven = null;
         private VNumber f_cashGiven = null;
         private CLabel f_lcashReturn = null;
         private VNumber f_cashReturn = null;
         private CButton f_creditPayment = null;
         /**     Logger               */
         private static CLogger log = CLogger.getCLogger(SubCheckout.class);
          *      Initialize
         public void init()
              //     Title
              TitledBorder border = new TitledBorder(Msg.getMsg(Env.getCtx(), "Checkout"));
              setBorder(border);
              //     Content
              setLayout(new GridBagLayout());
              GridBagConstraints gbc = new GridBagConstraints();
              gbc.insets = INSETS2;
              //     --     0
              gbc.gridx = 0;
              f_register = createButtonAction("Register", null);
              gbc.gridy = 0;
              add (f_register, gbc);
              f_summary = createButtonAction("Summary", null);
              gbc.gridy = 1;
              add (f_summary, gbc);
              f_process = createButtonAction("Process", null);
              gbc.gridy = 2;
              add (f_process, gbc);
              f_print = createButtonAction("Print", null);
              gbc.gridy = 3;
              add (f_print, gbc);
              //     --     1 -- Cash
              gbc.gridx = 1;
              gbc.gridheight = 2;
              gbc.fill = GridBagConstraints.BOTH;
              gbc.weightx = .1;
              CPanel cash = new CPanel(new GridBagLayout());
              cash.setBorder(new TitledBorder(Msg.getMsg(Env.getCtx(), "Cash")));
              gbc.gridy = 0;
              add (cash, gbc);
              GridBagConstraints gbc0 = new GridBagConstraints();
              gbc0.insets = INSETS2;
              gbc0.anchor = GridBagConstraints.WEST;
              f_lcashGiven = new CLabel(Msg.getMsg(Env.getCtx(),"CashGiven"));
              cash.add (f_lcashGiven, gbc0);
              f_cashGiven = new VNumber("CashGiven", false, false, true, DisplayType.Amount,
                   Msg.translate(Env.getCtx(), "CashGiven"));
              f_cashGiven.addActionListener(this);
              f_cashGiven.setColumns(10, 25);
              cash.add (f_cashGiven, gbc0);
              f_cashGiven.setValue(Env.ZERO);
              f_lcashReturn = new CLabel(Msg.getMsg(Env.getCtx(),"CashReturn"));
              cash.add (f_lcashReturn, gbc0);
              f_cashReturn = new VNumber("CashReturn", false, true, false, DisplayType.Amount,
                   "CashReturn");
              f_cashReturn.setColumns(10, 25);
              cash.add (f_cashReturn, gbc0);
              f_cashReturn.setValue(Env.ZERO);
              f_cashPayment = createButtonAction("Payment", null);
              f_cashPayment.setActionCommand("Cash");
              gbc0.anchor = GridBagConstraints.EAST;
              gbc0.weightx = 0.1;
              cash.add (f_cashPayment, gbc0);
              //     --     1 -- Creditcard
              CPanel creditcard = new CPanel(new GridBagLayout());
              creditcard.setBorder(new TitledBorder(Msg.translate(Env.getCtx(), "CreditCardType")));
              gbc.gridy = 2;
              add (creditcard, gbc);
              GridBagConstraints gbc1 = new GridBagConstraints();
              gbc1.insets = INSETS2;
              gbc1.anchor = GridBagConstraints.WEST;
              gbc1.gridx = 0;
              gbc1.gridy = 0;
              f_lcreditCardNumber = new CLabel(Msg.translate(Env.getCtx(), "CreditCardNumber"));
              creditcard.add (f_lcreditCardNumber, gbc1);
              gbc1.gridy = 1;
              f_creditCardNumber = new CTextField(18);
              creditcard.add (f_creditCardNumber, gbc1);
              gbc1.gridx = 1;
              gbc1.gridy = 0;
              f_lcreditCardExp = new CLabel(Msg.translate(Env.getCtx(),"CreditCardExp"));
              creditcard.add (f_lcreditCardExp, gbc1);
              gbc1.gridy = 1;
              f_creditCardExp = new CTextField(5);
              creditcard.add (f_creditCardExp, gbc1);
              gbc1.gridx = 2;
              gbc1.gridy = 0;
              f_lcreditCardVV = new CLabel(Msg.translate(Env.getCtx(), "CreditCardVV"));
              creditcard.add (f_lcreditCardVV, gbc1);
              gbc1.gridy = 1;
              f_creditCardVV = new CTextField(5);
              creditcard.add (f_creditCardVV, gbc1);
              gbc1.gridx = 3;
              gbc1.gridy = 0;
              gbc1.gridheight = 2;
              f_creditPayment = createButtonAction("Payment", null);
              f_creditPayment.setActionCommand("CreditCard");
              gbc1.anchor = GridBagConstraints.EAST;
              gbc1.weightx = 0.1;
              creditcard.add (f_creditPayment, gbc1);
         }     //     init
          *      Get Panel Position
         public GridBagConstraints getGridBagConstraints()
              GridBagConstraints gbc = super.getGridBagConstraints();
              gbc.gridx = 0;
              gbc.gridy = 3;
              return gbc;
         }     //     getGridBagConstraints
          *      Dispose - Free Resources
         public void dispose()
              super.dispose();
         }     //     dispose
          *      Action Listener
          *     @param e event
         public void actionPerformed (ActionEvent e)
              String action = e.getActionCommand();
              if (action == null || action.length() == 0)
                   return;
              log.info( "PosSubCheckout - actionPerformed: " + action);
              if (e.getSource() == f_cashGiven) {
                   f_cashGiven.setValue(f_cashGiven.getValue());
                   System.out.println("f_cashGiven"+f_cashGiven.getDisplay());
              //     Register
              //     Summary
              //     Print
              if (action.equals("Cash")) {
                   BigDecimal CashGiven, GrandTotal, CashReturn;
                   System.out.println("Cash given is "+f_cashGiven.getDisplay());
                   CashGiven = (BigDecimal)f_cashGiven.getValue();
                   GrandTotal = (BigDecimal)p_posPanel.f_curLine.getOrder().getGrandTotal();
                   CashReturn = CashGiven.subtract(GrandTotal);
                   f_cashReturn.setValue(CashReturn);
              //     Cash (Payment)
              //     CreditCard (Payment)
         }     //     actionPerformed
    }     //     PosSubCheckoutThis is the code of VNumber.java :
    * The contents of this file are subject to the   Compiere License  Version 1.1
    * ("License"); You may not use this file except in compliance with the License
    * You may obtain a copy of the License at http://www.compiere.org/license.html
    * Software distributed under the License is distributed on an  "AS IS"  basis,
    * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
    * the specific language governing rights and limitations under the License.
    * The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial
    * Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke
    * are Copyright (C) 1999-2005 Jorg Janke.
    * All parts are Copyright (C) 1999-2005 ComPiere, Inc.  All Rights Reserved.
    * Contributor(s): ______________________________________.
    package org.compiere.grid.ed;
    import java.awt.*;
    import java.awt.event.*;
    import java.beans.*;
    import java.math.*;
    import java.text.*;
    import java.util.logging.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import org.compiere.apps.*;
    import org.compiere.model.*;
    import org.compiere.swing.*;
    import org.compiere.util.*;
    *     Number Control
    *      @author      Jorg Janke
    *      @version      $Id: VNumber.java,v 1.41 2005/09/03 01:57:16 jjanke Exp $
    public final class VNumber extends JComponent
         implements VEditor, ActionListener, KeyListener, FocusListener
         /**     Number of Columns (12)          */
         public final static int SIZE = 12;
          *  IDE Bean Constructor
         public VNumber()
              this("Number", false, false, true, DisplayType.Number, "Number");
         }   //  VNumber
          *     Create right aligned Number field.
          *     no popup, if WindowNo == 0 (for IDs)
          *  @param columnName column name
          *  @param mandatory mandatory
          *  @param isReadOnly read only
          *  @param isUpdateable updateable
          *  @param displayType display type
          *  @param title title
         public VNumber(String columnName, boolean mandatory, boolean isReadOnly, boolean isUpdateable,
              int displayType, String title)
              super();
              super.setName(columnName);
              m_columnName = columnName;
              m_title = title;
              setDisplayType(displayType);
              LookAndFeel.installBorder(this, "TextField.border");
              this.setLayout(new BorderLayout());
    //          this.setPreferredSize(m_text.getPreferredSize());          //     causes r/o to be the same length
    //          int height = m_text.getPreferredSize().height;
    //          setMinimumSize(new Dimension (30,height));
              //     ***     Text     ***
              m_text.setBorder(null);
              m_text.setHorizontalAlignment(JTextField.TRAILING);
              m_text.addKeyListener(this);
              m_text.addFocusListener(this);
              //     Background
              setMandatory(mandatory);
              this.add(m_text, BorderLayout.CENTER);
              //     ***     Button     ***
              m_button.setIcon(Env.getImageIcon("Calculator10.gif"));
              m_button.setMargin(new Insets(0, 0, 0, 0));
              m_button.setFocusable(false);
              m_button.addActionListener(this);
              this.add (m_button, BorderLayout.EAST);
              //     Prefereed Size
              this.setPreferredSize(this.getPreferredSize());          //     causes r/o to be the same length
              //  Size
              setColumns(SIZE, CComboBox.FIELD_HIGHT-4);     
              //     ReadWrite
              if (isReadOnly || !isUpdateable)
                   setReadWrite(false);
              else
                   setReadWrite(true);
         }     //     VNumber
          *  Dispose
         public void dispose()
              m_text = null;
              m_button = null;
              m_mField = null;
         }   //  dispose
          *     Set Document
          *  @param doc document
         protected void setDocument(Document doc)
              m_text.setDocument(doc);
         }     //     getDocument
         private String               m_columnName;
         protected int               m_displayType;     //  Currency / UoM via Context
         private DecimalFormat     m_format;
         private String               m_title;
         private boolean               m_setting;
         private String               m_oldText;
         private String               m_initialText;
         private boolean               m_rangeSet = false;
         private Double               m_minValue;
         private Double               m_maxValue;
         private boolean               m_modified = false;
         /**  The Field                  */
         private CTextField          m_text = new CTextField(SIZE);     //     Standard
         /** The Button                  */
         private CButton              m_button = new CButton();
         private MField          m_mField = null;
         /**     Logger               */
         private static CLogger log = CLogger.getCLogger(VNumber.class);
          *      Set no of Columns
          *     @param columns columns
         public void setColumns (int columns, int height)
              m_text.setPreferredSize(null);
              m_text.setColumns(columns);
              Dimension size = m_text.getPreferredSize();
              if (height > size.height)               //     default 16
                   size.height = height;
              if (CComboBox.FIELD_HIGHT-4 > size.height)
                   size.height = VLookup.FIELD_HIGHT-4;
              this.setPreferredSize(size);          //     causes r/o to be the same length
              this.setMinimumSize(new Dimension (columns*10, size.height));
              m_button.setPreferredSize(new Dimension(size.height, size.height));
         }     //     setColumns
          *     Set Range with min & max
          *  @param minValue min value
          *  @param maxValue max value
          *     @return true, if accepted
         public boolean setRange(Double minValue, Double maxValue)
              m_rangeSet = true;
              m_minValue = minValue;
              m_maxValue = maxValue;
              return m_rangeSet;
         }     //     setRange
          *     Set Range with min & max = parse US style number w/o Gouping
          *  @param minValue min value
          *  @param maxValue max value
          *  @return true if accepted
         public boolean setRange(String minValue, String maxValue)
              if (minValue == null || maxValue == null)
                   return false;
              try
                   m_minValue = Double.valueOf(minValue);
                   m_maxValue = Double.valueOf(maxValue);
              catch (NumberFormatException nfe)
                   return false;
              m_rangeSet = true;
              return m_rangeSet;
         }     //     setRange
          *  Set and check DisplayType
          *  @param displayType display type
         public void setDisplayType (int displayType)
              m_displayType = displayType;
              if (!DisplayType.isNumeric(displayType))
                   m_displayType = DisplayType.Number;
              m_format = DisplayType.getNumberFormat(displayType);
              m_text.setDocument (new MDocNumber(displayType, m_format, m_text, m_title));
         }   //  setDisplayType
          *     Set ReadWrite
          *  @param value value
         public void setReadWrite (boolean value)
              if (m_text.isReadWrite() != value)
                   m_text.setReadWrite(value);
              if (m_button.isReadWrite() != value)
                   m_button.setReadWrite(value);
              //     Don't show button if not ReadWrite
              if (m_button.isVisible() != value)
                   m_button.setVisible(value);
         }     //     setReadWrite
          *     IsReadWrite
          *  @return true if rw
         public boolean isReadWrite()
              return m_text.isReadWrite();
         }     //     isReadWrite
          *     Set Mandatory (and back bolor)
          *  @param mandatory mandatory
         public void setMandatory (boolean mandatory)
              m_text.setMandatory(mandatory);
         }     //     setMandatory
          *     Is it mandatory
          *  @return true if mandatory
         public boolean isMandatory()
              return m_text.isMandatory();
         }     //     isMandatory
          *     Set Background
          *  @param color color
         public void setBackground(Color color)
              m_text.setBackground(color);
         }     //     setBackground
          *     Set Background
          *  @param error error
         public void setBackground (boolean error)
              m_text.setBackground(error);
         }     //     setBackground
          *  Set Foreground
          *  @param fg foreground
         public void setForeground(Color fg)
              m_text.setForeground(fg);
         }   //  setForeground
          *     Set Editor to value
          *  @param value value
         public void setValue(Object value)
              log.finest("Value=" + value);
              if (value == null)
                   m_oldText = "";
              else
                   m_oldText = m_format.format(value);
              //     only set when not updated here
              if (m_setting)
                   return;
              m_text.setText (m_oldText);
              m_initialText = m_oldText;
              m_modified = false;
         }     //     setValue
          *  Property Change Listener
          *  @param evt event
         public void propertyChange (PropertyChangeEvent evt)
              if (evt.getPropertyName().equals(org.compiere.model.MField.PROPERTY))
                   setValue(evt.getNewValue());
         }   //  propertyChange
          *     Return Editor value
          *  @return value value (big decimal or integer)
         public Object getValue()
              if (m_text == null || m_text.getText() == null || m_text.getText().length() == 0)
                   return null;
              String value = m_text.getText();
              //     return 0 if text deleted
              if (value == null || value.length() == 0)
                   if (!m_modified)
                        return null;
                   if (m_displayType == DisplayType.Integer)
                        return new Integer(0);
                   return Env.ZERO;
              if (value.equals(".") || value.equals(",") || value.equals("-"))
                   value = "0";
              try
                   Number number = m_format.parse(value);
                   value = number.toString();      //     converts it to US w/o thousands
                   BigDecimal bd = new BigDecimal(value);
                   if (m_displayType == DisplayType.Integer)
                        return new Integer(bd.intValue());
                   if (bd.signum() == 0)
                        return bd;
                   return bd.setScale(m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP);
              catch (Exception e)
                   log.log(Level.SEVERE, "Value=" + value, e);
              if (m_displayType == DisplayType.Integer)
                   return new Integer(0);
              return Env.ZERO;
         }     //     getValue
          *  Return Display Value
          *  @return value
         public String getDisplay()
              return m_text.getText();
         }   //  getDisplay
          *      Get Title
          *     @return title
         public String getTitle()
              return m_title;
         }     //     getTitle
          *      Plus - add one.
          *      Also sets Value
          *     @return new value
         public Object plus()
              Object value = getValue();
              if (value == null)
                   if (m_displayType == DisplayType.Integer)
                        value = new Integer(0);
                   else
                        value = Env.ZERO;
              //     Add
              if (value instanceof BigDecimal)
                   value = ((BigDecimal)value).add(Env.ONE);
              else
                   value = new Integer(((Integer)value).intValue() + 1);
              setValue(value);
              return value;
         }     //     plus
          *      Minus - subtract one, but not below minimum.
          *      Also sets Value
          *     @param minimum minimum
          *     @return new value
         public Object minus (int minimum)
              Object value = getValue();
              if (value == null)
                   if (m_displayType == DisplayType.Integer)
                        value = new Integer(minimum);
                   else
                        value = new BigDecimal(minimum);
                   setValue(value);
                   return value;
              //     Subtract
              if (value instanceof BigDecimal)
                   BigDecimal bd = ((BigDecimal)value).subtract(Env.ONE);
                   BigDecimal min = new BigDecimal(minimum);
                   if (bd.compareTo(min) < 0)
                        value = min;
                   else
                        value = bd;
              else
                   int i = ((Integer)value).intValue();
                   i--;
                   if (i < minimum)
                        i = minimum;
                   value = new Integer(i);
              setValue(value);
              return value;
         }     //     minus
          *     Action Listener
          *  @param e event
         public void actionPerformed (ActionEvent e)
              log.config(e.getActionCommand());
              if (ValuePreference.NAME.equals(e.getActionCommand()))
                   if (MRole.getDefault().isShowPreference())
                        ValuePreference.start (m_mField, getValue());
                   return;
              if (e.getSource() == m_button)
                   m_button.setEnabled(false);
                   String str = startCalculator(this, m_text.getText(), m_format, m_displayType, m_title);
                   m_text.setText(str);
                   m_button.setEnabled(true);
                   try
                        fireVetoableChange (m_columnName, m_oldText, getValue());
                   catch (PropertyVetoException pve)     {}
                   m_text.requestFocus();
         }     //     actionPerformed
          *     Key Listener Interface
          *  @param e event
         public void keyTyped(KeyEvent e)    {}
         public void keyPressed(KeyEvent e)  {}
          *     Key Listener.
          *          - Escape           - Restore old Text
          *          - firstChange     - signal change
          *  @param e event
         public void keyReleased(KeyEvent e)
              log.finest("Key=" + e.getKeyCode() + " - " + e.getKeyChar()
                           + " -> " + m_text.getText());
              //  ESC
              if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
                   m_text.setText(m_initialText);
              m_modified = true;
              m_setting = true;
              try
                   if (e.getKeyCode() == KeyEvent.VK_ENTER)     //     10
                        fireVetoableChange (m_columnName, m_oldText, getValue());
                        fireActionPerformed();
                   else     //     indicate change
                        fireVetoableChange (m_columnName, m_oldText, null);     
              catch (PropertyVetoException pve)     {}
              m_setting = false;
         }     //     keyReleased
          *     Focus Gained
          *  @param e event
         public void focusGained (FocusEvent e)
              if (m_text != null)
                   m_text.selectAll();
         }     //     focusGained
          *     Data Binding to MTable (via GridController.vetoableChange).
          *  @param e event
         public void focusLost (FocusEvent e)
         //          log.finest(e.toString());
              //     APanel - Escape
              if (e.getOppositeComponent() instanceof AGlassPane)
                   m_text.setText(m_initialText);
                   return;
              try
                   fireVetoableChange (m_columnName, m_initialText, getValue());
                   fireActionPerformed();
              catch (PropertyVetoException pve)     {}
         }   //  focusLost
          *     Invalid Entry - Start Calculator
          *  @param jc parent
          *  @param value value
          *  @param format format
          *  @param displayType display type
          *  @param title title
          *  @return value
         public static String startCalculator(Container jc, String value,
              DecimalFormat format, int displayType, String title)
              log.config("Value=" + value);
              BigDecimal startValue = new BigDecimal(0.0);
              try
                   if (value != null && value.length() > 0)
                        Number number = format.parse(value);
                        startValue = new BigDecimal (number.toString());
              catch (ParseException pe)
                   log.info("InvalidEntry - " + pe.getMessage());
              //     Find frame
              Frame frame = Env.getFrame(jc);
              //     Actual Call
              Calculator calc = new Calculator(frame, title,
                   displayType, format, startValue);
              AEnv.showCenterWindow(frame, calc);
              BigDecimal result = calc.getNumber();
              log.config( "Result=" + result);
              calc = null;
              if (result != null)
                   return format.format(result);
              else
                   return value;          //     original value
         }     //     startCalculator
          *  Set Field/WindowNo for ValuePreference
          *  @param mField field
         public void setField (MField mField)
              m_mField = mField;
              if (m_mField != null
                   && MRole.getDefault().isShowPreference())
                   ValuePreference.addMenu (this, popupMenu);
         }   //  setField
          *      Remove Action Listner
          *      @param l Action Listener
         public void removeActionListener(ActionListener l)
              listenerList.remove(ActionListener.class, l);
         }     //     removeActionListener
          *      Add Action Listner
          *      @param l Action Listener
         public void addActionListener(ActionListener l)
              listenerList.add(ActionListener.class, l);
         }     //     addActionListener
          *      Fire Action Event to listeners
         protected void fireActionPerformed()
              int modifiers = 0;
              AWTEvent currentEvent = EventQueue.getCurrentEvent();
              if (currentEvent instanceof InputEvent)
                   modifiers = ((InputEvent)currentEvent).getModifiers();
              else if (currentEvent instanceof ActionEvent)
                   modifiers = ((ActionEvent)currentEvent).getModifiers();
              ActionEvent ae = new ActionEvent (this, ActionEvent.ACTION_PERFORMED,
                   "VNumber", EventQueue.getMostRecentEventTime(), modifiers);
              // Guaranteed to return a non-null array
              Object[] listeners = listenerList.getListenerList();
              // Process the listeners last to first, notifying those that are interested in this event
              for (int i = listeners.length-2; i>=0; i-=2)
                   if (listeners==ActionListener.class)
                        ((ActionListener)listeners[i+1]).actionPerformed(ae);
         }     //     fireActionPerformed
    }     //     VNumber

    If getValue() returns null, you need to trace the execution of the code and figure out which sequence of code is leading to the return of null. This method looks complex - a lot of if statements. If you do not have a debugger, put System.out.println statements inside the method to figure out what's going on.

  • Taking download into excel from ALV Grid - header is printing in two lines

    Hi All,
    I have a scenario where I am taking the download from ALV grid to an excel sheet. Now the header of the ALV (column names) is appearing in two lines in the downloaded excel sheet while items (records of the ALV table) are getting displayed in a single line.
    This download is taken from the standard download to local file (spreadsheet) button provided by SAP for ALVs.
    I am using function module "Reuse_alv_grid_display" for the purpose.
    Can somebody provide an idea how I can avoid the header printing in two lines and keep the length as it is.
    Thanks in Advance,
    Chandan

    Hi..
    1. Pass header name in internal table appned first line.
    2. after that pass u r data .
    3. Use  FM. WS_DOWNLOAD 
    Salil ......
    Edited by: salil chavan on Nov 26, 2008 11:07 AM

  • Capturing data from ALV grid

    Dear experts.
    Can anyone help me to capture data from ALV grid to pass to a BAPI FM.
    My ALV grid has the check box as first column and I want to capture only the rows in the grid with these checkboxes checked. I would prefer to do it without OO.
    Regards
    Sathar

    Loop at the table used for ALV data where <checkbox-field> = 'X'.
    Best,
    Jim

  • Return from ALV  Grid to Selection screen

    hi,
    I want to go back from ALV grid to selection screen.
    I am using the following code:
    WHEN 'BACK'.
    CALL METHOD grid1->refresh_table_display.
    CALL METHOD grid1->free.
    CALL METHOD custom_container1->free.
    CALL SELECTION-SCREEN 1000.
    it is working,but when i press BACK button from selection screen to program it is showing ERROR IN FLUSH 4 Error.
    Also I tried with method FLUSH
    WHEN 'BACK'.
    CALL METHOD grid1->refresh_table_display.
    CALL METHOD grid1->free.
    CALL METHOD custom_container1->free.
    CALL METHOD cl_gui_cfw=>flush.
    it's still showing same Error.
    Please help on this.
    Regards,
    Sankar

    Hi,
    My grid name is grid1.
    I tried with :
    DATA grid1 TYPE REF TO cl_gui_alv_grid.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
    e_grid = grid1.
    CALL METHOD grid1->check_changed_data.
    CALL METHOD grid1->refresh_table_display.
    LEAVE TO SCREEN 0.
    Even, I tried with declaring another grid : grid2
    DATA grid1 TYPE REF TO cl_gui_alv_grid.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
    e_grid = grid1.
    CALL METHOD grid1->check_changed_data.
    CALL METHOD grid1->refresh_table_display.
    LEAVE TO SCREEN 0.
    In both cases, I am getting the following Error : OBJECTS_OBJREF_NOT_ASSIGNED

  • Facing a Problem while downloading the data from ALV Grid to Excel Sheet

    Hi Friends,
    Iam facing a problem while downloading the data from ALV Grid to excel sheet. This is working fine in Development server , when comes to Quality and Production servers I have this trouble.
       I have nearly 11 fields in ALV Grid and out of which one is PO number of length 10 , all the ten numbers are visible in the excel sheet if we download it from development server but when we download it from Quality or Production it is showing only 9 numbers.
    Can any one help me out in this case.

    hi...
    if this problems happens dont display the same internal as u finally got.
    just create new internal table without calling any standard data elements and domains... but the new internal table s similar like ur final internal table and move all the values to new int table.
    for eg.
    ur final internal int table for disp,
         data : begin of itab occur 0,
                        matnr like mara-matnr,
                   end of itab.
    create new like this,
               data : begin of itab occur 0,
                        matnr(12) type N,
                   end of itab.

  • CL_SALV_BS_TT_RESULT_TABLE====CP error while downloading data from ALV grid

    Hi ,
    I am  facing a problem when ever i am going to donload data from ALV grid to excel file.I am getting CL_SALV_BS_TT_RESULT_TABLE====CP error in GET_CELL_VALUE. Could you please provide me is there any OSS note or any patch required to solve this issue.
    Thanks in Advance,
    Venkatarao.

    Hi,
    Just refer to OSS note 1356898 for guidelines.
    Regards,
    Vasanth

  • How to change sub total value in ALV Grid.

    Hi All,
    Can u please explain how to change SUBTOTAL Value in ALV Grid display based on another field value.
    EX; F1 subtotal is  initial then we have to modify the F2 sub total to 9999.9.
    Thanks
    Radha.

    Hi Radha,
    I doubt if that can be changed....because the event that i was referring to in my previous post works with ALV List display...But in any case you can try that.....
    There is an event in SLIS....(As i told you, i dont remember the name and currently i dont have access to SAP system, so i am not able to verify and let you know that event name).....
    Other thatn TOP and END of PAGE events, there is an event for sub-total text......i think it would start with "SUBTOTAL"...
    you need to use that event in your events table and pass it to ALV Grid display.
    Then create a sub-routine with that name (As you do for TOP-OF-PAGE event)....and in this event you can change the values in runtime (PROVIDED, this event gets triggered for ALV GRID).....
    If this does not work, i think calculating sub-totals while you build the internal table would be a better option....(If you have time constraint....else you can do some more research on the same)........
    Best Regards,
    Ram.

  • 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 get the values from popup window to mainwindow

    HI all,
       I want to get the details from popup window.
          i have three input fields and one search button in my main window. when i click search button it should display popup window.whenever i click on selected row of the popup window table ,values should be visible in my main window input fields.(normal tables)
       now i am able to display popup window with values.How to get the values from popup window now.
       I can anybody explain me clearly.
    Thanks&Regards
    kranthi

    Hi Kranthi,
    Every webdynpro component has a global controller called the component controller which is visible to all other controllers within the component.So whenever you want to share some data in between 2 different views you can just make it a point to use the component controller's context for the same. For your requirement (within your popups view context) you will have have to copy the component controllers context to your view. You then will have to (programmatically) fill this context with your desired data in this popup view. You can then be able to read this context from whichever view you want. I hope that this would have made it clear for you. Am also giving you an [example|http://****************/Tutorials/WebDynproABAP/Modalbox/page1.htm] which you can go through which would give you a perfect understanding of all this. In this example the user has an input field in the main view. The user enters a customer number & presses on a pushbutton. The corresponding sales orders are then displayed in a popup window for the user. The user can then select any sales order & press on a button in the popup. These values would then get copied to the table in the main view.
    Regards,
    Uday

Maybe you are looking for

  • Sharing problem from OSX mavericks to windows 7

    I want to acces a windows 7 shared folder with my mac. I have schared the windows folder and have given full permission to evereyone. The workgroup name, login and pasword are the same on the MAC and Windows 7 PS. I have don a ping test and the resul

  • French accents in pdf output gives funny characters

    Hi All, One of our customer wants to view the french accents in the pdf ouptut but its showing some junk characters instead. For eg. Montréal is output as Montréal. He can see the correct output in the text but not in the pdf and the postscript form

  • SAP GTS-TSW Integration

    Hi Guys Is TSW integration possible, i heard that this can be done. Process should be - Nomination is created with a sanction party and the same gets blocked, this helps a lot since it saves the problem of going to the SO level. If this can be done,

  • Elements 12 serial number

    Where do I find the 24 digit serial number to activiate Elements 12?

  • Possible to uninstall Flash Player for specific browser with Uninstaller program?

    Greetings, I'm using a domain login script to deploy Flash Player across 400 or so PCs. Currently the script is set up to run the Flash Player Uninstaller executable prior to running the IE Flash Player Installer executable. The problem with this is