| Home • Tips • Tutorials • Sample Specs • Certification Q's • Interview Q's • Jobs • Testimonials • Contact Us | ||
Document Categories:
What's New?
Contribute?What's Hot? |
ALV in a Pop up window and ALV in a dialog boxBy Swarna S, Tata Consultancy Services *AS : User selects infotypes from a pop up alv .The details of *infotypes selected are displayed in a ALV dialog box. *author : Swarna.S. *Published at SAPTechnical.COM REPORT ZALV_POPDIALOG. *Type pools for ALV declarations TYPE-POOLS : slis. *Internal table and wa declarations for T582A. DATA : it_t582a TYPE STANDARD TABLE OF t582a INITIAL SIZE 0,
wa_t582a TYPE t582a.
*Internal table and wa declarations for T582S. DATA : it_text TYPE STANDARD TABLE OF t582s,
wa_text TYPE t582s.
*Structure declaration for output
TYPES : BEGIN OF ty_output,
infty TYPE infty,
zeitb TYPE dzeitb,
itext TYPE intxt,
pnnnn TYPE pnnnn_d,
dname TYPE dianm,
namst TYPE namst,
edynr TYPE edynp,
ldynr TYPE ldynp,
stypt TYPE stypt,
sytxt TYPE sytxt,
zbtab TYPE dzbtab,
checkbox(1),
END OF ty_output.
*Internal table and work area declaration for output in pop up
DATA : it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
wa_output TYPE ty_output.
*Internal table and workarea declaration for alv dialog display
DATA : it_display TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
wa_display TYPE ty_output.
*data declarations for ALV DATA:ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
ls_fieldcatlog TYPE slis_fieldcat_alv,
lt_fieldcatlog TYPE slis_t_fieldcat_alv,
lt_layout TYPE slis_layout_alv.
*Initialization event INITIALIZATION. *Start of selection event START-OF-SELECTION. *Select to fetch all the infotypes and details in sap system
SELECT *
FROM t582a
INTO CORRESPONDING FIELDS OF TABLE it_t582a.
*Select to fetch the infotypes text IF it_t582a[] IS NOT INITIAL. SELECT * FROM t582s INTO CORRESPONDING FIELDS OF TABLE it_text
FOR ALL ENTRIES IN it_t582a WHERE infty = it_t582a-infty
AND sprsl = 'E'.
ENDIF. *Appending the selected values to the output table LOOP AT it_t582a INTO wa_t582a. wa_output-infty = wa_t582a-infty.
wa_output-zeitb = wa_t582a-zeitb.
wa_output-pnnnn = wa_t582a-pnnnn.
wa_output-dname = wa_t582a-dname.
wa_output-namst = wa_t582a-namst.
wa_output-edynr = wa_t582a-edynr.
wa_output-ldynr = wa_t582a-ldynr.
wa_output-stypt = wa_t582a-stypt.
wa_output-sytxt = wa_t582a-sytxt.
wa_output-zbtab = wa_t582a-zbtab.
READ TABLE it_text INTO wa_text WITH KEY infty = wa_t582a-infty. wa_output-itext = wa_text-itext. APPEND wa_output TO it_output.
CLEAR wa_output.
ENDLOOP. *Subroutine to display the pop up values. PERFORM popup_display. *Subroutine to display the ALV dialog display PERFORM alv_output. *----------------------------------------------------------------* * Form popup_display *------------------------------------------------------------* FORM popup_display. *field catalogue for pop up CLEAR ls_fieldcat. ls_fieldcat-row_pos = '1'. ls_fieldcat-col_pos = '1'. ls_fieldcat-fieldname = 'CHECKBOX'. ls_fieldcat-tabname = 'IT_OUTPUT'. ls_fieldcat-seltext_m = 'SELECT'. APPEND ls_fieldcat TO lt_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-row_pos = '1'. ls_fieldcat-col_pos = '2'. ls_fieldcat-fieldname = 'ITEXT'. ls_fieldcat-tabname = 'IT_OUTPUT'. ls_fieldcat-seltext_m = 'DESCRIPTION'. ls_fieldcat-outputlen = 50. APPEND ls_fieldcat TO lt_fieldcat. * Display data in a POPUP
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_zebra = 'X'
it_fieldcat = lt_fieldcat
i_tabname = 'IT_OUTPUT'
i_checkbox_fieldname = 'CHECKBOX'
TABLES
t_outtab = it_output.
*Appending the selected infotypes only to internal table LOOP AT it_output INTO wa_output WHERE checkbox = 'X'. wa_display-itext = wa_output-itext.
wa_display-infty = wa_output-infty.
wa_display-zeitb = wa_output-zeitb.
wa_display-pnnnn = wa_output-pnnnn.
wa_display-dname = wa_output-dname.
wa_display-namst = wa_output-namst.
wa_display-edynr = wa_output-edynr.
wa_display-ldynr = wa_output-ldynr.
wa_display-sytxt = wa_output-sytxt.
wa_display-stypt = wa_output-stypt.
wa_display-zbtab = wa_output-zbtab.
APPEND wa_display TO it_display.
CLEAR wa_display.
ENDLOOP. ENDFORM. " popup_display *&-------------------------------------------------------------* *& Form alv_output *&-------------------------------------------------------------* FORM alv_output . *fieldcatalogue for ALV dialog PERFORM build_fieldcat. *Layout for ALV dialog PERFORM build_layout. **ALV dialog output PERFORM alv. ENDFORM. " alv_output *&------------------------------------------------------------* *& Form build_fieldcat *&------------------------------------------------------------* FORM build_fieldcat . *fieldcatalogue for alv dialog CLEAR ls_fieldcatlog. ls_fieldcatlog-row_pos = '1'. ls_fieldcatlog-col_pos = '1'. ls_fieldcatlog-fieldname = 'INFTY'. ls_fieldcatlog-tabname = 'IT_DISPLAY'. ls_fieldcatlog-seltext_m = 'Infotype'. APPEND ls_fieldcatlog TO lt_fieldcatlog. CLEAR ls_fieldcatlog. ls_fieldcatlog-row_pos = '1'. ls_fieldcatlog-col_pos = '2'. ls_fieldcatlog-fieldname = 'ITEXT'. ls_fieldcatlog-tabname = 'IT_DISPLAY'. ls_fieldcatlog-seltext_m = 'Description'. APPEND ls_fieldcatlog TO lt_fieldcatlog. CLEAR ls_fieldcatlog. ls_fieldcatlog-row_pos = '1'. ls_fieldcatlog-col_pos = '3'. ls_fieldcatlog-fieldname = 'ZEITB'. ls_fieldcatlog-tabname = 'IT_DISPLAY'. ls_fieldcatlog-seltext_m = 'TimeConstraint'. APPEND ls_fieldcatlog TO lt_fieldcatlog. CLEAR ls_fieldcatlog. ls_fieldcatlog-row_pos = '1'. ls_fieldcatlog-col_pos = '4'. ls_fieldcatlog-fieldname = 'PNNNN'. ls_fieldcatlog-tabname = 'IT_DISPLAY'. ls_fieldcatlog-seltext_m = 'Structure'. APPEND ls_fieldcatlog TO lt_fieldcatlog. CLEAR ls_fieldcatlog. ls_fieldcatlog-row_pos = '1'. ls_fieldcatlog-col_pos = '5'. ls_fieldcatlog-fieldname = 'DNAME'. ls_fieldcatlog-tabname = 'IT_DISPLAY'. ls_fieldcatlog-seltext_m = 'DialogModule'. APPEND ls_fieldcatlog TO lt_fieldcatlog. CLEAR ls_fieldcatlog. ls_fieldcatlog-row_pos = '1'. ls_fieldcatlog-col_pos = '6'. ls_fieldcatlog-fieldname = 'NAMST'. ls_fieldcatlog-tabname = 'IT_DISPLAY'. ls_fieldcatlog-seltext_m = 'Subtypefield'. APPEND ls_fieldcatlog TO lt_fieldcatlog. CLEAR ls_fieldcatlog. ls_fieldcatlog-row_pos = '1'. ls_fieldcatlog-col_pos = '7'. ls_fieldcatlog-fieldname = 'EDYNR'. ls_fieldcatlog-tabname = 'IT_DISPLAY'. ls_fieldcatlog-seltext_m = 'Singlescreenno'. APPEND ls_fieldcatlog TO lt_fieldcatlog. CLEAR ls_fieldcatlog. ls_fieldcatlog-row_pos = '1'. ls_fieldcatlog-col_pos = '8'. ls_fieldcatlog-fieldname = 'LDYNR'. ls_fieldcatlog-tabname = 'IT_DISPLAY'. ls_fieldcatlog-seltext_m = 'Listscreenno'. APPEND ls_fieldcatlog TO lt_fieldcatlog. CLEAR ls_fieldcatlog. ls_fieldcatlog-row_pos = '1'. ls_fieldcatlog-col_pos = '9'. ls_fieldcatlog-fieldname = 'STYPT'. ls_fieldcatlog-tabname = 'IT_DISPLAY'. ls_fieldcatlog-seltext_m = 'SubtypTable'. APPEND ls_fieldcatlog TO lt_fieldcatlog. CLEAR ls_fieldcatlog. ls_fieldcatlog-row_pos = '1'. ls_fieldcatlog-col_pos = '10'. ls_fieldcatlog-fieldname = 'SYTXT'. ls_fieldcatlog-tabname = 'IT_DISPLAY'. ls_fieldcatlog-seltext_m = 'Subtyptexttable'. APPEND ls_fieldcatlog TO lt_fieldcatlog. CLEAR ls_fieldcatlog. ls_fieldcatlog-row_pos = '1'. ls_fieldcatlog-col_pos = '11'. ls_fieldcatlog-fieldname = 'ZBTAB'. ls_fieldcatlog-tabname = 'IT_DISPLAY'. ls_fieldcatlog-seltext_m = 'SubtypeTCTable'. APPEND ls_fieldcatlog TO lt_fieldcatlog. ENDFORM. " build_fieldcat *&----------------------------------------------------------* *& Form build_layout *&----------------------------------------------------------* *Layout for ALV dialog FORM build_layout . lt_layout-zebra = 'X'. lt_layout-colwidth_optimize = 'X'. ENDFORM. " build_layout *&---------------------------------------------------------------* *& Form alv *&---------------------------------------------------------------* *Alv dialog output. FORM alv . CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_grid_title = 'INFOTYPE DETAILS'
is_layout = lt_layout
it_fieldcat = lt_fieldcatlog
i_screen_start_column = 10
i_screen_start_line = 20
i_screen_end_column = 100
i_screen_end_line = 40
TABLES
t_outtab = it_display
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 Pop up ALV to select infotype
ALV as dialog box to display the infotype details
|
|
|
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM Home • Contribute • About Us • Privacy • Terms Of Use • Disclaimer • Safe • Companies: Advertise on SAPTechnical.COM | Post Job • Contact Us ©2006-2007 SAPTechnical.COM. All rights reserved. All
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG. Graphic Design by Round the Bend Wizards |
||