Triggerring ALV-pop up
Hi all,
How to trigger a pop-up alv report upono double click on a row in a report developed using OO ALV.
Do i need to trigger any method and call fm REUSE ALV POP UP? Please help!
Helpful answers will be rewarded.
Thanks,
Sandeep
Hi Sandeep,
This might help:
User selects infotypes from a pop up alv .The details of
*infotypes selected are displayed in a ALV dialog box.
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
Similar Messages
-
How to select multiple records in the ALV POP UP by using oops
Hi All,
We have a requirement of ALV POP UP by using the OOPS. How to select the multiple records in the POP UP and After selecting that i want do Inteactive ALV means again one more POP UP in ALV.
Thanks for help....
Regards,
BharaniHello Bharani
Displaying an ALV list in a popup is by no means different from a list displayed on a main screen. The only thing you need to consider is that you set the right screen level when creating the parent container for the ALV.
For more details refer to thread in CL_GUI_SPLITTER_CONTAINER ALV list is not show in called screen
" step 1:
CREATE OBJECT gr_spliter
EXPORTING
parent = cl_gui_container=>screen0 " For first popup use: =>screen1
rows = 1
columns = 2.
Regards
Uwe -
Problem in displaying correct data in ALV pop-up
Hello,
I am trying to display table contents using the class CL_GUI_ALV_GRID and method SET_TABLE_FOR_FIRST_DISPLAY.
It works as follows. When I doule click on one entry, an ALV pop-up is displayed with the fields of the selected row. The first time it displays the correct fields, but there after it always displays the fields of the first row selected.
I have used the event HANDLE_DOUBLE_CLICK to capture the selected row and perform further processing. All the logic is working fine till the time the method u2018SET_TABLE_FOR_FIRST_DISPLAYu2019 is called. The table passed to the method also contains the correct data, but while displaying the ALV pop-up display the old values.
I have already tried REFRESH_TABLE_DISPLAY and the FREE destructor after displaying the ALV but nothing helps. Also the container and grid are created fresh each time the event is called.
Please suggest possible solutions.
Thanks in advance.HI,
On se71
In windows : declare 2 variable window.
Add it to a page . by selecting create->element (now choose both the var window create by double clicking)
click on the ruler by selecting particular varwindow.
In line editor of a var window. write
&w_var1& (field string name if it is table)
again in line editor of a var2 window. write
&w_var2& (field string name if it is table)
Now pass the values from main program having same name as in sripts (ie w_var1 , w_var2)
Let me know u understood it ? -
Hello,
i need to dislay header as well as item details in an alv pop up. I am using FM REUSE_ALV_POPUP_TO_SELECT. but I am not able to get the header information. I am able to get the item details for a particular Purchase order number. I need to display purchase order number in the header of alv POPUP.
how can i achieve this using the same FM?hi
hope this wil help to u
...tables vbak.
data it_vbak like vbak occurs 0 with header line.
selection-screen begin of block b1 with frame.
parameters: alv1 radiobutton group alv, "REUSE_ALV_LIST_DISPLAY
alv2 radiobutton group alv, "REUSE_ALV_POPUP_TO_SELECT
alv3 radiobutton group alv, "REUSE_ALV_GRID_DISPLAY
alv4 radiobutton group alv. " NORMAL DISPLAY
selection-screen end of block b1.
select * from vbak
into corresponding fields of table it_vbak
up to 10 rows.
if alv1 = 'X'. perform alv_func1.
elseif alv2 = 'X'. perform alv_func2.
elseif alv3 = 'X'. perform alv_func3.
elseif alv4 = 'X'. perform norm.
endif.
**& Form ALV_FUNC1
*form alv_func1 .
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_structure_name = 'VBAK'
tables
t_outtab = it_vbak
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_FUNC1
**& Form ALV_FUNC2
*form alv_func2 .
call function 'REUSE_ALV_POPUP_TO_SELECT'
exporting
i_title = 'SALES ORDER INFO'
i_zebra = 'X'
i_tabname = 1
i_structure_name = 'vbak'
tables
t_outtab = it_vbak
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_FUNC2
**& Form ALV_FUNC3
*form alv_func3 .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_structure_name = 'vbak'
i_grid_title = 'SALES ORDER INFO'
tables
t_outtab = it_vbak
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_FUNC3
**& Form NORM
*form norm .
format intensified.
skip 1.
write: /'SALES DOC.',
' Created on ',
' Time',
' Created by',
' Valid from ',
' Sold-to party'.
format intensified off. skip 2.
loop at it_vbak.
write: / it_vbak-vbeln,
it_vbak-erdat,
it_vbak-erzet,
it_vbak-ernam,
it_vbak-angdt,
it_vbak-kunnr.
endloop.
endform. " NORM
Edited by: Nawanandana Edirisinghe on Sep 3, 2009 12:52 PM -
Hello Folks,
I have an ALV table view, after selecting any line item in the view i have button "DETAIL" which would pop up another view with the details in ALV view again.
I have done the below steps but iam unable to get the alv pop-up with details. I would really appreciate if anyone can help me with this.
My main view <i>V_OVERVIEW</i> is the initial Table view and i have created another View <i>V_POPUP</i> which just has a Viewcontainer. <i>V_OVERVIEW</i> is embeded in window <i>W_MAIN</i> and <i>V_POPUP</i> is embeded in <i>W_POPUP</i>.
The view V_POPUP has the following code in its MODIFYVIEW method.
DATA:node_wage TYPE REF TO if_wd_context_node,
node_detail type ref to if_wd_context_node,
lt_sltd_elmnts TYPE wdr_context_element_set,
lr_element TYPE REF TO if_wd_context_element,
wa_detail TYPE if_v_pop_up=>element_wage_benefit,
it_detail TYPE if_v_pop_up=>elements_wage_benefit.
data : lt_ssn type table of ZUT_XFERRED_SSN,
lt_return type table of bapiret2.
node_wage = wd_context->get_child_node( 'WAGE_BENEFIT' ).
lt_sltd_elmnts = node_wage->get_selected_elements( abap_true ).
lr_element->get_static_attributes(
IMPORTING static_attributes = wa_detail ).
CALL FUNCTION 'ZZ_GET_DETAIL'
EXPORTING
i_ob_key = objectkey
i_quarter = -quarter
TABLES
T_DTL = lt_dtl
T_RETURN = lt_return.
navigate from <CONTEXT> to <TP_RATES> via lead selection
node_detail = wd_context->get_child_node( name =
ig_componentcontroller=>wdctx_ssn_details ).
node_detail->bind_elements( new_items = lt_dtl ).
The main View V_OVERVIEW has the button "DETAIL" which calls the window W_POPUP to show view V_POPUP embeded in it as a popup, here is the code in the Button handler
DATA:
l_api_main TYPE REF TO if_wd_view_controller,
l_window_manager TYPE REF TO if_wd_window_manager,
l_popup TYPE REF TO if_wd_window,
l_cmp_api TYPE REF TO if_wd_component.
* Pop to confirm
CLEAR : l_api_main, l_cmp_api,
l_window_manager, l_popup.
l_api_main = wd_this->wd_get_api( ).
l_cmp_api = wd_comp_controller->wd_get_api( ).
l_window_manager = l_cmp_api->get_window_manager( ).
l_popup = l_window_manager->CREATE_WINDOW(
WINDOW_NAME = 'W_POP_UP'
TITLE = 'Details' ).
l_popup->open( ).hey folks nevermind i got it.
Thanks -
i want to know about pop up fm and required parameters for it. plz pass simple sample code.
here is a sample code
report z11_rohan_shadow_assign1 no standard page heading message-id
z11_shadow_mess.
DECLARING TYPES POOL *
All the definitions of internal tables, structures and constants
are declared in a type-pool called SLIS.
type-pools: slis.
DECLARING STRUCUTURES *
*&--Final structure
types: begin of struc_final,
matnr type matnr, "Material Number
werks type werks_d, "Plant
lgort type lgort_d, "Storage Location
labst type labst, "Valuated stock with unrestricted use
meins type meins, "unit of measurement
mtart type mtart, "material type
ersda type ersda, "Creation date
maktx type maktx, "material description
end of struc_final.
*&--Final structure 2 for drill
types: begin of struc_final_2,
matnr type matnr, "Material Number
werks type werks_d, "Plant
lgort type lgort_d, "Storage Location
name1 type name1,
lgobe type lgobe,
end of struc_final_2.
*&--mard structure
types: begin of struc_mard,
matnr type matnr, "Material Number
werks type werks_d, "Plant
lgort type lgort_d, "Storage Location
labst type labst, "Valuated stock with unrestricted use
end of struc_mard.
*&--mara structure
types: begin of struc_mara,
matnr type matnr,
meins type meins, "unit of measurement
mtart type mtart, "material type
ersda type ersda, "Creation date
end of struc_mara.
*&--maktx structure
types: begin of struc_maktx,
matnr type matnr, "material number
maktx type maktx, "material description
end of struc_maktx.
*&--t001w structure
types: begin of struc_p_desc,
werks type werks_d,
name1 type name1,
end of struc_p_desc.
*&--t001l structure
types: begin of struc_s_loc_desc,
werks type werks_d,
lgort type lgort_d,
lgobe type lgobe,
end of struc_s_loc_desc.
TABLES *
tables: mard.
define macros *
*&-- DEFINING MACRO FOR INITIAL FIELDCATALOG
define macro_fieldcat.
add 1 to l_fieldcat-col_pos.
*Defining macro reference fields
l_fieldcat-checkbox = &1.
l_fieldcat-fieldname = &2.
l_fieldcat-tabname = &3.
l_fieldcat-key = &4.
l_fieldcat-just = &5.
l_fieldcat-hotspot = &6.
l_fieldcat-do_sum = &7.
l_fieldcat-seltext_l = &8.
l_fieldcat-outputlen = &9.
append l_fieldcat to i_fieldcat.
end-of-definition.
*&-- DEFINING FIELDCATALOG FOR POPUP FIELDCATALOG
define macro_fieldcat_popup.
add 1 to l_fieldcat2-col_pos.
*Defining macro reference fields
l_fieldcat2-fieldname = &1.
l_fieldcat2-tabname = &2.
l_fieldcat2-key = &3.
l_fieldcat2-just = &4.
l_fieldcat2-seltext_l = &5.
l_fieldcat2-outputlen = &6.
l_fieldcat2-ref_tabname = &7.
append l_fieldcat2 to i_fieldcat2.
end-of-definition.
WORK AREA DECLARATION *
*&---work area for Internal Tables[population 1]
data: wa_mard type struc_mard,
wa_mara type struc_mara,
wa_maktx type struc_maktx,
wa_final type struc_final.
*population 2
data: wa_p_desc type struc_p_desc,
wa_s_loc_desc type struc_s_loc_desc,
wa_final_2 type struc_final_2.
*&--work area for layout
data: wa_layout type slis_layout_alv,
wa_layout2 type slis_layout_alv.
Structure to display variants for improt and export
data : it_variant like disvariant,
it_variant1 like disvariant.
*defining local workarea
data: l_fieldcat type slis_fieldcat_alv.
*defining local workarea2 for fieldcat popup
data: l_fieldcat2 type slis_fieldcat_alv.
INTERNAL TABLES DECLARATION *
*&---Internal tables for storing data.[populaiton 1]
data: i_mard type standard table of struc_mard,
i_mara type standard table of struc_mara,
i_maktx type standard table of struc_maktx,
i_final type standard table of struc_final.
*&--population 2
data: i_p_desc type standard table of struc_p_desc,
i_s_loc_desc type standard table of struc_s_loc_desc,
i_final_2 type standard table of struc_final_2.
*&---Internal table for field catalog
data : i_fieldcat type slis_t_fieldcat_alv,
*&--Internal table for drill down alvfieldcat
i_fieldcat2 type slis_t_fieldcat_alv,
*&---Internal table for the event catalog.
i_eventcat type slis_t_event,
*&---Internal table for the sorting sequence.
i_sortinfo type slis_t_sortinfo_alv,
*&---Internal table for the top of page event
i_listheader type slis_t_listheader.
DEFINING REFERENCE MACROS FOR INTITAL FIELDCATALOG
macro_fieldcat 'X' text-009 text-005 text-029 text-030 text-029 ' '
text-004 text-031.
macro_fieldcat ' ' text-011 text-005 ' ' text-030 ' ' ' '
text-007 text-032.
macro_fieldcat ' ' text-012 text-005 ' ' text-030 ' ' ' '
text-010 text-031.
macro_fieldcat ' ' text-014 text-005 ' ' text-030 ' ' ' '
text-013 text-031.
macro_fieldcat ' ' text-015 text-005 ' ' text-030 ' ' ' '
text-016 text-031.
macro_fieldcat ' ' text-017 text-005 ' ' text-033 text-029
text-029
text-019 text-031.
macro_fieldcat ' ' text-018 text-005 ' ' text-030 ' ' ' '
text-022 text-031.
macro_fieldcat ' ' text-020 text-005 ' ' text-030 ' ' ' '
text-025 text-031.
DEFINING REFERENCE MACROS FOR POPUP FIELDCATALOGUE
*MACRO_FIELDCAT_POPUP TEXT-009 TEXT-040 TEXT-029 TEXT-030 TEXT-004
*TEXT-031 TEXT-021.
macro_fieldcat_popup text-014 text-040 ' ' text-030 text-013
text-031 text-024.
macro_fieldcat_popup text-041 text-040 ' ' text-030 text-036
text-032 text-038.
macro_fieldcat_popup text-015 text-040 ' ' text-030 text-016
text-031 text-026.
macro_fieldcat_popup text-042 text-040 ' ' text-030 text-037
text-032 text-039.
VARIABLE DECLARATION *
data : v_progname type syrepid.
SELECTION SCREEN *
SCREEN FOR ENTERING INFORMATION
selection-screen begin of block charly with frame title text-001.
select-options: r_matnr for mard-matnr.
select-options: r_werks for mard-werks.
select-options: r_lgort for mard-lgort.
selection-screen end of block charly.
selection-screen begin of block options with frame title text-003.
*RADIO BUTTON
parameters: p_r01 radiobutton group rad1 default 'X', "GRID FORMAT
p_r02 radiobutton group rad1 . "LIST FORMAT
selection-screen end of block options.
*VARIANT
selection-screen begin of block b3 with frame title text-043.
parameters: p_var type slis_vari.
selection-screen end of block b3.
INITIALIZATION EVENT *
initialization.
*&--assigns main program name to v_progname which becomes the calling
program
v_progname = sy-repid.
Display default variant using FM REUSE_ALV_VARIANT_DEFAULT_GET
perform zf_default_variant.
*&--clearing workareas
clear: wa_mard,
wa_mara,
wa_maktx,
wa_final,
wa_layout.
*&--refreshing internal tables
refresh: i_mard,
i_mara,
i_maktx,
i_final,
i_eventcat,
i_sortinfo,
i_listheader.
AT SELECTION SCREEN ON VLAUE REQUEST *
at selection-screen on value-request for p_var.
perform zf_variant_f4. "USING FM REUSE_ALV_VARIANT_F4
AT SELECTION SCREEN *
at selection-screen.
*check the material no.
perform zf_validate_field.
*check the variant provided
perform zf_variant_check.
START OF SELECTION EVENT
start-of-selection.
fetch the data
perform zf_populate_info.
END OF SELECTION EVENT
end-of-selection.
*If Internal Table Is Populated Then Only Display Alv Report.
if i_final is not initial.
&---Build layout.
perform zf_layout.
&---build event catalogue
perform zf_eventcat using i_eventcat.
build sorting
perform zf_sorting using i_sortinfo.
&---Build Listheader for TOP OF PAGE EVENT.
perform zf_build_listheader using i_listheader.
if p_r01 = 'X'. "if 1st radio button is selected
*&---Display alv grid.
perform zf_display_alv_grid.
else.
*&---Display alv grid.
perform zf_display_alv_list.
endif.
else.
*If Table is not Populated ie Records Does not exist
message e004.
endif.
*& Form zf_validate_field
text
--> p1 text
<-- p2 text
form zf_validate_field .
TECHNICAL VALIDATION [SINGLE FIELD CHECK]
CASE 1- IF NOTHING IS ENTERED, PRINT ALL RECORDS
if r_matnr[] is initial and r_werks[] is initial and r_lgort[] is
initial.
exit.
endif.
CASE 2- IF ONLY MATERIAL NUMBER IS ENTERED
if r_matnr[] is not initial and r_werks[] is initial and r_lgort[] is
initial.
*validate material
select matnr
into wa_mard-matnr
from mara
up to 1 rows
where matnr in r_matnr.
endselect.
if sy-subrc <> 0. "if unsuccessful
message e001. "material does not exist
else.
exit.
endif.
endif.
CASE 3- IF ONLY PLANT IS ENTERED
if r_matnr[] is initial and r_werks[] is not initial and r_lgort[] is
initial.
*validate plants
select werks
into wa_mard-werks
from marc
up to 1 rows
where werks in r_werks.
endselect.
if sy-subrc <> 0. "if unsuccessful
message e002. "plant does not exist
else.
exit.
endif.
endif.
CASE 3- IF ONLY STORAGE IS ENTERED
if r_matnr[] is initial and r_werks[] is initial and r_lgort[] is
not initial.
*validate LGORT
select lgort
into wa_mard-lgort
from mard
up to 1 rows
where lgort in r_lgort.
endselect.
if sy-subrc <> 0. "if unsuccessful
message e003. "storage location does not exist
else.
exit.
endif.
endif.
CASE 4- CHECKING BUISNESS VALIDATION 1 - MATERIAL AND PLANT
if r_matnr[] is not initial and r_werks[] is not initial.
to see if material exist for the entered plant.
select matnr
into wa_mard-matnr
from mard up to 1 rows
where matnr in r_matnr and werks in r_werks.
endselect.
if sy-subrc <> 0 . "if unsuccesful
*No particular combination exists
message e006.
else.
exit.
endif.
endif.
CASE 6 - CHECKING BUISNESS VALIDATION 2 - PLANT AND STORAGE
if r_werks[] is not initial and r_matnr[] is initial and
r_lgort[] is not initial.
select werks
into wa_mard-werks
from mard
up to 1 rows
where werks in r_werks and lgort in r_lgort.
endselect.
if sy-subrc <> 0.
*No particular combination exists
message e006.
else.
exit.
endif.
endif.
CASE 7 - CHECKING BUISNESS VALIDATION 3 - MATERIAL AND STORAGE
if r_matnr[] is not initial and r_werks[] is initial.
select matnr
into wa_mard-matnr
from mard
up to 1 rows
where matnr in r_matnr and lgort in r_lgort.
endselect.
if sy-subrc <> 0.
*No particular combination exists
message e006.
else.
exit.
endif.
endif.
CASE 8 - CHECKING BUISNESS VALIDATION 4 - MATERIAL,PLANT AND STORAGE
if r_matnr[] is not initial and r_werks[] is not initial.
select matnr
into wa_mard-matnr
from mard
up to 1 rows
where matnr in r_matnr and werks in r_werks and lgort in
r_lgort.
endselect.
if sy-subrc <> 0.
*No particular combination exists
message e006.
endif.
endif.
endform. " zf_validate_field
*& Form zf_populate_info
text
--> p1 text
<-- p2 text
form zf_populate_info .
*&--fetching the data from mard table
select matnr
werks
lgort
labst
into table i_mard
from mard
where matnr in r_matnr and werks in r_werks and lgort in
r_lgort
if sy-subrc <> 0. "if unsuccesful
message e004. "Error- Record does not exist
endif.
selection of material description
if i_mard[] is not initial.
*SELECT DISTINCT FOR UNIQUE ENTRIES ONLY
select distinct matnr
maktx
into table i_maktx
from makt
for all entries in i_mard
where matnr = i_mard-matnr and
spras = sy-langu.
if sy-subrc <> 0. " if unsucessful
wa_maktx-maktx = text-028. "NO DESCRIPTION
endif.
*fetching information from mara
select distinct matnr
meins
mtart
ersda
into table i_mara
from mara for all entries in i_mard
where matnr = i_mard-matnr.
if sy-subrc <> 0.
message e003.
endif.
*&--sorting the tables
sort: i_mard by matnr werks lgort,
i_mara by matnr,
i_maktx by matnr.
*&--Clearing workareas.
clear: wa_mard,
wa_mara,
wa_maktx,
wa_final.
*PROCESSING
loop at i_mard into wa_mard.
*moving values to final workarea
wa_final = wa_mard.
at new matnr.
read table i_maktx into wa_maktx
with key matnr = wa_mard-matnr binary search.
read table i_mara into wa_mara
with key matnr = wa_mard-matnr binary search.
endat.
if sy-subrc = 0.
"if succesful then move to final workarea
wa_final-maktx = wa_maktx-maktx.
*for mara values
wa_final-meins = wa_mara-meins.
wa_final-mtart = wa_mara-mtart.
wa_final-ersda = wa_mara-ersda.
endif.
*append final workarea
append wa_final to i_final.
endloop.
refresh: i_mard.
clear: wa_mard.
endif.
endform. "zf_populate_info
*ENDFORM. " zf_build_fieldcat
*& Form zf_display_alv_grid
text
--> p1 text
<-- p2 text
form zf_display_alv_grid .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = v_progname
is_layout = wa_layout
it_fieldcat = i_fieldcat
it_events = i_eventcat
it_sort = i_sortinfo
i_default = 'X'
i_save = 'A'
is_variant = it_variant1
tables
t_outtab = i_final "output table
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. " zf_display_alv_grid
*& Form zf_display_alv_list
text
--> p1 text
<-- p2 text
form zf_display_alv_list .
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = v_progname
is_layout = wa_layout
it_fieldcat = i_fieldcat
it_events = i_eventcat
it_sort = i_sortinfo
i_default = 'X'
i_save = 'A'
is_variant = it_variant1
tables
t_outtab = i_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.
endform. " zf_display_alv_list
*& Form ZF_LAYOUT
text
--> p1 text
<-- p2 text
form zf_layout .
wa_layout-zebra = 'X'.
wa_layout-totals_text = 'TOTAL'.
endform. " ZF_LAYOUT
*& Form ZF_EVENTCAT
text
-->P_I_EVENTCAT text
form zf_eventcat using p_i_eventcat type slis_t_event.
data: l_eventcat type slis_alv_event.
clear l_eventcat.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = p_i_eventcat
exceptions
list_type_wrong = 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.
TOP OF PAGE FORM
clear l_eventcat.
read table p_i_eventcat into l_eventcat with key
name = slis_ev_top_of_page.
"(COMPONENT "NAME" of structure)
if sy-subrc = 0. "if success
move 'ZF_TOP_OF_PAGE' to l_eventcat-form.
"matches name and moves form to workarea and modifies table
modify p_i_eventcat from l_eventcat index sy-tabix
transporting form.
endif.
USER_COMMAND FORM
clear l_eventcat.
read table p_i_eventcat into l_eventcat with key
name = slis_ev_user_command.
if sy-subrc = 0.
move 'ZF_USER_COMMAND' to l_eventcat-form.
modify p_i_eventcat from l_eventcat index sy-tabix
transporting form.
endif.
endform. " ZF_EVENTCAT
*& Form ZF_TOP_OF_PAGE
text
--> p1 text
<-- p2 text
form zf_top_of_page .
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = i_listheader.
endform. " ZF_TOP_OF_PAGE
*& Form ZF_BUILD_LISTHEADER
text
-->P_I_LISTHEADER text
form zf_build_listheader using p_i_listheader type slis_t_listheader.
data: l_listheader type slis_listheader,
l_lines type i,
l_records(10) type c.
refresh p_i_listheader.
clear l_listheader.
HEADER [PRINTS THE HEADER IN BOLD AND CAPITAL]
l_listheader-typ = 'H'.
l_listheader-info = 'STORAGE LOCATION WISE MATERIAL REPORT'.
append l_listheader to p_i_listheader.
SELECTION
*for date
l_listheader-typ = 'S'.
l_listheader-key = text-035.
concatenate sy-datum6(2) '.' sy-datum4(2) '.' sy-datum(4) into
l_listheader-info.
append l_listheader to p_i_listheader.
*for Total no. of records
describe table i_final lines l_lines.
l_records = l_lines.
l_listheader-typ = 'S'.
l_listheader-key = text-034.
l_listheader-info = l_records.
append l_listheader to p_i_listheader.
endform. " ZF_BUILD_LISTHEADER
*& Form ZF_SORTING
text
-->P_I_SORTINFO text
form zf_sorting using p_i_sortinfo type slis_t_sortinfo_alv.
data l_sortinfo type slis_sortinfo_alv.
refresh p_i_sortinfo.
clear l_sortinfo.
l_sortinfo-spos = '1'. "sorting position
l_sortinfo-fieldname = text-009. "fieldname
l_sortinfo-tabname = 'I_FINAL'. "final table
l_sortinfo-down = 'X'.
l_sortinfo-group = '*'. "DONT REPEAT COMMON ITEM
append l_sortinfo to p_i_sortinfo.
endform. " ZF_SORTING
*& Form ZF_USER_COMMAND
text
--> p1 text
<-- p2 text
form zf_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield .
case r_ucomm.
*&-- when hotspot is clikced
when '&IC1'.
if rs_selfield-fieldname = 'WERKS'.
read table i_final into wa_final index rs_selfield-tabindex.
if sy-subrc = 0. "if succesful
*PERFORM FOR POPUALTING THE INITIAL FETCH OPERTAIONM
perform zf_popualte_table_2.
else. "if unsuccesful
message e004. "Error- Record does not exist
endif.
*&--PERFORM FOR DATA POPUALTION OF PLANT AND STORAGE DECRIPTION
perform zf_data_popualtion_2.
*&--PERFORM TO Call POPUP FUNCTION
perform zf_alv_grid_display_popup.
perform zf_popup_display.
PERFORM ZF_LAYOUT2.
refresh: i_final_2.
endif.
endcase.
endform. " ZF_USER_COMMAND
*& Form ZF_POPUALTE_TABLE_2
text
--> p1 text
<-- p2 text
form zf_popualte_table_2 .
select matnr
werks
lgort
from mard
into corresponding fields of table i_mard
where matnr = wa_final-matnr and werks = wa_final-werks.
endform. " ZF_POPUALTE_TABLE_2
*& Form ZF_DATA_POPUALTION_2
text
--> p1 text
<-- p2 text
form zf_data_popualtion_2 .
selection of storage location filtered by material no.of mard
if i_mard[] is not initial.
*SELECT PLANT DESCRIPTION
select werks
name1
into table i_p_desc
from t001w
for all entries in i_mard where werks = i_mard-werks.
if sy-subrc <> 0. " if unsucessful
wa_p_desc-name1 = text-028. "NO DESCRIPTION
endif.
*SELECT STORAGE LOCATION DESCRIPTIONS
select werks
lgort
lgobe
into table i_s_loc_desc
from t001l
for all entries in i_mard where werks = i_mard-werks and
lgort = i_mard-lgort.
if sy-subrc <> 0. " if unsucessful
wa_s_loc_desc-lgobe = text-028. "NO DESCRIPTION
endif.
*&--sorting the tables
sort: i_mard by matnr werks lgort,
i_p_desc by werks,
i_s_loc_desc by werks lgort.
*&--Clearing workareas.
clear: wa_mard,
wa_p_desc,
wa_s_loc_desc,
wa_final_2.
*PROCESSING [2nd time]
loop at i_s_loc_desc into wa_s_loc_desc .
*moving values to final workarea
wa_final_2-werks = wa_s_loc_desc-werks .
wa_final_2-lgort = wa_s_loc_desc-lgort .
wa_final_2-lgobe = wa_s_loc_desc-lgobe.
read table i_p_desc into wa_p_desc
with key werks = wa_s_loc_desc-werks binary search.
read table i_mard into wa_mard
with key werks = wa_s_loc_desc-werks binary search.
if sy-subrc = 0.
*for t001w [plant desc] values
wa_final_2-name1 = wa_p_desc-name1.
*for matnr values
wa_final_2-matnr = wa_mard-matnr.
endif.
*append final workarea
append wa_final_2 to i_final_2.
endloop.
endif.
endform. " ZF_DATA_POPUALTION_2
*& Form ZF_POPUP_DISPLAY
text
--> p1 text
<-- p2 text
form zf_popup_display .
call function 'REUSE_ALV_POPUP_TO_SELECT'
exporting
i_title = 'POPUP- DISPLAYING MATERIAL-STORAGE'
i_tabname = 'I_FINAL_2'
it_fieldcat = i_fieldcat2
tables
t_outtab = i_final_2
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. " ZF_POPUP_DISPLAY
*& Form ZF_DEFAULT_VARIANT
text
--> p1 text
<-- p2 text
form zf_default_variant .
it_variant1-report = sy-repid.
Search default variant for the report
call function 'REUSE_ALV_VARIANT_DEFAULT_GET'
exporting
i_save = 'A'
changing
cs_variant = it_variant1
exceptions
wrong_input = 1
not_found = 2
program_error = 3
others = 4.
if sy-subrc = 0. "if succesful set as default.
p_var = it_variant1-variant.
endif.
endform. " ZF_DEFAULT_VARIANT
*& Form ZF_VARIANT_F4
text
--> p1 text
<-- p2 text
form zf_variant_f4 .
it_variant-report = sy-repid.
call function 'REUSE_ALV_VARIANT_F4'
exporting
is_variant = it_variant
i_save = 'A'
importing
E_EXIT =
es_variant = it_variant1
exceptions
not_found = 1
program_error = 2
others = 3
if sy-subrc = 0. "if sccesfully found, load the variant
p_var = it_variant1-variant.
endif.
endform. " ZF_VARIANT_F4
*& Form ZF_VARIANT_CHECK
text
--> p1 text
<-- p2 text
form zf_variant_check .
if not p_var is initial.
it_variant-report = sy-repid.
it_variant-variant = p_var.
call function 'REUSE_ALV_VARIANT_EXISTENCE'
exporting
i_save = 'A'
changing
cs_variant = it_variant
exceptions
wrong_input = 1
not_found = 2
program_error = 3
others = 4.
if sy-subrc = 0.
clear it_variant1.
move p_var to it_variant1-variant.
move sy-repid to it_variant1-report.
else.
message e007.
endif.
else.
clear it_variant.
endif.
endform. " ZF_VARIANT_CHECK
*& Form ZF_ALV_GRID_DISPLAY_POPUP
text
--> p1 text
<-- p2 text
form zf_alv_grid_display_popup .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
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 =
it_fieldcat = i_fieldcat2
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 = 10
i_screen_start_line = 1
i_screen_end_column = 50
i_screen_end_line = 10
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_final_2
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. " ZF_ALV_GRID_DISPLAY_POPUP
reward if helpful
keep rockin
vivek -
Hi,
I am writing a program using classic ALV to display customer information.
In my main ALV I am displaying the customer info. Upon double clicking the customer number, the ship to details of this customer needs to be displayed in a pop up window. I am using REUSE_ALV_POPUP_TO_SELECT fn.module for this. In my pop up display, the columns are not aligned.
Hope I have made my question clear.
Since I am an absolute novice in this area, I would greatly appreciate your valuable inputs.
Regards,
Gayathri.Hi,
Here is my sample code.Please check this.
type-pools: slis.
data: begin of i_outtab occurs 0.
include structure scarr.
data: w_chk type c. "For multiple selection
data: end of i_outtab.
data: begin of i_outtab1 occurs 0.
include structure sflight.
data: end of i_outtab1.
data: begin of i_outtab2 occurs 0.
include structure spfli.
data: end of i_outtab2.
data: begin of final_itab occurs 0,
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-fldate,
price like sflight-price,
seatsmax like sflight-seatsmax,
seatsocc like sflight-seatsocc,
paymentsum like sflight-paymentsum,
cityfrom like spfli-cityfrom,
cityto like spfli-cityto,
deptime like spfli-deptime,
arrtime like spfli-arrtime,
end of final_itab.
data: i_private type slis_data_caller_exit,
i_selfield type slis_selfield,
w_exit(1) type c.
data: i_fieldcat type slis_t_fieldcat_alv,
wa_fieldcat type slis_fieldcat_alv.
data: ws_program like sy-repid.
data: flag type c.
initialization.
ws_program = sy-repid.
start-of-selection.
select * from scarr into table i_outtab.
call function 'REUSE_ALV_POPUP_TO_SELECT'
exporting
i_title = 'Programp_title'
i_selection = 'X'
i_zebra = 'X'
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
i_checkbox_fieldname = 'W_CHK'
I_LINEMARK_FIELDNAME =
I_SCROLL_TO_SEL_LINE = 'X'
i_tabname = 'I_OUTTAB'
i_structure_name = 'SCARR'
IT_FIELDCAT =
IT_EXCLUDING =
i_callback_program = ws_program
I_CALLBACK_USER_COMMAND =
IS_PRIVATE = I_PRIVATE
IMPORTING
es_selfield = i_selfield
e_exit = w_exit
tables
t_outtab = i_outtab
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message i000(0k) with sy-subrc.
endif.
write:/ i_selfield.
*****the internal table is modified with a cross sign for marking the
***rows selected
loop at i_outtab where w_chk = 'X'.
flag = ' '.
select * from sflight into table i_outtab1
where carrid = i_outtab-carrid.
if sy-subrc ne 0.
flag = 'X'.
else.
select * from spfli into table i_outtab2
for all entries in i_outtab1
where carrid = i_outtab1-carrid
and connid = i_outtab1-connid.
loop at i_outtab1.
read table i_outtab2 with key carrid = i_outtab1-carrid
connid = i_outtab1-connid.
move i_outtab1-carrid to final_itab-carrid.
move i_outtab1-connid to final_itab-connid.
move i_outtab1-fldate to final_itab-fldate.
move i_outtab1-price to final_itab-price.
move i_outtab1-seatsmax to final_itab-seatsmax.
move i_outtab1-seatsocc to final_itab-seatsocc.
move i_outtab1-paymentsum to final_itab-paymentsum.
move i_outtab2-cityfrom to final_itab-cityfrom.
move i_outtab2-cityto to final_itab-cityto.
move i_outtab2-deptime to final_itab-deptime.
move i_outtab2-arrtime to final_itab-arrtime.
append final_itab.
endloop.
endif.
endloop.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = ws_program
i_internal_tabname = 'FINAL_ITAB'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = ws_program
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = i_fieldcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
perform final_display.
form final_display.
if flag is initial.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = ws_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 =
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_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = final_itab
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.
else.
message i003.
endif.
endform.
Hope this can help you.
Thanks&Regards
Ruthra.R -
Handling Double click on a Pop-up screen with ALV Grid
Hello Experts,
I have an issue handling double click on ALV Pop-up screen. I tried to achive this using following steps.
1. I defined a local class in Top-include to handle double click and implemented it in the following way.
CLASS lcl_alv_event_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
on_double_click FOR EVENT double_click
OF cl_gui_alv_grid
IMPORTING e_row
e_column
es_row_no.
ENDCLASS. "lcl_alv_event_handler DEFINITION
*~~~ Implementation code
CLASS lcl_alv_event_handler IMPLEMENTATION.
To handle Selection of Issue data on Screen 100
METHOD on_double_click.
DATA: lt_row_no TYPE lvc_t_roid,
ls_req TYPE zcst_zirt_seltab.
READ TABLE gt_req
INTO ls_req
INDEX e_row-index.
g_req_id = ls_req-zzrequest_id.
gv_selected = true.
CALL METHOD go_alv->dispatch
EXPORTING
cargo = 'OK'
eventid = 3
is_shellevent = ' '
is_systemdispatch = 'X'
EXCEPTIONS
cntl_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.
ENDMETHOD. "on_double_click
ENDCLASS. "lcl_alv_event_handler IMPLEMENTATION
2. Registered the event in the PBO module of the screen
ls_events-eventid = 3.
ls_events-appl_event = gc_true.
APPEND ls_events TO lt_events.
CALL METHOD co_alv->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3
OTHERS = 4.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT co_alv_event_handler.
SET HANDLER: co_alv_event_handler->on_double_click FOR co_alv.
CALL METHOD co_alv->set_toolbar_interactive.
3. In the PAI module of Screen, tried to handle the event 'OK' that waqs registred in PBO.
CASE save_ok.
WHEN 'OK'.
Get selected line
CALL METHOD io_alv->get_selected_rows
IMPORTING
et_index_rows = lt_rows
et_row_no = lt_rows_no.
IF NOT lt_rows IS INITIAL.
READ TABLE lt_rows INTO ls_rows INDEX 1.
IF sy-subrc EQ 0.
gv_selected = 'X'.
READ TABLE it_req
INTO ls_req
INDEX ls_rows-index.
e_req_id = ls_req-zzrequest_id.
SET SCREEN 0.
ENDIF.
ELSE.
SET SCREEN 0.
ENDIF.
With this code what is happening is, when user double clicks a line on Pop-up screen with ALV grid data, the program is able to successfully get into the class implementation but the control is not going to PAI module to execute the OK_code handling part.
Am I doing this in the right way? Appreciate quick suggestions. Proper posts will be thoroughly awarded with points.
Thx.
MinniPut your code into the Event handler Implementation of Double Click which is there in the PAI Module.
Regards,
Naimesh Patel -
Hi PCUI Experts,
In trial screen, at Item level when the user manually enters a product which is not existing in crm system... i have to trigger the pop screen for searching the products. This pop up is same as what user sees when he presses F4 button on product field.
is this possible for me to call that F4 screen when the user enters the item which is not there?
if so could any one guide me in this...Points will be granted.
Many thanks,
Giridhar KommisettyHi All,
I could able to find the answer.
1. Create a message for triggering the pop up.
2. Copy the same configuration what we have for the F4 screen in blueprint tables.
3. Call this screen in the scenario when required.
thanks
Giridhar Kommisetty -
ALV OM. Avoiding pop-up closure
I created an ALV pop-up using the ALV OM.
I have to detect the moment when the user closes the window so to make some checks; according to the result of these checks the ALV pop-up must stay open so the user can make other changes.
Until now I don't succeed in avoiding the window closure when the user, for example, clicks on the close window icon.
What are the objects to use, or whatever else steps to make, to avoid the window closure?
Thanks in advance,
Antonino -
Hello gurus,
I created a workbench with an edittable ALV for its data. This ALV has several tabs, lets say 5 tabs with individual event handler declaration. Tabs 1, 2 & 3 shares the same event/class and method declaration. 4&5 shares also the same but different to 1,2, & 3.
I have events handle data change and button click (for a column of buttons that pops up a screen when pressed), which are both standard toolbar. Then I also have event toolbar for my custom icon and event user command to handle these icons.
I run my ALV, tabs 1,2 & 3 have their data first. Then I just copy these data going to tab4.
On tab 4, whenever I click on the standard toolbar 'add row' (+ icon), it adds new row and triggers event handle data change.
Now my problem is, whenever I click on any other icon that triggers alv event, instead of going to their respective event, it always go to the handle data change event. (i.e. when I click on my custom toolbar icon, instead of going to event user command, it triggers the handle data change. Same with when I click on any buttons under the button columns, it triggers handle data change.)
Tab 1,2 & 3 works fine. But 4 & 5 are not. They have the same process and coded with the same logic. The only difference I see is that 4 & 5 has handle data change event while 1,2 & 3 have not.
Please help me analysing what's really causing the issue and what solution to apply to handle this.
Thanks,
Sheerayou need to set the subtotal option only to the dummy field. see the below code related.
"no need of subtot option here..
ls_sort-spos = 1.
ls_sort-fieldname = 'EBELN'.
ls_sort-tabname = 'ITAB'.
ls_sort-up = 'X'.
ls_sort-group = 'UL'.
APPEND ls_sort TO it_sort.
CLEAR ls_sort.
ls_sort-spos = 2.
ls_sort-fieldname = 'D'.
ls_sort-tabname = 'ITAB'.
ls_sort-up = 'X'.
ls_sort-group = 'UL'.
ls_sort-subtot = 'X'. "Only specify here
APPEND ls_sort TO it_sort. -
Logical Database o/p in ALV
Dear Expert.
I have to call AFI logical database in ZPROGRAM. If I write GET DIAUFK (root node)
How do I fetch data form parent and child node?
O/p should come as ALV on that alv pop-up will come on that pop up list of transaction displayed which will work on click.
Please suggest.
START-OF-SELECTION.
GET DIAUFK .
*get late
*GET DIIHPA.
GET DIIFLO .
*GET DIQMEL.
MOVE-CORRESPONDING DIAUFK TO ITAB.
*MOVE-CORRESPONDING DIQMEL TO ITAB.
APPEND ITAB.
GET DIAUFK LATE.
IF S_ERDAT NE SPACE AND S_WERKS NE SPACE.
ITAB-ERDAT = S_ERDAT .
ITAB-WERKS = S_WERKS .
ENDIF.
END-OF-SELECTION.
LOOP AT ITAB.
IT_FINAL = ITAB.
APPEND IT_FINAL.
ENDLOOP.Try exploring FM 'LDB_PROCESS'
<removed by moderator>
Edited by: Thomas Zloch on Aug 9, 2010 2:56 PM - don't ask for ... -
How the Pop UP window got closed on line select
Hi All,
at BP_ADDR component we are calling component BP_SEARCH_HELPS by cross component usage on F4,
then we are doing bank details search, then on single line select at View BP_SEARCH_HELPS/BankKeySearchHelpResult
then it goes to event handler method EH_ONSELECT then.
inside this method we have code for to call window outbound plug RETURNRESULT'
METHOD eh_onselect.
via viewmanager:
DATA: lr_window TYPE REF TO cl_bsp_wd_window.
lr_window ?= me->view_manager->get_window_controller( ).
lr_window->call_outbound_plug( iv_outbound_plug = 'RETURNRESULT' ).
endmethod.
but at Window out bound plug there is no code for cross comp Window navigation (like Fire_outbound_plug with navigation link)
then also popup is closing and it gets navigating to BP_ADDR component, how it happenning...?
code at window BP_SEARCH_HELPS/BankKeySearchHelpW outbound plug is
method OP_RETURNRESULT.
endmethod.
there is no navigation link also defined for window BP_SEARCH_HELPS/BankKeySearchHelpW at Runtime repository.
one more question is how the event handler method EH_ONSELECT is executed for line select (we r not define any server event for any field of table's context node), is it property of Table context node?
Thanks,
VjMhydHi VJ,
I hope you are able to find the answer to your question that "how pop up is closing and navigation is done to BP_ADDR component" if not here is the answer.
Go to your window class and search for method call_outbound_plug ( remove the filter check box ). inside that method firstly your outbound plug method RETURNRESULT will be called and then you will find another method fire_outbound_plug. inside this method there is code to navigate back and close the pop up. this code is only triggered for pop up cases and that's how navigations takes places.
check if this is a popup rep. view
if ME->IS_TOPLEVEL_WINDOW = ABAP_TRUE.
We ignore the navigation for popups but save the outbound plug if given
and tell the current popup to get closed
data: LV_VIEW_MANAGER type ref to LCL_VIEW_MANAGER,
LV_APPL_CONTROLLER type ref to CL_BSP_WD_APPL_CONTROLLER.
try.
LV_VIEW_MANAGER ?= ME->VIEW_MANAGER.
LV_APPL_CONTROLLER ?= LV_VIEW_MANAGER->GET_APPLICATION_CONTROLLER( ).
LV_APPL_CONTROLLER->POPUP_MANAGER->CLOSE_POPUP( IV_OUTBOUND_PLUG ).
catch CX_SY_MOVE_CAST_ERROR. "#EC NO_HANDLER
endtry.
I hope this clarifies your issue.
Thanks
Sudhir Grover -
How to Open a pop up window?
Hi
I have 2 fields in my form.
attribute1 and attribute1_meaning
only attribute1 is displayed on the form .
I want that whenever a user updates or inserts any record into the attribute1 field ,
a window should pop up prompting for the user to enter field attribute1_meaning.
in short --
if attribute1 is updated or inserted then attribute1_meaning should also be updated or inserted.
How to go about this?
thankswell bro u have to create another canvas with dialog window, set its size and pop it up.
You can also hide the meaning field and everytime the user changes or inserts set the visibility of the attribute_meaning to yes.
and use validation and post change triggers to pop the window occasionally when the meaning is null or the record is new or changed.
zaibi. -
Hello,
I am displaying a ALV report as POP-UP . Its developed based on OOPS ( gr_table->Display).
The ALV displaying the output perfectly when the records are less. For example, the ALV pop-up able to show the 50 records perfectly . If the records are more than 50 (example 500), then i have to scroll down to see the records from 51 to 500. When the records are high , the Alv trying to display the output.. but in a second, its throwing the dump((ASSERTION_FAILED)). Few times, its able to display the data, when i am trying to scroll down to see the below records..its throwing the dump (ASSERTION_FAILED). I tried with all possibilities but no luck. And no idea about ASSERTION FAILED DUMP.
Kindly help.
Regards,
VenkatHello Both,
Thanks for the reply. Please find the error details
The ASSERT condition was violated.
Error analysis
The following checkpoint group was used: "No checkpoint group specified"
If in the ASSERT statement the addition FIELDS was used, you can find
the content of the first 8 specified fields in the following overview:
" (not used) "
" (not used) "
" (not used) "
" (not used) "
" (not used) "
" (not used) "
" (not used) "
" (not used) "
Probably the only way to eliminate the error is to correct the program.
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"ASSERTION_FAILED" " "
"CL_DATAPTABLECACHE============CP" or "CL_DATAPTABLECACHE============CM00P"
"TRANSMIT_PACKET"
Any clue. Please.
Venkat
Maybe you are looking for
-
When trying to convert a 1GB MOV file to Apple TV I get an error message "Failed: qtKitErrorCtachall (-50) The MOV file has been successfully cvonverted to other formats. Can this be fixed?
-
How can i get photoshop to stay on my dock
i installed photoshop and it was working fine ,few days later i noticed it had moved from the dock when i checked my applications in my harddrive it was there but when i try to open it it just flashes small in the dock and does nothing? not sure what
-
No layer grouping functionality
Hi, I'm not a design expert. I use Elements personally and on occassion for work related purposes. I've always found it a pleasure to work with because Elements doesn't tend to give the feeling "you can't do this, buy the pro version". It's more limi
-
Urgent: executeQueryForCollection does not execute query for collection
Some ViewLink detail views do not refresh when the master RSI navigates. Instead, it seems that a cached query collection is used. How can we control this behaviour? Under what circumstances does the rowset re-use an old QueryCollection instead of re
-
Hi Friends, Can anybody provide me any reading material for IDOC process so taht I can learn and use the IDOC functionality. I want to process few SAP transactions in the background through IDOC. Thanks & Regards Satya