2006 Jun 21 8:54 AM
Hi,
I'm writing an ALV report pgm. How do I create pf_status ? (as it's an export parameter in the function 'REUSE_ALV_GRID_DISPLAY'.
Thanks,
Ananda
2006 Jun 21 8:59 AM
write a form & in that write SET PF-STATUS.
GIVE That form name in the function module call.runtime this PF status will be assigned to your program.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
<b> i_callback_pf_status_set = 'F_SET_PF_STATUS'</b>
i_callback_user_command = p_user_command
is_layout = wa_layout
it_fieldcat = it_fieldcat[]
it_excluding = it_extab[]
it_sort = it_sort[]
TABLES
t_outtab = p_zbcar50
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.
&----
*& Form F_SET_PF_STATUS
&----
Set PF_STATUS STANDARD modifying the standard toolbar
by excluding some buttons
----
-->P_IT_EXTAB -- TABLE OF EXCLUDING FUNCTIONS
----
FORM f_set_pf_status USING rt_extab TYPE slis_t_extab.
CLEAR : wa_extab,
it_extab.
*--Set the Modified PF status for the ALV.
SET PF-STATUS 'STATUS_01' EXCLUDING rt_extab.
*--here you have to define STATUS_01 in SE41. if you want to exclude any existing function codes in this pf status,populate them in RT_EXTAB.
ENDFORM. " SET_PF_STATUS
Message was edited by: Srikanth Kidambi
Message was edited by: Srikanth Kidambi
Hi,
I'm writing an ALV report pgm. How do I create pf_status ? (as it's an export parameter in the function 'REUSE_ALV_GRID_DISPLAY'.
Thanks,
Ananda
2006 Jun 21 8:59 AM
write a form & in that write SET PF-STATUS.
GIVE That form name in the function module call.runtime this PF status will be assigned to your program.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
<b> i_callback_pf_status_set = 'F_SET_PF_STATUS'</b>
i_callback_user_command = p_user_command
is_layout = wa_layout
it_fieldcat = it_fieldcat[]
it_excluding = it_extab[]
it_sort = it_sort[]
TABLES
t_outtab = p_zbcar50
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.
&----
*& Form F_SET_PF_STATUS
&----
Set PF_STATUS STANDARD modifying the standard toolbar
by excluding some buttons
----
-->P_IT_EXTAB -- TABLE OF EXCLUDING FUNCTIONS
----
FORM f_set_pf_status USING rt_extab TYPE slis_t_extab.
CLEAR : wa_extab,
it_extab.
*--Set the Modified PF status for the ALV.
SET PF-STATUS 'STATUS_01' EXCLUDING rt_extab.
*--here you have to define STATUS_01 in SE41. if you want to exclude any existing function codes in this pf status,populate them in RT_EXTAB.
ENDFORM. " SET_PF_STATUS
Message was edited by: Srikanth Kidambi
Message was edited by: Srikanth Kidambi
2006 Jun 21 9:03 AM
Hi,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
<b>I_CALLBACK_PF_STATUS_SET = 'POPUP'</b>
I_CALLBACK_USER_COMMAND = 'HANDLE_USER_COMMAND'
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*&----
*& Form POPUP
*&----
FORM POPUP USING P_EXTAB TYPE SLIS_T_EXTAB.
*- Pf status
SET PF-STATUS 'POPUP'.
ENDFORM. " POPUP
Thanks,
Pramod
2006 Jun 21 9:04 AM
Hi Herath,
<b>1</b>.
First Define table for events
Data :
i_events TYPE slis_t_event,
w_events LIKE LINE OF i_events.
<b>2</b>.
Fill the events table like this
w_events-form = 'PF_STATUS_SET'.
w_events-name = 'PF_STATUS_SET'.
APPEND w_events TO i_events.
CLEAR w_events.
<b>3</b>.
Pass this event table through 'REUSE_ALV_GRID_DISPLAY' FM
<b>4</b>.
Have a look at this example .
&----
*& Report ZORAY1234 *
*& *
&----
REPORT zoray1234 .
TABLES :mard .
TYPE-POOLS :slis.
DATA: BEGIN OF i_mard OCCURS 0,
checkbox TYPE c ,
matnr TYPE mard-matnr,
werks TYPE mard-werks,
lgort TYPE mard-lgort,
labst TYPE mard-labst,
END OF i_mard.
DATA :i_field TYPE slis_t_fieldcat_alv,
w_field LIKE LINE OF i_field,
i_events TYPE slis_t_event,
w_events LIKE LINE OF i_events.
START-OF-SELECTION.
PERFORM get_data.
PERFORM build_field.
PERFORM build_events.
PERFORM display_data.
&----
*& Form get_data
&----
FORM get_data .
SELECT matnr werks lgort labst
FROM mard
INTO CORRESPONDING FIELDS OF TABLE i_mard
WHERE werks = 'NB4'.
ENDFORM. " get_data
&----
*& Form build_field
&----
FORM build_field .
CLEAR w_field.
CLEAR i_field.
w_field-fieldname = 'CHECKBOX'.
w_field-tabname = 'I_MARD'.
w_field-checkbox = 'X'.
w_field-input = 'X'.
w_field-seltext_m = 'Checkbox'.
APPEND w_field TO i_field.
CLEAR w_field.
w_field-fieldname = 'MATNR'.
w_field-tabname = 'I_MARD'.
w_field-seltext_m = 'Matnr'.
APPEND w_field TO i_field.
CLEAR w_field.
w_field-fieldname = 'WERKS'.
w_field-tabname = 'I_MARD'.
w_field-seltext_m = 'Werks'.
APPEND w_field TO i_field.
CLEAR w_field.
w_field-fieldname = 'LGORT'.
w_field-tabname = 'I_MARD'.
w_field-seltext_m = 'Lgort'.
APPEND w_field TO i_field.
CLEAR w_field.
w_field-fieldname = 'LABST'.
w_field-tabname = 'I_MARD'.
w_field-seltext_m = 'Labst'.
APPEND w_field TO i_field.
CLEAR w_field.
ENDFORM. " build_field
&----
*& Form display_data
&----
FORM display_data .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = 'ZORAY1234'
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
I_STRUCTURE_NAME =
IS_LAYOUT =
it_fieldcat = i_field
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = i_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
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = i_mard
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. " display_data
&----
*& Form set_pf_status
&----
FORM PF_STATUS_SET USING extab TYPE slis_t_extab.
SET PF-STATUS 'VENKAT' EXCLUDING extab.
ENDFORM. "set_pf_status
&----
*& Form user_command
&----
text
----
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield .
CASE ucomm.
WHEN 'BUTTON' .
LOOP AT i_mard WHERE checkbox = 'X'.
WRITE 😕 i_mard-matnr,
i_mard-werks,
i_mard-lgort,
i_mard-labst.
ENDLOOP.
WHEN 'BUTTON1'.
LOOP AT i_mard WHERE checkbox = 'X'.
WRITE 😕 i_mard-matnr,
i_mard-werks,
i_mard-lgort,
i_mard-labst.
ENDLOOP.
ENDCASE.
ENDFORM. "user_command
&----
*& Form build_events
&----
FORM build_events .
CLEAR i_events.
CLEAR i_events.
w_events-form = 'PF_STATUS_SET'.
w_events-name = 'PF_STATUS_SET'.
APPEND w_events TO i_events.
CLEAR w_events.
w_events-form = 'USER_COMMAND'.
w_events-name = 'USER_COMMAND'.
APPEND w_events TO i_events.
CLEAR w_events.
ENDFORM. " build_events
I hope that it helps u .
<b>Thanks,
Venkat.O</b>