type-pools:slis.
data:inttab type standard table of zemptab1 with header line ,
int_tab type STANDARD TABLE OF zemptabtwo with header line,
in_tab type standard table of zemptabtwo with header line.
int_tab type STANDARD TABLE OF zemptabtwo with header line,
in_tab type standard table of zemptabtwo with header line.
data:fieldcat type slis_t_fieldcat_alv with header line,
fieldcat1 type slis_t_fieldcat_alv with header line.
fieldcat1 type slis_t_fieldcat_alv with header line.
select * from zemptab1 into corresponding fields of table inttab.
select * from zemptabtwo into corresponding fields of table int_tab.
perform buildfieldcat.
perform displayfieldcat.
FORM buildfieldcat.
fieldcat-fieldname = 'ID'.
fieldcat-seltext_m = 'EMPID'.
append fieldcat to fieldcat.
fieldcat-seltext_m = 'EMPID'.
append fieldcat to fieldcat.
fieldcat-fieldname = 'NAME'.
fieldcat-seltext_m = 'EMPNAME'.
append fieldcat to fieldcat.
fieldcat-seltext_m = 'EMPNAME'.
append fieldcat to fieldcat.
fieldcat-fieldname = 'QUALIFICATION'.
fieldcat-seltext_m = 'QUAL'.
append fieldcat to fieldcat.
fieldcat-seltext_m = 'QUAL'.
append fieldcat to fieldcat.
fieldcat-fieldname = 'CITY'.
fieldcat-seltext_m = 'CITY'.
APPEND fieldcat to fieldcat.
fieldcat-seltext_m = 'CITY'.
APPEND fieldcat to fieldcat.
fieldcat-fieldname = 'AGE'.
fieldcat-seltext_m = 'AGE'.
APPEND fieldcat to fieldcat.
fieldcat-seltext_m = 'AGE'.
APPEND fieldcat to fieldcat.
ENDFORM. "buildfileldcat
FORM displayfieldcat .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_USER_COMMAND = 'USECOMMAND'
IT_FIELDCAT = FIELDCAT[]
TABLES
t_outtab = int_tab.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. "displayfieldcat
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_USER_COMMAND = 'USECOMMAND'
IT_FIELDCAT = FIELDCAT[]
TABLES
t_outtab = int_tab.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. "displayfieldcat
FORM USECOMMAND USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield .
case r_ucomm.
WHEN '&IC1'.
READ TABLE int_tab INDEX
rs_selfield-tabindex.
WHEN '&IC1'.
READ TABLE int_tab INDEX
rs_selfield-tabindex.
IF sy-subrc EQ 0.
"loop at int_tab where id eq rs_selfield.
in_tab-id = int_tab-id.
in_tab-dcode = int_tab-dcode.
in_tab-desig = int_tab-desig.
in_tab-exp = int_tab-exp.
append in_tab.
endif.
endcase.
" endloop.
"loop at int_tab where id eq rs_selfield.
in_tab-id = int_tab-id.
in_tab-dcode = int_tab-dcode.
in_tab-desig = int_tab-desig.
in_tab-exp = int_tab-exp.
append in_tab.
endif.
endcase.
" endloop.
clear fieldcat.
refresh fieldcat.
refresh fieldcat.
perform build_fieldcat.
perform display_fieldcat.
ENDFORM. "USECOMMAND
FORM build_fieldcat.
fieldcat-fieldname = 'DCODE'.
fieldcat-seltext_m = 'Desigcode'.
append fieldcat.
fieldcat-seltext_m = 'Desigcode'.
append fieldcat.
fieldcat-fieldname = 'ID'.
fieldcat-seltext_m = 'EMPID'.
APPEND fieldcat to fieldcat.
fieldcat-seltext_m = 'EMPID'.
APPEND fieldcat to fieldcat.
fieldcat-fieldname = 'DESIG'.
fieldcat-seltext_m = 'Designation'.
append fieldcat to fieldcat.
fieldcat-seltext_m = 'Designation'.
append fieldcat to fieldcat.
fieldcat-fieldname = 'EXP'.
fieldcat-seltext_m = 'EXPERIENCE'.
append fieldcat to fieldcat.
fieldcat-seltext_m = 'EXPERIENCE'.
append fieldcat to fieldcat.
ENDFORM. "build_fieldcat
FORM display_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IT_FIELDCAT = fieldcat[]
TABLES
t_outtab = in_tab
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. "display_fieldcat
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IT_FIELDCAT = fieldcat[]
TABLES
t_outtab = in_tab
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. "display_fieldcat
ALSO READ:
- Capture Single & Multiple Row Selction In ALV Report Program.
- Coloring A Row & Column In ALV Display Using OOPS Concept.
- Create Unique Handle For ALV Layout (Variant).
- Customizing Toolbar In ALV Tree Using ABAP OO.
..... Back To Index On ALV List/ Grid Display.
..... Back To MAIN INDEX.
No comments:
Post a Comment