REUSE_ALV_GRID_DISPLAY - get edited data
Hi,
I am using REUSE_ALV_GRID_DISPLAY where some fields I set to input/edit. The whole GRID is not set to edit mode. Additionaly I add a button in the toolbar so the control comes via user command event. My question now is how can I get the actual content of my edited fields if the user pushes the new button?
Thanks Achim
Hi,
I am giving you a sample code of ALV with editable fields at the output.At the output when user selects some records and pushes a button on the application toolbar it takes the edited records and calls smartform and pass the records to the smart form.
REPORT ZMSTR0022.
CONSTANTS: C_FORM_NAME TYPE TDSFNAME VALUE 'ZMST_PER_APPL'.
TABLES :ZMST_PERMIT.
TYPE-POOLS: SLIS.
TYPE-POOLS :VRM. "Value Request Manager
TYPES:BEGIN OF STRU_ZMST_PERMIT,
CHECKBOX(1) TYPE C, " Checkbox
ZPIDNUM TYPE ZMST_PERMIT-ZPIDNUM, " Permit ID No.
ZARBDSC TYPE ZMST_PERMIT-ZARBDSC, " Arabic description
ZENGDSC TYPE ZMST_PERMIT-ZENGDSC, " English description
ZENQUAN TYPE ZMST_PERMIT-ZENQUAN, " Qty in English
ZARQUAN TYPE ZMST_PERMIT-ZARQUAN, " Qty in Arabic
ZENUOM TYPE ZMST_PERMIT-ZENUOM, " UoM
ZTARIFF TYPE ZMST_PERMIT-ZTARIFF, " Tariff No
ZARRPRT TYPE ZMST_PERMIT-ZARRPRT, " Port code
ZPRT_NAME(60) TYPE C, " Port name in Arabic
ZPERNUM TYPE ZMST_PERMIT-ZPERNUM, " Reference No
ZEFFDT TYPE ZMST_PERMIT-ZEFFDT, " Valid from
ZEXPDT TYPE ZMST_PERMIT-ZEXPDT, " Valid to
ZARB_DT(15) TYPE C, " Arabic Date of letter
ZNAME_AUTH(50) TYPE C, " Name of Authority
ZPERM_MIN(50) TYPE C, " Permit Ministry
END OF STRU_ZMST_PERMIT.
TYPES:BEGIN OF STRU_PERMIT,
ZPIDNUM TYPE ZMST_PERMIT-ZPIDNUM, " Permit ID No.
ZENGDSC TYPE ZMST_PERMIT-ZENGDSC, " English description
ZARBDSC TYPE ZMST_PERMIT-ZARBDSC, " Arabic description
ZTARIFF TYPE ZMST_PERMIT-ZTARIFF, " Tariff No
ZPERNUM TYPE ZMST_PERMIT-ZPERNUM, " Reference No
ZARRPRT TYPE ZMST_PERMIT-ZARRPRT, " Port code
ZEFFDT TYPE ZMST_PERMIT-ZEFFDT, " Valid from
ZEXPDT TYPE ZMST_PERMIT-ZEXPDT, " Valid to
END OF STRU_PERMIT.
TYPES: BEGIN OF STRU_FORM_PERMIT,
ZARBDSC TYPE ZMST_PERMIT-ZARBDSC, " Arabic description
ZENGDSC TYPE ZMST_PERMIT-ZENGDSC, " English description
ZENQUAN TYPE ZMST_PERMIT-ZENQUAN, " Qty in English
ZARQUAN TYPE ZMST_PERMIT-ZARQUAN, " Qty in Arabic
ZENUOM TYPE ZMST_PERMIT-ZENUOM, " UoM
ZTARIFF TYPE ZMST_PERMIT-ZTARIFF, " Tariff No
ZPRT_NAME(60) TYPE C, " Port name in Arabic
END OF STRU_FORM_PERMIT.
DATA: IT_PERMIT TYPE TABLE OF STRU_PERMIT.
DATA: IT_ZMST_PERMIT TYPE TABLE OF STRU_ZMST_PERMIT,
WA_ZMST_PERMIT LIKE LINE OF IT_ZMST_PERMIT,
IT_FORM_PERMIT TYPE TABLE OF STRU_FORM_PERMIT,
WA_FORM_PERMIT LIKE LINE OF IT_FORM_PERMIT.
DATA: WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE TABLE OF SLIS_FIELDCAT_ALV.
DATA: W_FORM TYPE RS38L_FNAM.
DATA: W_NAME_AUTH(50),
W_ZARBDT(15),
W_ZENGDT(10),
W_ZPRT_NAME(70).
DATA: W_PARAM TYPE SSFCTRLOP.
DATA:W_NAME1 TYPE DFIES-FIELDNAME,
W_NAME2 TYPE HELP_INFO-DYNPROFLD .
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-023.
SELECT-OPTIONS:S_PIDNUM FOR ZMST_PERMIT-ZPIDNUM ,
S_ENGDSC FOR ZMST_PERMIT-ZENGDSC NO INTERVALS LOWER CASE,
S_ARBDSC FOR ZMST_PERMIT-ZARBDSC NO INTERVALS LOWER CASE,
S_TARIFF FOR ZMST_PERMIT-ZTARIFF NO INTERVALS,
S_PERNUM FOR ZMST_PERMIT-ZPERNUM NO INTERVALS,
S_ARRPRT FOR ZMST_PERMIT-ZARRPRT NO INTERVALS MATCHCODE OBJECT ZMST_PORTS.
PARAMETER:P_PERTYP(2) TYPE C AS LISTBOX VISIBLE LENGTH 20.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_PIDNUM-LOW.
W_NAME2 = 'S_PIDNUM-LOW'.
W_NAME1 = 'ZPIDNUM'.
PERFORM F4_HELP USING W_NAME1 W_NAME2 . "calling subroutine to provide desired F4 help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_PIDNUM-HIGH.
W_NAME2 = 'S_PIDNUM-HIGH'.
W_NAME1 = 'ZPIDNUM'.
PERFORM F4_HELP USING W_NAME1 W_NAME2 . "calling subroutine to provide desired F4 help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_ENGDSC-LOW.
W_NAME2 = 'S_ENGDSC'.
W_NAME1 = 'ZENGDSC'.
PERFORM F4_HELP USING W_NAME1 W_NAME2 . "calling subroutine to provide desired F4 help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_ARBDSC-LOW.
W_NAME2 = 'S_ARBDSC'.
W_NAME1 = 'ZARBDSC'.
PERFORM F4_HELP USING W_NAME1 W_NAME2 . "calling subroutine to provide desired F4 help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_TARIFF-LOW.
W_NAME2 = 'S_TARIFF'.
W_NAME1 = 'ZTARIFF'.
PERFORM F4_HELP USING W_NAME1 W_NAME2 . "calling subroutine to provide desired F4 help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_PERNUM-LOW.
W_NAME2 = 'S_PERNUM'.
W_NAME1 = 'ZPERNUM'.
PERFORM F4_HELP USING W_NAME1 W_NAME2 . "calling subroutine to provide desired F4 help
AT SELECTION-SCREEN.
IF SY-UCOMM = 'ONLI'.
PERFORM CHECK_INPUT. "calling subroutine to check inputs on selection screen
ENDIF.
INITIALIZATION.
PERFORM VAL_PERTYP.
START-OF-SELECTION.
PERFORM FILL_FIELDCAT. "calling subroutine for filling fieldcatalog
If Permit ministry is blank then fetch data from ZMST_PERMIT otherwise from ZMST_PERMITHI--
IF P_PERTYP IS INITIAL.
PERFORM FETCH_PERMIT. "calling subroutine to fetch data from ZMST_PERMIT
ELSE.
PERFORM FETCH_PERMITHI. "calling subroutine to fetch data from ZMST_PERMITHI
ENDIF.
END-OF-SELECTION.
*& Form fill_fieldcat
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT .
-passing the parameters of layout--
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
WA_LAYOUT-BOX_FIELDNAME = 'CHECKBOX'.
WA_LAYOUT-BOX_TABNAME = 'IT_ZMST_PERMIT'.
-Passing the parameters of fieldcatalog--
WA_FIELDCAT-FIELDNAME = 'ZPIDNUM'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_M = TEXT-001.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ZARBDSC'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_M = TEXT-002.
WA_FIELDCAT-EDIT = 'X'.
WA_FIELDCAT-LOWERCASE = 'X'.
WA_FIELDCAT-OUTPUTLEN = 120.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ZENGDSC'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_M = TEXT-003.
WA_FIELDCAT-EDIT = 'X'.
WA_FIELDCAT-LOWERCASE = 'X'.
WA_FIELDCAT-OUTPUTLEN = 120.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ZENQUAN'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_M = TEXT-004.
WA_FIELDCAT-EDIT = 'X'.
WA_FIELDCAT-LOWERCASE = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ZARQUAN'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_M = TEXT-005.
WA_FIELDCAT-EDIT = 'X'.
WA_FIELDCAT-LOWERCASE = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ZENUOM'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_M = TEXT-006.
WA_FIELDCAT-EDIT = 'X'.
WA_FIELDCAT-LOWERCASE = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ZTARIFF'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_M = TEXT-007.
WA_FIELDCAT-EDIT = 'X'.
WA_FIELDCAT-OUTPUTLEN = 15.
WA_FIELDCAT-LOWERCASE = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ZARB_DT'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_L = TEXT-013.
WA_FIELDCAT-EDIT = 'X'.
WA_FIELDCAT-LOWERCASE = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ZNAME_AUTH'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_M = TEXT-014.
WA_FIELDCAT-EDIT = 'X'.
WA_FIELDCAT-OUTPUTLEN = 50.
WA_FIELDCAT-LOWERCASE = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ZPRT_NAME'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_M = TEXT-009.
WA_FIELDCAT-EDIT = 'X'.
WA_FIELDCAT-OUTPUTLEN = 60.
WA_FIELDCAT-LOWERCASE = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ZARRPRT'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_M = TEXT-008.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ZPERNUM'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_M = TEXT-010.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ZEFFDT'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_M = TEXT-011.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ZEXPDT'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_M = TEXT-012.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'ZPERM_MIN'.
WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
WA_FIELDCAT-SELTEXT_M = TEXT-019.
WA_FIELDCAT-OUTPUTLEN = 50.
WA_FIELDCAT-LOWERCASE = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. " fill_fieldcat
*& Form alv_disp
text
--> p1 text
<-- p2 text
FORM ALV_DISP .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'ZMSTR0022'
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_GRID_TITLE = TEXT-015
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
I_SAVE = 'A'
TABLES
T_OUTTAB = IT_ZMST_PERMIT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " alv_disp
*& Form PF_STATUS
text
This subroutine sets the GUI status
FORM PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'ZSTANDARD_FULLSCREEN'.
ENDFORM. "PF_STATUS
*& Form USER_COMMAND
FORM USER_COMMAND USING R_UCOMM TYPE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.
*For Printing Smartform
IF R_UCOMM = 'PRT'.
CLEAR WA_FORM_PERMIT.
REFRESH IT_FORM_PERMIT.
LOOP AT IT_ZMST_PERMIT INTO WA_ZMST_PERMIT WHERE CHECKBOX = 'X'.
MOVE-CORRESPONDING WA_ZMST_PERMIT TO WA_FORM_PERMIT.
APPEND WA_FORM_PERMIT TO IT_FORM_PERMIT .
*Check for First occurence of Name of authority
IF WA_ZMST_PERMIT-ZNAME_AUTH NE SPACE.
IF W_NAME_AUTH = ' '.
W_NAME_AUTH = WA_ZMST_PERMIT-ZNAME_AUTH.
ENDIF.
ENDIF.
*Check for First occurence of Arabic date
IF WA_ZMST_PERMIT-ZARB_DT NE SPACE.
IF W_ZARBDT = ' '.
W_ZARBDT = WA_ZMST_PERMIT-ZARB_DT.
ENDIF.
ENDIF.
IF WA_ZMST_PERMIT-ZPRT_NAME NE SPACE.
IF W_ZPRT_NAME = ' '.
MOVE WA_ZMST_PERMIT-ZPRT_NAME TO W_ZPRT_NAME.
CONDENSE W_ZPRT_NAME.
ENDIF.
ENDIF.
CLEAR : WA_FORM_PERMIT, WA_ZMST_PERMIT.
ENDLOOP.
CONCATENATE SY-DATUM0(4) '/' SY-DATUM4(2) '/' SY-DATUM+6(2) INTO W_ZENGDT.
*Printing Subroutine
IF NOT IT_FORM_PERMIT[] IS INITIAL.
PERFORM PRINT_FORM.
ELSE.
MESSAGE TEXT-018 TYPE 'I'.
ENDIF.
ENDIF.
ENDFORM. "user_command
*& Form F4_HELP
text
--> p1 text
<-- p2 text
FORM F4_HELP USING: W_VAR TYPE DFIES-FIELDNAME
W_VAR1 TYPE HELP_INFO-DYNPROFLD .
Fetching data from zmst_permit for F4 help on PERMIT ID No.--
IF IT_PERMIT[] IS INITIAL.
SELECT ZPIDNUM
ZENGDSC
ZARBDSC
ZTARIFF
ZPERNUM
ZARRPRT
ZEFFDT
ZEXPDT
FROM ZMST_PERMIT INTO CORRESPONDING FIELDS OF TABLE IT_PERMIT.
ENDIF.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = W_NAME1 " 'ZPIDNUM'
DYNPPROG = 'ZMSTR0022'
DYNPNR = SY-DYNNR
DYNPROFIELD = W_NAME2 "'S_PIDNUM'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = IT_PERMIT
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " F4_HELP
*& Form check_input
text
--> p1 text
<-- p2 text
FORM CHECK_INPUT .
IF S_PIDNUM[] IS INITIAL AND
S_ENGDSC[] IS INITIAL AND
S_ARBDSC[] IS INITIAL AND
S_TARIFF[] IS INITIAL AND
S_PERNUM[] IS INITIAL AND
S_ARRPRT[] IS INITIAL .
MESSAGE TEXT-016 TYPE 'E'.
LEAVE TO TRANSACTION 'ZMSTR022'.
ENDIF.
ENDFORM. " check_input
*& Form print_form
text
--> p1 text
<-- p2 text
FORM PRINT_FORM .
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = C_FORM_NAME
IMPORTING
FM_NAME = W_FORM
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
W_PARAM-LANGU ='AR'.
CALL FUNCTION W_FORM
EXPORTING
CONTROL_PARAMETERS = W_PARAM
W_NAME_AUTH = W_NAME_AUTH
W_ZARBDT = W_ZARBDT
W_ZENGDT = W_ZENGDT
W_ZPRT_NAME = W_ZPRT_NAME
TABLES
IT_FORM_PERMIT = IT_FORM_PERMIT
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
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. " print_form
*& Form fetch_Permit
text
--> p1 text
<-- p2 text
FORM FETCH_PERMIT .
-Fetching data from zmst_permit based on the inputs on selection screen--
SELECT
ZPIDNUM
ZARBDSC
ZENGDSC
ZENQUAN
ZARQUAN
ZENUOM
ZTARIFF
ZARRPRT
ZPERNUM
ZEFFDT
ZEXPDT
FROM ZMST_PERMIT INTO CORRESPONDING FIELDS OF TABLE IT_ZMST_PERMIT
WHERE ZPIDNUM IN S_PIDNUM
AND ZENGDSC IN S_ENGDSC
AND ZARBDSC IN S_ARBDSC
AND ZTARIFF IN S_TARIFF
AND ZPERNUM IN S_PERNUM
AND ZARRPRT IN S_ARRPRT.
IF SY-SUBRC <> 0.
MESSAGE TEXT-017 TYPE 'I'.
LEAVE TO TRANSACTION 'ZMSTR022'.
ELSE.
LOOP AT IT_ZMST_PERMIT INTO WA_ZMST_PERMIT.
WA_ZMST_PERMIT-ZPERM_MIN = TEXT-020.
MODIFY IT_ZMST_PERMIT INDEX SY-TABIX FROM WA_ZMST_PERMIT TRANSPORTING ZPERM_MIN .
ENDLOOP.
PERFORM ALV_DISP. " calling subroutine for ALV display
ENDIF.
ENDFORM. " fetch_Permit
*& Form fetch_permithi
text
--> p1 text
<-- p2 text
FORM FETCH_PERMITHI .
-Fetching data from zmst_permit based on the inputs on selection screen--
SELECT
ZPIDNUM
ZARBDSC
ZENGDSC
ZENQUAN
ZARQUAN
ZENUOM
ZTARIFF
ZARRPRT
ZPERNUM
ZEFFDT
ZEXPDT
FROM ZMST_PERMITHI INTO CORRESPONDING FIELDS OF TABLE IT_ZMST_PERMIT
WHERE ZPIDNUM IN S_PIDNUM
AND ZENGDSC IN S_ENGDSC
AND ZARBDSC IN S_ARBDSC
AND ZTARIFF IN S_TARIFF
AND ZPERNUM IN S_PERNUM
AND ZARRPRT IN S_ARRPRT
AND ZPERTYP = P_PERTYP.
IF SY-SUBRC <> 0.
MESSAGE TEXT-017 TYPE 'I'.
LEAVE TO TRANSACTION 'ZMSTR022'.
ELSE.
LOOP AT IT_ZMST_PERMIT INTO WA_ZMST_PERMIT.
CASE P_PERTYP.
WHEN 'I'.
WA_ZMST_PERMIT-ZPERM_MIN = TEXT-021.
MODIFY IT_ZMST_PERMIT INDEX SY-TABIX FROM WA_ZMST_PERMIT TRANSPORTING ZPERM_MIN .
WHEN 'H'.
WA_ZMST_PERMIT-ZPERM_MIN = TEXT-022.
MODIFY IT_ZMST_PERMIT INDEX SY-TABIX FROM WA_ZMST_PERMIT TRANSPORTING ZPERM_MIN .
ENDCASE.
ENDLOOP.
PERFORM ALV_DISP. " calling subroutine for ALV display
ENDIF.
ENDFORM. " fetch_permithi
*& Form val_PERTYP
text
--> p1 text
<-- p2 text
FORM VAL_PERTYP .
DATA: W_NAME TYPE VRM_ID,
IT_LIST TYPE VRM_VALUES,
WA_VALUE LIKE LINE OF IT_LIST.
WA_VALUE-KEY = ' '.
WA_VALUE-TEXT = TEXT-020.
APPEND WA_VALUE TO IT_LIST.
CLEAR WA_VALUE.
WA_VALUE-KEY = 'I'.
WA_VALUE-TEXT = TEXT-021.
APPEND WA_VALUE TO IT_LIST.
CLEAR WA_VALUE.
WA_VALUE-KEY = 'H'.
WA_VALUE-TEXT = TEXT-022.
APPEND WA_VALUE TO IT_LIST.
CLEAR WA_VALUE.
W_NAME = 'P_PERTYP'.
P_PERTYP = ' '.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = W_NAME
VALUES = IT_LIST
EXCEPTIONS
ID_ILLEGAL_NAME = 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. " val_PERTYP
I hope this will helpp you.
Help children of U.N World Food Program by rewarding points and encourage others to answer your queries.
Similar Messages
-
How to get editable data into internal table
Hi ABAPers,
I am displaying REUSE_ALV_GRID_DISPLAY report with one editable field and i have post button in report. Once i select post button i need to get editable data to internal table which i passed to REUSE_ALV_GRID_DISPLAY.
actually i am writing below code but data is not coming to internal table.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'PF-STATUS'
i_callback_user_command = 'USER_COMMAND '
it_fieldcat = t_field[]
i_default = 'X'
TABLES
t_outtab = <fs_display1>. "t_display
FORM user_command USING g_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
g_test1 = g_ucomm.
CASE g_ucomm.
WHEN 'POST'.
READ TABLE <fs_display1> ASSIGNING <fsw_display1> INDEX 1. "Just for testing index 1
IF sy-subrc = 0.
w_display = <fsw_display1>.
APPEND w_display TO t_display.
CLEAR : w_display.
ENDIF.
PERFORM v1.
PERFORM bapi_call.
ENDCASE.
ENDFORM. "USER_COMMAND
Please help me how to get.
Regards,
Raju.Hi,
Try the following:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'PF-STATUS'
i_callback_user_command = 'USER_COMMAND '
it_fieldcat = t_field[]
i_default = 'X'
TABLES
t_outtab = <fs_display1>. "t_display
FORM user_command USING g_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
g_test1 = g_ucomm.
CASE g_ucomm.
WHEN 'POST'.
* to reflect the data changed into internal table
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
READ TABLE <fs_display1> ASSIGNING <fsw_display1> INDEX 1. "Just for testing index 1
IF sy-subrc = 0.
w_display = <fsw_display1>.
APPEND w_display TO t_display.
CLEAR : w_display.
ENDIF.
PERFORM v1.
PERFORM bapi_call.
ENDCASE.
ENDFORM. "USER_COMMAND
Hope it helps.
Regards,
Gilberto Li -
Get edited data ou of grid back into internal tabel
Hi dear all,
after the help of so brilliant tutors i now can edit my ALV Grid, but I dont't know how i can get the content of the edited rows back into the internal table (it_outtab). I studied several methods, but for example the method SAVE_DATA is private, so I can't use it out of my program.
Many many thanks in advance for th friendly colleague who knows the answer.
Dorothea.Hello Dorothea
If you just want that your itab contents reflects the data on the editable ALV grid then the simplest solution is to call the appropriate method at PAI:
" Your dynpro flow logic may look like this:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CALL METHOD go_grid->check_changed_data( ). " retrieves changes from editable ALV grid
" and updates itab, e.g. gt_outtab
" NOTE: If you do not need to validate the changed data there is no need
" to define an event handler method.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
You may want to have a look at ALV GRID Problem with reading contents and my dicussion with David Halitsky in Where/how would you add the actual DB update to BCALV_EDIT_03?.
Regards
Uwe -
How can I get right data in a cell of JTable when table enter editing
how can I get right data in a cell of JTable when table enter editing
how can I get right data in a cell of JTable when table enter editing
-
How to get changed data in ALV in Web Dynpro for ABAP
METHOD on_data_check .
DATA:
node_spfli TYPE REF TO if_wd_context_node,
node_sflight TYPE REF TO if_wd_context_node,
itab_sflight2 TYPE if_display_view=>elements_sflight.
node_spfli = wd_context->get_child_node( name = if_display_view=>wdctx_spfli ).
node_sflight = node_spfli->get_child_node( name = if_display_view=>wdctx_sflight ).
CALL METHOD node_sflight->get_static_attributes_table
IMPORTING
table = itab_sflight2.
this code is ..get all data(changed and not changed)
but i want get changed data only, not all data.
how to get changed data?
Edited by: Ki-Joon Seo on Dec 27, 2007 6:04 AMHi,
To get only the changed data in the ALV grid of a WD, you need to capture the "ON_DATA_CHECK" of the ALV grid.
To this please do the following in the ALV initialization of the ALV table settings :
lr_table_settings->set_data_check(
IF_SALV_WD_C_TABLE_SETTINGS=>DATA_CHECK_ON_CELL_EVENT ).
You may also do this:
lr_table_settings->set_data_check( IF_SALV_WD_C_TABLE_SETTINGS=>DATA_CHECK_ON_CHECK_EVENT)
The above two ways would depend on when do you need to check for the changed data. If you want to check the data as soon as it is entered, then use the first method. Else, use the second method.
You need to register an EVENT HANDLER for this event.(You may do this in your VIEW or Component Controller).
In this Event handler, you would find an importing parameter R_PARAM which is a ref type of IF_SALV_WD_TABLE_DATA_CHECK.
The attribute T_MODIFIED_CELLS of this interface IF_SALV_WD_TABLE_DATA_CHECK will contain the modified cells of the ALV with the old & new values. -
How to get the data from a cluster table to BW
Dear All,
I want to extract the data from R/3 to BW by using 2 tables and one Cluster B2.
Actually my report contains some fields from PA2001, PA2002 and one cluster table B2 (Table ZES). Can I create View by using these 3 tables? If it is not possible how can I get the data from the cluster? Can I create generic datasource by using cluster tables directly?
In SE11 Transaction the Cluster (table ZES) is showing invalid table.
I referred some Forums, but no use.
Can any body tell me procedure to get the data from a cluster (table ZES) ?
Waiting for you results.
Thanks and regards
RajeshHI Siggi,
Thank you for your reply..
I am also planning to do FM to get the data. But it is saying that the Cluster table ZES does not exist (ZES is the the standard table, in SE11 also).
How can I use the Fields from the that table.?
What can I do now, can you please explain me about this point.
Waiting for your reply.
Thanks and Regards
Rajesh
Message was edited by:
rajesh -
Refernce Nav igational Attribute is not getting the data in Infoprovider
Hi,
I am facing the issue with Reference Characteristic which is a navigational attribute for which data is not getting populated in the cube.Please find the below scenario.
We have three characteristics 0RECV_WBS_E , 0WBS_ELEMT, ZPSBUSA .Char 0RECV_WBS_E is reference of 0WBS_ELEMT.
0RECV_WBS_E__ZPSBUSA,0WBS_ELEMT__ZPSBUSA are the Navigational attributes of ZPSBUSA, these two are maintained as Navigational attributes in the cube and at info object level. The Nav Attribute 0RECV_WBS_E__ZPSBUSA is not getting the data in infocube where as 0WBS_ELEMT__ZPSBUSA is getting the data .The data is available for the two Nav attributes in the info object ZPSBUSA .Can you please suggest why this reference Nav attribute 0RECV_WBS_E__ZPSBUSA is not getting data in the infocube.
Thanks,
SUbhashHi,
I am facing the issue with Reference Characteristic which is a navigational attribute for which data is not getting populated in the cube.Please find the below scenario.
We have three characteristics 0RECV_WBS_E , 0WBS_ELEMT, ZPSBUSA .Char 0RECV_WBS_E is reference of 0WBS_ELEMT.
0RECV_WBS_E__ZPSBUSA,0WBS_ELEMT__ZPSBUSA are the Navigational attributes of 0WBS_ELEMT, these two are maintained as Navigational attributes in the cube and at info object level. The Nav Attribute 0RECV_WBS_E__ZPSBUSA is not getting the data in infocube where as 0WBS_ELEMT__ZPSBUSA is getting the data .The data is available for the two Nav attributes in the info object 0WBS_ELEMT .Can you please suggest why this reference Nav attribute 0RECV_WBS_E__ZPSBUSA is not getting data in the infocube.
Thanks,
SUbhash
Edited by: MarkSubhash on Dec 9, 2011 11:11 AM -
Can not edit data labels in old graph chart objects using Word 2010
In Word 2010, Insert object "Microsoft Graph Chart", go to Chart Options and check an item in Data labels, such as "Series Name", "Category Name" or "Value". Click OK, then double-click on a data label to edit its
settings, or right-click on a data label and select "Format Data Labels..."
This makes Word to crash. The only way I can get out of it is by using the Task Manager to kill Word.
This happens in Windows 7 and Windows 8. This does NOT not happen in Word 2007 nor Word 2013, so it seems specific to Word 2010. All our clients have the same problem, this does not seem related to a specific workstation configuration.
The Microsoft Graph Chart are the old charts used within .doc files. I have an application still generating those types of files and need to edit data label settings manually before processing the files with my application.
Also note that anytime you edit a .doc file in Word 2010 and you see "Compatibility Mode" in the title bar, the Insert / Chart option from the ribbon inserts an old type chart (same as if you use Insert / Object / Microsoft Graph Chart), not the
new Word 2010 charts. You then have the same problem editing the data labels.
The underlying Activex seems to be the Chart.Exe file, the one I have installed is 14.0.7012.1000. You can see the version by double-clicking the chart and then look in the Help / About menu.
Any help will be greatly appreciated.As this is a configuration issue and not a programming issue I' moving your question to a more appropriate forum where you're more likely to find assistance.
Cindy Meister, VSTO/Word MVP,
my blog -
Not able to get the data from synchronous Webservice To BPEL process
Hi All,
My requirement is : Third party has some webservice.They are pushing data to that Webservice(Wsdl).
Third part WSDL example : http://ipaddress:port/name/Service.svc?wsdl ( This is just example format of their WSDL)
After that I need to get that data into my BPEL process and update my system.
When I built My Snchronous BPEL process I imported third party WSDL(http://ipaddress:port/name/Service.svc?wsdl) through 'import WSDL' in dialog.After that I automatically got the (request and response schema elements) parameters from that WSDL.I gave input and output of the BPEL process from those elements.
I pasted that third party URL iin SOAPUI and I got their operations and schemas.Based on that I had choosen the elements for 'input' and 'output' of the BPEL processes.I am also getting the schema structures in 'Assign' or 'Transform' activity.
I built the whole process.
I have the Process.
Now Client is pushing data to their WSDL(http://ipaddress:port/name/Service.svc?wsdl) as it is their data pushing interface.But that data is not coming to my BPEL process and instance is not being created in EM console.
As I have imported their WSDL into my BPEL process,I need to get the data.But I am not getting the data.
Is there any problem in MY BPEL process?
(or)
DO I need to use 'Webservice' Adapter in 'Exposed Services' Swimlane in Composite Editor to have the third party URL, so that they Can push the data to that WSDL in turn that data comes into my BPEL process?
Can anybody help me this case?
once again my requirement is :
Client pushes the data through their WSDL url -----> I need to get that data into MY BPEL process --> I have my own WSDl to take that details into my system.I will explain the requirement in small paragraph:
There are two applications.One is our application(X) and another one is third party application(Y).
I need to update in my application(X) based on data coming from application(Y).
I am using SOA as a middle tier to have communication between Y and X.
(Ex: if they send some info like event type 'event1' from Y ,I need to update that 'event1' data in my X application)
The work at third party application is :
According their info,They will push data from their end to their WSDL( http://ipaddress:port/name/Service.svc?wsdl ).
They are telling they can only send the data to their WSDL( http://ipaddress:port/name/Service.svc?wsdl ).
They will not consume our BPEL process(I think they might be wrong at this point of time).They have one WSDL to send or push the data from their end.
The work at from our side(SOA & X application)
From that point ,our BPEL process has to receive that data and update that data into my application(X).
I hope You understand my requirement.
Can you guide me through how to achieve this task as they are telling they have to use their WSDL to push the data?
(or)
Do I need to take 'Webservice' adapter into Exposed Services Swimlane in Jdeveloper to have their webservice(third party WSDL),If it is So Can you tell me the details how to take 'input' and 'output' for BPEL process?
(or)
Can YOu suggest me to talk to them to consume my BPEL process directly?
Thanks
Edited by: 899283 on Aug 17, 2012 4:55 AM -
Not able to get complete data in Heading of the smarform
Dear Friends,
I am devloping a smartform for my requiremnt, i am not able to get complete data jin Header Window ( i.e the Title Name of the company is not getting fully) when i execute the Smartform ,
Iam able to see only the last few words of the Text. Please help me what i should do in this regard
regards
madhuriHi
Also, check where the window is placed in the Form Painter...may be it is not on the page properly..and also check the size of the window..
Further, check the paragraph format that is used.
Regards,
Vishwa.
Edited by: Vishwa Sri Hari on Oct 15, 2008 1:21 PM -
Problem Using HTTP Dispatcher -- Could Not able to get the data in JSP
Hi, I am using HTTP Dispatcher to send my events to particular URL which is a JSP page. I am trying to populate the received event through URL and populate to a oracle data base. But could not able to get the data in Oracle database.
Code is :
<h1>JSP Page</h1>
<%
long type = 0;
String tagId = null;
String timeStr = "0";
String deviceName = "";
// Get Event Parameters
// Available Parameters: id, siteName, deviceName, data, time, type, subtype, sourceName, correlationId
try
type = Long.parseLong(request.getParameter("type")); // Get type
tagId = request.getParameter("id"); // Get tagId
timeStr = request.getParameter("time"); // Get time
deviceName = request.getParameter("deviceName");
catch (Exception e)
out.println( "Error: "+e.getMessage() );
// Write into DB.
try {
if ((tagId == null) || (type != 200) ){
// Do Nothing
//return;
} else {
OracleDataSource ods = new OracleDataSource();
String URL = "jdbc:oracle:thin:@//3.235.173.16:1525/vislocal";
ods.setURL(URL);
ods.setUser("cus");
ods.setPassword("cus");
Connection myConn = ods.getConnection();
Statement stmt = myConn.createStatement();
String selectQuery =
"SELECT MAX(rfid_raw_reads_id) as max_id FROM "+
"cus.rfid_raw_reads ";
ResultSet rs = stmt.executeQuery(selectQuery);
String maxId = "1";
if (rs.next()) {
maxId = rs.getString(1);
String selectMaxTagIDQuery =
"SELECT MAX(rfid_raw_reads_id) as max_id FROM "+
"cus.rfid_raw_reads WHERE tag_id = '" + tagId + "'" ;
stmt = myConn.createStatement();
rs = stmt.executeQuery(selectMaxTagIDQuery);
String maxTagId = "1";
if (rs.next()) {
maxTagId = rs.getString(1);
long primaryKey = 1;
long tagKey = 1;
try {
primaryKey = Long.parseLong(maxId) + 1;
tagKey = Long.parseLong(maxTagId) + 1;
} catch (Exception e) {
long currentTime = System.currentTimeMillis();
long updateKey = (tagKey - 1);
String updateQuery = " UPDATE cus.rfid_raw_reads SET read_end_time = " + currentTime + " WHERE rfid_raw_reads_id = " + updateKey;
Statement updateStmt = myConn.createStatement();
updateStmt.execute(updateQuery);
String query =
"INSERT INTO cus.rfid_raw_reads (rfid_raw_reads_id, tag_id,device_name,read_start_time) VALUES ("+ primaryKey + ",'" + tagId + "'," + deviceName + "'," + System.currentTimeMillis() + " )" ;
Statement insertStmt = myConn.createStatement();
insertStmt.execute(query);
myConn.commit();
myConn.close();
} catch (Exception e) {
%>
<p>For browser debug:
<%
out.println( "Type="+type+" ID="+tagId +" time="+timeStr );
%>
Kindly suggest where is the problem...
Thanks and regards
Mohammad Nasim AkhtarHI Prabhat,
Thanx for your reply, I worked out and able to receive the data in oracle database, Actually there was some problem in insert Query. Now I have tested the same... and able to edit the same in the Database.....
But I am facing a new problem, Http Dispatcher in SES console is displaying all the Events generated as well as event in Que but there is no events in the Event Send. I guess it is not able to send the events.....?????
Event statical is showing like this
Events Received: 0 (0.00/sec)
Events Generated: 311 (0.19/sec)
Events Sent: 2 (0.19/sec)
Queued Events: 309 (0.19/sec)
Kindly suggest where is the problem, Is it a JSP problem or OSES end problem.....
Thanks and regards
Nasim -
Here's how to do ALV (OO) with dynamic fcat, int table and editable data
Hi everybody
Here's a more useful approach to ALV grid with OO using dynamic table, data NOT from DDIC, dynamic FCAT and how to get changed lines from the grid when ENTER key is pressed.
It's really not too dificult but I think this is more useful than the ever present SFLIGHT methods from the demos.
This also defines a subclass of cl_gui_alv_grid so you can access the protected attributes / methods of that class.
You don't need to add the class via SE24 -- done fron this ABAP.
When you run it click Edit for the first time.
After editing data press ENTER and the break point should bring you into the relevant method.
Code developed on NW2004S trial version but also works on rel 6.40 on a "Real" system.
The code should work without any changes on any system >=6.40.
All you need to do is to create a blank screen 100 via SE51 with a custom container on it called CCONTAINER1.
The rest of the code can just be uploaded into your system using the SE38 upload facility.
When running the program click on the EDIT button to enable the edit functionality of the grid.
Change your data and when you press ENTER you should get the break-point where you can see the original table and changed rows.
This program is actually quite general as it covers Dynamic tables, building a dynamic fcat where your table fields are NOT in the DDIC, intercepting the ENTER key via using an event, and accessing the protected attributes of the cl_gui_alv_grid by defining a subclass of this class in the abap.
I've seen various questions relating to all these functions but none in my view ever answers the questions in a simple manner. I hope this simple program will answer all these and show how using OO ALV is actually quite easy and people shouldn't be scared of using OO.
Have fun and award points if useful.
Cheers
Jimbo.
<b>PROGRAM zdynfieldcat.
Simple test of dynamic ITAB with user defined (not ddic) fields
Build dynamic fcat
use ALV grid to display and edit.
*When edit mode set to 1 toolbar gives possibility of adding and
*deleting rows.
*Define subclass of cl_gui_alv_grid so we can use protected attributes
*and methods.
Add event handler to intercept user entering data and pressing the
*ENTER key.
When enter key is pressed get actual value of NEW table (all rows)
rather than just the changed data.
*use new RTTI functionality to retrieve internal table structure
*details.
Create a blank screen 100 with a custom container called CCONTAINER1.
James Hawthorne
include <icon>.
define any old internal structure NOT in DDIC
types: begin of s_elements,
anyfield1(20) type c,
anyfield2(20) type c,
anyfield3(20) type c,
anyfield4(20) type c,
anyfield5(11) type n,
end of s_elements.
types: lt_rows type lvc_t_roid.
Note new RTTI functionality allows field detail retrieval
at runtime for dynamic tables.
data: wa_element type s_elements ,
wa_data type s_elements,
c_index type sy-index,
c_dec2 type s_elements-anyfield5,
wa_it_fldcat type lvc_s_fcat,
it_fldcat type lvc_t_fcat,
lr_rtti_struc TYPE REF TO cl_abap_structdescr, "RTTI
lt_comp TYPE cl_abap_structdescr=>component_table,"RTTI
ls_comp LIKE LINE OF lt_comp, "RTTI
zog like line of lr_rtti_struc->components, "RTTI
struct_grid_lset type lvc_s_layo,
l_valid type c,
new_table type ref to data.
field-symbols: <dyn_table> type standard table,
<actual_tab> type standard table,
<fs1> type ANY,
<FS2> TYPE TABLE.
data: grid_container1 type ref to cl_gui_custom_container.
class lcl_grid_event_receiver definition deferred.
data: g_event_receiver type ref to lcl_grid_event_receiver.
data: ls_modcell type LVC_S_MODI,
stab type ref to data,
sdog type s_elements. .
class lcl_grid_event_receiver definition.
public section.
methods:
handle_data_changed
for event data_changed of cl_gui_alv_grid
importing er_data_changed,
toolbar for event toolbar of cl_gui_alv_grid
importing e_object
e_interactive,
user_command for event user_command of cl_gui_alv_grid
importing e_ucomm.
endclass.
*implementation of Grid event-handler class
class lcl_grid_event_receiver implementation.
method handle_data_changed.
code whatever required after data entry.
various possibilites here as you can get back Cell(s) changed
columns or the entire updated table.
Data validation is also possible here.
perform check_data using er_data_changed.
endmethod.
Method for handling all creation/modification calls to the toolbar
method toolbar.
data : ls_toolbar type stb_button.
Define Custom Button in the toolbar
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'EDIT' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'Edit' to ls_toolbar-text.
move icon_change_text to ls_toolbar-icon.
move 'Click2Edit' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'UPDA' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'Update' to ls_toolbar-text.
move icon_system_save to ls_toolbar-icon.
move 'Click2Update' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'EXIT' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'Exit' to ls_toolbar-text.
move icon_system_end to ls_toolbar-icon.
move 'Click2Exit' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
endmethod.
method user_command.
case e_ucomm .
when 'EDIT'. "From Tool bar
perform set_input.
perform init_grid.
when 'UPDA'. "From Tool bar
perform refresh_disp.
perform update_table.
when 'EXIT'. "From Tool bar
leave program.
endcase.
endmethod.
endclass.
class zcltest definition inheriting from cl_gui_alv_grid.
define this as a subclass so we can access the protected attributes
of the superclass cl_gui_alv_grid
public section.
methods: constructor, disp_tab.
endclass.
need this now to instantiate object
as we are using subclass rather than the main cl_gui_alv_grid.
class zcltest implementation.
METHOD constructor.
CALL METHOD super->constructor
exporting i_appl_events = 'X'
i_parent = grid_container1.
endmethod.
method disp_tab.
FIELD-SYMBOLS: <outtab> TYPE STANDARD TABLE.
break-point 1.
mt_outtab is the data table held as a protected attribute
in class cl_gui_alv_grid.
ASSIGN me->mt_outtab->* TO <outtab>. "Original data
do whatever you want with <outtab>
contains data BEFORE changes each time.
Note that NEW (Changed) table has been obtained already by
call to form check_data USING P_ER_DATA_CHANGED
TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
Entered data is in table defined by <fs2>
In this method you can compare original and changed data.
Easier than messing around with individual cells.
do what you want with data in <fs2> validate / update / merge etc
endmethod.
endclass.
data :
ok_code like sy-ucomm,
save_ok like sy-ucomm,
i4 type int4,
Container Object [grid_container]
now created via method constructor
in the subclass zcltest.
Control Object [grid]
grid1 type ref to zcltest,
Event-Handler Object [grid_handler]
grid_handler type ref to lcl_grid_event_receiver.
start-of-selection.
call screen 100.
module status_0100 output.
now display it as grid
if grid_container1 is initial.
create object grid_container1
exporting
container_name = 'CCONTAINER1'.
create object grid1.
break-point 1.
create object grid_handler.
set handler:
grid_handler->user_command for grid1,
grid_handler->toolbar for grid1,
grid_handler->handle_data_changed for grid1.
perform create_dynamic_fcat.
perform create_dynamic_itab.
perform populate_dynamic_itab.
perform init_grid.
perform register_enter_event.
set off ready for input initially
i4 = 0.
call method grid1->set_ready_for_input
exporting
i_ready_for_input = i4.
endif.
endmodule.
module user_command_0100 input.
*PAI not needed in OO ALV anymore as User Commands are handled as events
*in method user_command.
*we can also get control if the Data entered and the ENTER is pressed by
*raising an event.
Control then returns to method handle_data_changed.
endmodule.
form create_dynamic_fcat.
get structure of our user table for building field catalog
Use the RTTI functionality
lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( wa_data ).
Build field catalog just use basic data here
colour specific columns as well
loop at lr_rtti_struc->components into zog.
c_index = c_index + 1.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = zog-name .
wa_it_fldcat-datatype = zog-type_kind.
wa_it_fldcat-inttype = zog-type_kind.
wa_it_fldcat-intlen = zog-length.
wa_it_fldcat-decimals = zog-decimals.
wa_it_fldcat-lowercase = 'X'.
if c_index eq 2.
wa_it_fldcat-emphasize = 'C411'.
endif.
if c_index eq 3.
wa_it_fldcat-emphasize = 'C511'.
endif.
append wa_it_fldcat to it_fldcat .
endloop.
endform.
form create_dynamic_itab.
Create dynamic internal table and assign to field sysmbol.
Use dynamic field catalog just built.
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
endform.
form populate_dynamic_itab.
load up a line of the dynamic table
c_dec2 = c_dec2 + 11.
wa_element-anyfield1 = 'Tabbies'.
wa_element-anyfield2 = 'ger.shepards'.
wa_element-anyfield3 = 'White mice'.
wa_element-anyfield4 = 'Any old text'.
wa_element-anyfield5 = c_dec2.
append wa_element to <dyn_table>.
endform.
form check_data USING P_ER_DATA_CHANGED
TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
Get altered data back
ASSIGN p_er_data_changed->mp_mod_rows TO <FS1>.
stab = p_er_data_changed->mp_mod_rows.
ASSIGN STAB->* TO <FS2>.
LOOP AT <FS2> INTO sdog.
ALV grid display with altered data is now in <fs2>.
do any extra processing you want here
endloop.
now display new table
call method grid1->disp_tab.
endform.
form exit_program.
call method grid_container1->free.
call method cl_gui_cfw=>flush.
leave program.
endform.
form refresh_disp.
call method grid1->refresh_table_display.
endform.
form update_table.
The dynamic table here is the changed table read from the grid
after user has changed it
Data can be saved to DB or whatever.
loop at <dyn_table> into wa_element.
do what you want with the data here
endloop.
switch off edit mode again for next function
i4 = 0.
call method grid1->set_ready_for_input
exporting
i_ready_for_input = i4.
endform.
form set_input.
i4 = 1.
call method grid1->set_ready_for_input
exporting
i_ready_for_input = i4.
endform.
form switch_input.
if i4 = 1.
i4 = 0.
else.
i4 = 1.
endif.
call method grid1->set_ready_for_input
exporting
i_ready_for_input = i4.
endform.
form init_grid.
Enabling the grid to edit mode,
struct_grid_lset-edit = 'X'. "To enable editing in ALV
struct_grid_lset-grid_title = 'Jimbos Test'.
call method grid1->set_table_for_first_display
exporting
is_layout = struct_grid_lset
changing
it_outtab = <dyn_table>
it_fieldcatalog = it_fldcat.
endform.
form register_enter_event.
call method grid1->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
Instantiate the event or it won't work.
create object g_event_receiver.
set handler g_event_receiver->handle_data_changed for grid1.
endform.</b>Hi there
IE7 doesn't give me the add new page option and I get 404 error when trying to access the "How to contribute" section.
I'll load up Firefox later (this browser usually works when IE7 doesn't always work properly).
I'll copy the stuff to the wiki when I've got the browser sorted out.
Cheers
jimbp -
Editable data in excel view of alv grid
hi friends..
now i am displaying the data in alv grid..
my requirement is i want to display the data in excel format.. (not in seperate excel..)
i want to display the excel sheet with data within the screen itself.
for this
i tried this scenario by fallowing steps
in layout->view tab->microsoft excel..
(layout button in the application toolbar i.e pf-status)
it show excel sheet within report and data with excel sheet.
now i got data in excel sheet.
but my requirement is if i made any changes in data in excel means
i want those updated or edited data in the another internal table..
this scenario is work in the case of abap list viewer (instead of microsoft excel)
for this i use one button in the pf-status (UPDATE).
after made changes in grid data i export those modified data to abap memory and download to another internal table..
how can i get the same scenario in micosoft excelHi,
Please make sure that you have made a <b>global</b>
<b>declaration</b> for the ALV Grid control.If not try
with this
Please reward points if this explanation is useful.
Regards,
Siva -
How to get the date for the first monday of each month
Dear Members,
How to get the date for the first monday of each month.
I have written the following code
SELECT decode (to_char(trunc(sysdate+30 ,'MM'),'DAY'),'MONDAY ',trunc(sysdate+30 ,'MM'),NEXT_DAY(trunc(sysdate+30 ,'MM'), 'MON')) FROM DUAL
But it look bith complex.
Abhishek
Edited by: 9999999 on Mar 8, 2013 4:30 AMUse IW format - it will make solution NLS independent. And all you need is truncate 7<sup>th</sup> day of each month using IW:
select sysdate current_date,
trunc(trunc(sysdate,'mm') + 6,'iw') first_monday_the_month
from dual
CURRENT_D FIRST_MON
08-MAR-13 04-MAR-13
SQL> Below is list of first monday of the month for this year:
with t as(
select add_months(date '2013-1-1',level-1) dt
from dual
connect by level <= 12
select dt first_of_the_month,
trunc(dt + 6,'iw') first_monday_the_month
from t
FIRST_OF_ FIRST_MON
01-JAN-13 07-JAN-13
01-FEB-13 04-FEB-13
01-MAR-13 04-MAR-13
01-APR-13 01-APR-13
01-MAY-13 06-MAY-13
01-JUN-13 03-JUN-13
01-JUL-13 01-JUL-13
01-AUG-13 05-AUG-13
01-SEP-13 02-SEP-13
01-OCT-13 07-OCT-13
01-NOV-13 04-NOV-13
FIRST_OF_ FIRST_MON
01-DEC-13 02-DEC-13
12 rows selected.
SQL> SY. -
HI Guys,
In the BEX reports for the rows used the date and in the columns i have created a structue using the selections based on the KF. i have used the 29 KF in the structure. My problem i want to dispaly the data by spliting the key figures from 1-15 and 16-29 in the WAD for the tables and graphs
i did the settings for the tables as followed and getting the data correctly
Display data from value column = 1
Display data to value column = 15.
i want to apply the same settings for the graph.
Please help me where i need to do the settings for the series(legends).
Thanks,
Visu
Edited by: visu rao on Apr 9, 2008 5:45 PMHi Visu,
In Chart, you cannot have such option. You should have two same queries as such with 1 to 15 KF's in one query and 16 to 29 KF's (with structures) in second query with all other similar fields. Now use these two queries in two different charts with 15 categories in first chart and the other 14 categories in second chart. You can have the categories what ever you want... U just need to maintain in the query in the structure, the number of KF's... and the same number of categories in chart.
You can have the categories and series count in "Edit chart-->Wizard and Chart designer".
Assign points if this helps u...
Regards,
KK.
Maybe you are looking for
-
Does simple file and folder sharing on an iMac work with OSX Server?
Hi There I wonder if I should install OSX Server on an iMac wher several users work on the same files and folders. My question - before I do something I might regret: Does simple file and folder sharing on an iMac within several users really work wit
-
Yesterday Safari simply quit opening pages. Any of them. Even the most common, like Yahoo or Apple.com. I'll get the colored spinning wheel and then it times out. I've added no new software or made any updates to any. I've tried resetting it, clearin
-
What software will convert a NCOR file to other video formats?
Since Encore will only write to a disc, disc image, or Flash, what software will convert a NCOR file to other video formats?
-
Can I add a 'To' column in message lists?
When looking at sent items, I want to add a 'To' column in the message list so I can see who they were sent to but I can't see this option anywhere. Is it possible?
-
Flash Player won't upgrade/install in Firefox
Operating System: WinXP SP3 Browser: Firefox (primary), IE (secondary) Flash player stuck at 11.4.xx Downloaded "install_flashplayer11x32_mssd_aih.exe" Closed all browsers Ran upgrade and received the following error: Internet Explorer Script E