2006 Jun 15 8:51 AM
i use this FM
after i make f8 and i have the output i canot choose more the 1 row why?
what i did rong.
2006 Jun 15 8:54 AM
Hi Rani,
I hope it helps.
REPORT zjv_hrhap_final .
TYPE-POOLS: slis.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: g_repid LIKE sy-repid.
DATA: gs_layout TYPE slis_layout_alv.
DATA: gt_events TYPE slis_t_event.
DATA: gc_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA gc_user_command TYPE slis_formname VALUE 'USER_COMMAND'.
DATA: gs_sort TYPE slis_t_sortinfo_alv.
.
DATA : i_hrhap TYPE hrhap_final OCCURS 0 WITH HEADER LINE .
DATA : cnt TYPE i.
For Child Table
DATA : t_final TYPE hap_t_db_final.
SELECT * FROM hrhap_final INTO TABLE i_hrhap.
DELETE ADJACENT DUPLICATES FROM i_hrhap COMPARING appraisal_id .
DESCRIBE TABLE i_hrhap LINES cnt .
*WRITE : /10 'Number of Records:::', cnt .
*ULINE.
PERFORM fieldcat_init USING gt_fieldcat[].
g_repid = sy-repid .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = g_repid
I_CALLBACK_PF_STATUS_SET = ''
i_callback_user_command = gc_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 = 'ALV_BACKGROUND'
i_grid_title = 'Appraisal Templates'
I_GRID_SETTINGS =
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = gs_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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = i_hrhap
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 fieldcat_init
&----
text
----
-->P_GT_FIELDCAT[] text
----
FORM fieldcat_init USING lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
DATA pos TYPE i VALUE 0.
pos = pos + 1.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-tabname = 'I_HRHAP'.
ls_fieldcat-fieldname = 'COLUMN_ID'.
ls_fieldcat-seltext_m = 'COLUMN ID.'.
APPEND ls_fieldcat TO lt_fieldcat.
pos = pos + 1.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-tabname = 'I_HRHAP'.
ls_fieldcat-fieldname = 'APPRAISAL_ID'.
ls_fieldcat-seltext_m = 'APPRAISAL ID.'.
APPEND ls_fieldcat TO lt_fieldcat.
pos = pos + 1.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-tabname = 'I_HRHAP'.
ls_fieldcat-fieldname = 'ROW_IID'.
ls_fieldcat-seltext_m = ' ROW ID.'.
APPEND ls_fieldcat TO lt_fieldcat.
ENDFORM. " fieldcat_init
&----
*& Form user_command
&----
text
----
-->U_UCOMM text
-->US_SELFIELDtext
*----
FORM user_command USING u_ucomm LIKE sy-ucomm
us_selfield TYPE slis_selfield. "#EC CALLED
CASE u_ucomm
.
WHEN '&IC1'.
READ TABLE i_hrhap INDEX us_selfield-tabindex.
GETTING APPRAISAL SCORES FOR THE TEMPLATE ************
CALL FUNCTION 'HRHAP_DOC_FINAL_READ'
EXPORTING
plan_version = '01'
appraisal_id = I_HRHAP-APPRAISAL_ID
IMPORTING
T_FINAL = T_FINAL .
EXCEPTIONS
NO_ENTRY_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.
CLEAR GT_FIELDCAT.
PERFORM fieldcat_score USING gt_fieldcat[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = g_repid
I_CALLBACK_PF_STATUS_SET = ''
i_callback_user_command = gc_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 = 'ALV_BACKGROUND'
i_grid_title = 'Appraisal Scores'
I_GRID_SETTINGS =
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = gs_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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = t_final
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.
ENDCASE.
ENDFORM. "USER_COMMAND
&----
*& Form fieldcat_score
&----
text
----
-->P_GT_FIELDCAT[] text
----
FORM fieldcat_score USING lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
DATA pos TYPE i VALUE 0.
pos = pos + 1.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-tabname = 'T_FINAL'.
ls_fieldcat-fieldname = 'ROW_IID'.
ls_fieldcat-seltext_m = 'ROW ID.'.
APPEND ls_fieldcat TO lt_fieldcat.
pos = pos + 1.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-tabname = 'T_FINAL'.
ls_fieldcat-fieldname = 'COLUMN_ID'.
ls_fieldcat-seltext_m = 'COLUMN ID.'.
APPEND ls_fieldcat TO lt_fieldcat.
pos = pos + 1.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-tabname = 'T_FINAL'.
ls_fieldcat-fieldname = 'VALUE_NUM'.
ls_fieldcat-seltext_m = ' VALUE NUM.'.
APPEND ls_fieldcat TO lt_fieldcat.
pos = pos + 1.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-tabname = 'T_FINAL'.
ls_fieldcat-fieldname = 'VALUE_NNV'.
ls_fieldcat-seltext_m = ' VALUE NNV.'.
APPEND ls_fieldcat TO lt_fieldcat.
Rgds,
Jothi.
P.S : Mark useful answers.
2006 Jun 15 9:00 AM
2006 Jun 15 8:57 AM
2006 Jun 15 8:57 AM
Hi Rani,
<b>1</b>.
Have a look at the sample program.It works fine .
<b>2</b>.
REPORT zvenkat_head MESSAGE-ID zmsg .
TYPE-POOLS :slis.
DATA: BEGIN OF i_pa0000 OCCURS 0,
select TYPE c,
pernr TYPE pa0000-pernr,
endda TYPE pa0000-endda,
begda TYPE pa0000-begda,
massn TYPE pa0000-massn,
stat1 TYPE pa0000-stat1,
stat2 TYPE pa0000-stat2,
END OF i_pa0000.
DATA:i_fieldcat TYPE slis_t_fieldcat_alv,
w_fieldcat LIKE LINE OF i_fieldcat,
w_layout TYPE slis_layout_alv.
START-OF-SELECTION.
PERFORM get_data_from_db.
END-OF-SELECTION.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_data.
&----
*& Form get_data_from_db
&----
FORM get_data_from_db .
SELECT pernr endda begda massn stat1 stat2
INTO CORRESPONDING FIELDS OF TABLE i_pa0000
FROM pa0000
UP TO 20 ROWS.
ENDFORM. " get_data_from_db
&----
*& Form build_fieldcatalog
&----
FORM build_fieldcatalog .
CLEAR :w_fieldcat,
i_fieldcat.
w_fieldcat-fieldname = 'PERNR'.
w_fieldcat-seltext_m = 'PERNR'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'ENDDA'.
w_fieldcat-seltext_m = 'ENDDA'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'BEGDA'.
w_fieldcat-seltext_m = 'BEGDA'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'MASSN'.
w_fieldcat-seltext_m = 'MASSN'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'STAT1'.
w_fieldcat-seltext_m = 'STAT1'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'STAT2'.
w_fieldcat-seltext_m = 'STAT2'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " build_fieldcatalog
&----
*& Form display_data
&----
FORM display_data .
DATA :program LIKE sy-repid VALUE sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = program
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_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 = w_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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = i_pa0000
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 build_layout
&----
FORM build_layout .
w_layout-box_fieldname = 'SELECT'.
w_layout-box_tabname = 'I_PA0000'.
ENDFORM. " build_layout
I am sure it solves ur problem
<b>Thanks,
Venkat.O</b>
2006 Jun 15 9:13 AM
Hi again,
1. To get a taste of it,
just copy paste this program.
2. It will display alv (t001)
and There we can select multiple
3.
REPORT abc.
TYPE-POOLS : slis.
*----
Data
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : flag tyPE c,
END OF itab.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvly TYPE slis_layout_alv.
*----
Select Data
SELECT * FROM t001 INTO TABLE itab.
*------- Field Catalogue
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
*----
Display
alvly-box_fieldname = 'FLAG'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid "<-------Important
i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important
is_layout = alvly
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
*----
CALL BACK FORM
*----
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
LOOP AT itab.
itab-flag = 'X'.
MODIFY itab.
ENDLOOP.
*----
IMPORTANT.
WHATROW-REFRESH = 'X'.
ENDFORM. "ITAB_user_command
regards,
amit m.
2006 Jun 15 9:18 AM
Hai Rani
&----
*& Report ZALV_SAMP *
*& *
&----
*& *
*& *
&----
REPORT ZALV_SAMP .
TABLES: MARA.
TYPE-POOLS : SLIS.
*----
Data declaration
*----
DATA: BEGIN OF I_MARA OCCURS 0.
INCLUDE STRUCTURE MARA.
DATA: END OF I_MARA.
DATA: V_REPID LIKE SY-REPID.
*----
selection-screen
*----
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
PARAMETERS: P_MTART LIKE MARA-MTART DEFAULT 'ROH'.
SELECTION-SCREEN END OF BLOCK B1.
*----
initialisation
*----
INITIALIZATION.
S_MATNR-LOW = '1400'.
S_MATNR-HIGH = '1500'.
APPEND S_MATNR.
V_REPID = SY-REPID.
*----
start-of-selection
*----
START-OF-SELECTION.
SELECT * FROM MARA
INTO TABLE I_MARA
WHERE MATNR IN S_MATNR AND
MTART = P_MTART.
CHECK SY-SUBRC = 0.
*----
end of selection
*----
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'MARA'
IS_LAYOUT =
IT_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
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at i_mara.
write:/ i_mara.
endloop.
Thanks & regards
Sreenivasulu P