‎2008 Jun 24 11:32 AM
hELLO,
I have a problem with the screen superimposed.
I call two times the fonction ALV and when i came back i don't want the first ALV but i want to see the selection .
I use the sy-lsind but it don't resolve my problem of screen.
Can you help me ?
*----
*
report zme204_pmp.
type-pools : slis.
tables : zmpmp.
data : t_zmpmp like zmpmp occurs 0 with header line.
data : begin of wt_rec occurs 0,
box type c. "Sélection
include structure zmpmp.
data : end of wt_rec.
data : g_catalogue type slis_t_fieldcat_alv,
ws_catalogue type slis_fieldcat_alv.
data : gt_list_top_of_page type slis_t_listheader.
data : g_top_of_page type slis_formname value 'TOP_OF_PAGE'.
data : gt_events type slis_t_event,
ls_variant like disvariant.
data : tab_events type slis_t_event.
constants:
c_top_of_list type slis_formname value 'TOP_OF_LIST',
c_pf_status_set type slis_formname value 'PF_STATUS_SET'.
selection-screen begin of block critere
with frame title text-001.
select-options :
s_werks for zmpmp-werks ,
s_mblnr for zmpmp-mblnr,
s_mjahr for zmpmp-mjahr,
s_matnr for zmpmp-matnr,
s_usnam for zmpmp-usnam.
selection-screen end of block critere.
start-of-selection.
*Sélection des enregistrements de la table ZMPMP
select * into table t_zmpmp
from zmpmp
where werks in s_werks and
mblnr in s_mblnr and
mjahr in s_mjahr and matnr in s_matnr
and usnam in s_usnam.
loop at t_zmpmp.
move-corresponding t_zmpmp to wt_rec.
append wt_rec.
endloop.
*Liste des événements
perform eventtab_build using tab_events.
perform liste_alv.
*&----
*
*& Form liste_alv
*&----
*
text
*----
*
--> p1 text
<-- p2 text
*----
*
form liste_alv .
data : repid type sy-repid,
s_layout type slis_layout_alv.
*Sélection multiple de lignes dans la liste ALV
s_layout-colwidth_optimize = 'X'.
s_layout-zebra = 'X'.
s_layout-box_fieldname = 'BOX'.
s_layout-group_change_edit = 'X'.
s_layout-f2code = 'DISPLAY'.
repid = sy-repid. "Programme ABAP
*Récupération des attributs de la table passée en paramètre
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = repid
i_internal_tabname = 'WT_REC'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = repid
i_bypassing_buffer = 'X'
I_BUFFER_ACTIVE =
changing
ct_fieldcat = g_catalogue
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.
read table g_catalogue into ws_catalogue
with key fieldname = 'BOX'.
if sy-subrc = 0.
move: 'X' to ws_catalogue-no_out.
modify g_catalogue from ws_catalogue index sy-tabix.
endif.
*Affichage ALV
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = repid
i_callback_pf_status_set = c_pf_status_set
i_callback_user_command = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
i_structure_name = 'WT_REC'
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = s_layout
it_fieldcat = g_catalogue[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'A'
i_save = 'U'
is_variant = ls_variant
it_events = gt_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 =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = wt_rec
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. " liste_alv
*&----
*
*& Form eventtab_build
*&----
*
text
*----
*
-->P_TAB_EVENTS text
-->P_LOOP text
-->P_AT text
-->P_T_ZMPMP text
*----
*
form eventtab_build using it_events type slis_t_event.
data: l_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = it_events.
read table it_events with key name = slis_ev_top_of_list
into l_event.
if sy-subrc = 0.
move c_top_of_list to l_event-form.
append l_event to it_events.
endif.
endform. " eventtab_build
*&----
*
Suppression des enregistrements de la table ZMPMP
*----
*
form user_command using r_ucomm like sy-ucomm rs_selfield type
slis_selfield.
data : w_cpt type i.
**sy-lsind = sy-lsind - 1.**
case r_ucomm.
when 'DELETE'.
clear w_cpt.
loop at wt_rec.
check wt_rec-box = 'X'.
delete from zmpmp where werks = wt_rec-werks and
mblnr = wt_rec-mblnr and
mjahr = wt_rec-mjahr .
delete wt_rec .
w_cpt = w_cpt + 1.
endloop.
message w127(zm) with w_cpt.
perform liste_alv.
when others.
endcase.
endform. "USER_COMMAND
*&----
*
*& Form pf_status_set
*&----
*
text
*----
*
-->RT_EXTAB text
*----
*
form pf_status_set using rt_extab type slis_t_extab. "#EC CALLED
set pf-status '0001' excluding rt_extab.
endform. "pf_status_set
‎2008 Jun 24 11:37 AM
Hi
In the user-command after calling the ALV u can set the variable s_selfield-exit in orderr to leave the first ALV:
form user_command using r_ucomm like sy-ucomm rs_selfield type slis_selfield.
data : w_cpt type i.
***sy-lsind = sy-lsind - 1.***
case r_ucomm.
when 'DELETE'.
clear w_cpt.
loop at wt_rec.
check wt_rec-box = 'X'.
delete from zmpmp where werks = wt_rec-werks and
mblnr = wt_rec-mblnr and
mjahr = wt_rec-mjahr .
delete wt_rec .
w_cpt = w_cpt + 1.
endloop.
message w127(zm) with w_cpt.
perform liste_alv.
* LEAVE ALV
RS_SELFIELD-EXIT = 'X'.
when others.
endcase.Max
‎2008 Jun 24 11:37 AM
Hi
In the user-command after calling the ALV u can set the variable s_selfield-exit in orderr to leave the first ALV:
form user_command using r_ucomm like sy-ucomm rs_selfield type slis_selfield.
data : w_cpt type i.
***sy-lsind = sy-lsind - 1.***
case r_ucomm.
when 'DELETE'.
clear w_cpt.
loop at wt_rec.
check wt_rec-box = 'X'.
delete from zmpmp where werks = wt_rec-werks and
mblnr = wt_rec-mblnr and
mjahr = wt_rec-mjahr .
delete wt_rec .
w_cpt = w_cpt + 1.
endloop.
message w127(zm) with w_cpt.
perform liste_alv.
* LEAVE ALV
RS_SELFIELD-EXIT = 'X'.
when others.
endcase.Max
‎2008 Jun 24 11:39 AM
‎2008 Jun 24 11:42 AM
Hi,
You have to leave to screen 0. This could be the problem. See part of my code below. I had the same problem to as you have. Then I tried leaving th current screen to Screen 0. Then everything worked perfectly as I wanted.
Give points if it helps.
Blacky.
MODULE USER_COMMAND_2000 INPUT.
DATA: LV_STRUCTUER_NAME TYPE DD02L-TABNAME.
DATA: LV_TITLE_TEXT TYPE STRING.
DATA: LV_SCREEN_NR(4) TYPE C.
IF SY-DYNNR = '2000'.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE PROGRAM.
WHEN 'DEL'.
CLEAR: LV_STRUCTUER_NAME,
LV_TITLE_TEXT.
LV_TITLE_TEXT = 'Extracted Delivery data from'.
LV_STRUCTUER_NAME = XXXX.
LV_SCREEN_NR = '3000'.
PERFORM DISPLAY_ALV USING LV_STRUCTUER_NAME
LV_TITLE_TEXT
LV_SCREEN_NR
CHANGING GT_DELIVERY.
WHEN 'PRINT'.
PERFORM WRITE_DYNPRO2000_AS_LIST USING SY-DYNNR SY-REPID.
WHEN OTHERS.
LEAVE TO SCREEN 0.
ENDCASE.
ENDIF.
ENDMODULE. " USER_COMMAND_2000 INPUT
Edited by: BlackMoses on Jun 24, 2008 12:43 PM
‎2008 Jun 24 11:48 AM
It could be simply achieved by setting REFRESH field in USER_COMMAND.
form user_command using r_ucomm like sy-ucomm rs_selfield type
slis_selfield.
data : w_cpt type i.
rs_selfield-REFRESH = 'X'.
case r_ucomm.
when 'DELETE'.
....
reward if useful.