************************************************************************
* Programa: ZM00SMENU *
* Autor : S2D *
* Fecha : 02-01-01/[Desconocida] *
************************************************************************
* Este cdigo fuente no necesita ser actualizado. Tal vez reparado, *
* pero no actualizado. *
* *
* Cuando se quiera crear un men nuevo, simplemente se crea una *
* superficie. Para que quede ms bonito se puede crear un ttulo *
* con el mismo nombre que la superficie. *
* *
* Existe una forma de ir directamente a una superficie con la *
* variable. *
* RUNME donde pondremos la superficie inicial. Por defecto 'ZM00'. *
* Es posible adaptarlo para que arranque con la standard MEN, pero *
* habra que diseñarla. *
* Tambin se puede utilizar la variable de parametros de usuarios *
* ZRUNMENU pasandole la superficie que quieras iniciar *
* *
* Actualmente este report trabaja con una dynpro, pero tambin *
* puede ejecutarse como report. Obteniendo otros resultados. *
************************************************************************
report zm00smenu no standard page heading.
* Tablas necesarias para recuperar superficies y funciones.
tables: eudb, tstc.
* Datos internos de programa
data:
begin of tab occurs 10,
fcode like rsmpe-func,
end of tab,
pila(20) occurs 0 with header line,
begin of sitab occurs 0,
code(20),
modal(01),
actcode(20),
pfkcode(20),
butcode(4),
end of sitab,
begin of nameprg,
name(40),
sprls(1),
end of nameprg,
int_fun like rsmpe_fun occurs 0 with header line,
runme(20),
onetime(1),
pilai type p,
aplica(1),
caracter(20).
at user-command.
* Preparado para convertirse en report...
perform selecion.
end-of-selection.
perform bout2.
form selecion.
* Refresh tab.
* Cmp si lo que se nos ha pulsado es un Status.
loop at sitab where code = sy-ucomm. exit. endloop.
* Es otro men de superficie
if sy-ucomm = 'BACK'.
************************************************************************
** OK! OK! El BACK Se podra haber solucionado de otra forma. **
************************************************************************
describe table pila lines pilai.
pilai = pilai - 1.
if pilai <= 0.
leave program.
endif.
read table pila index pilai.
sy-ucomm = pila.
pilai = pilai + 1. delete pila index pilai.
pilai = pilai - 1. delete pila index pilai.
clear sy-subrc.
endif.
if sy-subrc = '0'.
runme = sy-ucomm.
perform pon_status using sy-ucomm.
else.
* Es una transaccin.
select single * from tstc where tcode = sy-ucomm.
check sy-subrc eq 0.
* BREAK-POINT.
* Realmente es una transaccin
if tstc-cinfo ne '01'.
call transaction sy-ucomm.
* Es un men de ambito.
else.
leave to transaction sy-ucomm.
endif.
endif.
endform.
form bout2.
data: xrunme like runme.
if onetime = ' '.
include zmin0000.
* Si existe parmetro, llamamos directamente.
get parameter id 'ZRUNME' field runme.
* En RunMe estar el programa de inicio.
if runme is initial. runme = 'ZM00'. endif.
get parameter id 'ZRUNMENU' field xrunme.
if xrunme is initial and runme is initial. runme = 'ZM00'. endif.
* Dejamos en memoria el identificativo para el aplicativo MARES.
call function 'Z_GET_PARAMETER_APLICA'
importing
d_aplica = aplica
exceptions
others = 1.
if aplica is initial.
set parameter id 'ZID_APLICA' field ' '.
call function 'Z_SET_PARAMETER_APLICA'
exporting
d_aplica = 'M'.
endif.
*Forzamos a la creacin del aplicativo...
if xrunme+0(3) = 'ZMC' or runme+0(3) = 'ZMC'.
set parameter id 'ZID_APLICA' field ' '.
call function 'Z_SET_PARAMETER_APLICA'
exporting
d_aplica = 'C'.
else.
set parameter id 'ZID_APLICA' field ' '.
call function 'Z_SET_PARAMETER_APLICA'
exporting
d_aplica = 'M'.
endif.
* Obtenemos los status asociados a nuestro programa.
nameprg-name = sy-repid. nameprg-sprls = 'D'.
* Cargamos todas las funciones y todos los status
import sta to sitab from database eudb(cu) id nameprg.
import fun to int_fun from database eudb(cu) id nameprg.
* Comprobamos la existencia de los status y las funciones.
loop at int_fun.
select single * from tstc where tcode = int_fun-code.
check int_fun-code+0(1) ne '%'.
check int_fun-code ne 'BACK'.
check int_fun-code ne 'CANC'.
* No vamos a permitir menus de superficie.
if sy-subrc ne 0 or ( sy-subrc = 0 and tstc-cinfo = '01' ) or
int_fun-code = 'ZMZZ'.
read table sitab with key code = int_fun-code.
if sy-subrc ne 0 or int_fun-code = 'ZMZZ'.
read table tab with key fcode = int_fun-code.
if sy-subrc ne 0.
* Desactivamos las funciones no vlidas
append int_fun-code to tab.
else.
perform seguridad. check sy-subrc ne 0.
append int_fun-code to tab.
endif.
else.
perform seguridad. check sy-subrc ne 0.
append int_fun-code to tab.
endif.
else.
perform seguridad. check sy-subrc ne 0.
append int_fun-code to tab.
endif.
endloop.
* Primer Status
endif.
onetime = 'X'.
perform pon_status using runme.
endform.
form pon_status using sycode.
set pf-status sycode excluding tab.
set titlebar sycode.
if sy-subrc ne 0.
set titlebar sy-repid. endif
.
pila = sycode.
collect pila.
runme = sycode.
write: ' '.
endform.
form seguridad.
authority-check object 'S_TCODE' id 'TCD' field int_fun-code+0(10).
endform.
module bin input. perform selecion. endmodule.
module bout output. perform bout2. endmodule.