2019 Sep 03 10:59 AM
Hi all,
If I press the ADD entry button in ALV i want all the field in editable mode (note : Before that some fields are noneditable mode) I am using the ALV reuse grid display method. Can u provide the solution for this method.
2019 Sep 03 11:41 AM
Hi,
explain what you are going to perform after adding ADD button?
2019 Sep 03 1:56 PM
Find the below sample code. in menu painter create edit button in application toolbar.
REPORT ZALVDYNAMICEDIT.
TYPE-POOLS: SLIS.
DATA: I_MARA TYPE TABLE OF MARA,
W_MARA TYPE MARA,
I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
W_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
START-OF-SELECTION.
PERFORM GETDATA.
PERFORM FIELDCATALOG.
PERFORM DISPLAY.
*&---------------------------------------------------------------------*
*& Form GETDATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GETDATA .
SELECT * UP TO 10 ROWS FROM MARA INTO TABLE I_MARA.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FIELDCATALOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FIELDCATALOG .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
* I_PROGRAM_NAME =
* I_INTERNAL_TABNAME =
I_STRUCTURE_NAME = 'MARA'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_INCLNAME =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = I_FIELDCAT
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISPLAY .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'FORM_MENU'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
IT_FIELDCAT = I_FIELDCAT
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = I_MARA
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
FORM FORM_MENU USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'MENU'.
ENDFORM.
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&F3'.
LEAVE TO SCREEN 0.
WHEN 'EDIT'.
PERFORM FEDIT.
ENDCASE.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FEDIT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FEDIT .
LOOP AT I_FIELDCAT INTO W_FIELDCAT.
W_FIELDCAT-EDIT = 'X'.
MODIFY I_FIELDCAT FROM W_FIELDCAT.
CLEAR W_FIELDCAT.
ENDLOOP.
PERFORM DISPLAY.
ENDFORM.