martes, 17 de marzo de 2015

Popup con mensajes de exito o error

form log.

  
datawa_return type bapiret2_t with header line,
        p_command   
type char1,
        p_return    
type char1.

  
loop at gt_return into wa_return.

    
perform fw_inicializa_mensajes.

    
perform fw_registrar_message using wa_return-id " Clase de mensaje
                             wa_return
-type         " tipo
                             wa_return
-number       " num de msg en clase M
                             wa_return
-message_v1   " vars
                             wa_return
-message_v2
                             wa_return
-message_v3
                             wa_return
-message_v4.

  
endloop.

  
perform fw_mostrar_mensajes changing p_command
                                     p_return
.

  
perform fw_finaliza_mensajes.

endform.

**********************************************************

form fw_inicializa_mensajes .

  
call function 'MESSAGES_INITIALIZE'.

endform.                    " FW_INICIALIZA_MENSAJES

form fw_registrar_message  using value(p_msgid" Clase de mensaje
                             
value(p_msgtyp)     " tipo
                             
value(p_msgnr)      " num de msg en clase M
                             
value(p_msgv1)      " vars
                             
value(p_msgv2)
                             
value(p_msgv3)
                             
value(p_msgv4).


  
if sy-batch <> 'X'.
*   Sólo si el proceso no es en fondo
    
call function 'MESSAGE_STORE'
      
exporting
        arbgb                         
p_msgid
*        exception_if_not_active       = ' '
        msgty                         
p_msgtyp
        msgv1                         
p_msgv1
        msgv2                         
p_msgv2
        msgv3                         
p_msgv3
        msgv4                         
p_msgv4
        txtnr                         
p_msgnr
*        zeile                         = gl_posic_mess " l_posic
      
exceptions
        message_type_not_valid        
1
        not_active                    
2
        
others                        3.
  
else.
*   Si es en fondo se lanza el mensaje
    
dataaux_msgty like sy-msgty.
    
aux_msgty p_msgtyp.
    
if aux_msgty 'E' or aux_msgty 'A'.
      aux_msgty 
'I'.
    
endif.
    
message id p_msgid
          
type aux_msgty
        
number p_msgnr
          
with p_msgv1 p_msgv2 p_msgv3 p_msgv4.
  
endif.

endform.                    " FW_REGISTRAR_MESSAGE

form fw_mostrar_mensajes changing p_return p_command.

  datau_command type bal_s_excm.   clearu_commandp_returnp_command.
  call function 'MESSAGES_SHOW'     exporting       batch_list_type    'J' " J job, L spool, B spool y job       i_use_grid         'X'     importing       e_exit_command     u_command
    
    exceptions       inconsistent_range 1       no_messages        2       others             3.
  p_return sy-subrc.
  case 'X'.
    when u_command-back.       p_command 'B'.     when u_command-exit.       p_command 'E'.     when u_command-cancel.       p_command 'C'.     when u_command-continue.       p_command 'K'.     when u_command-external.       p_command 'X'.   endcase.


endform.                    " FW_MOSTRAR_MENSAJES


form fw_finaliza_mensajes .



  call function 'MESSAGES_INITIALIZE'
    
exceptions
      log_not_active       
1
      wrong_identification 
2
      
others               3.

  
call function 'MESSAGES_STOP'
    
exporting
      i_reset_messages  
'X'
    
exceptions
      a_message         
1
      e_message         
2
      w_message         
3
      i_message         
4
      s_message         
5
      deactivated_by_md 
6
      
others            7.

endform.                    " FW_FINALIZA_MENSAJES

No hay comentarios:

Publicar un comentario