Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

fm view_maintenance_call inside user-exit rv60afzz

$
0
0

Hi All

 

Please I need some help..

 

I created an abap code (SAP version 4.7) and it is working properly.  I am using the fm view_maintenance_call inside the user-exit rv60afzz (form userexit_pricing_prepare_tkomp). This fm calls SM30 and the user has to enter some data in a Z transparent table.

 

My question:  when the user inserts data in the Z transparent table and save it, is it a correct process? I mean, the SAVE button will trigger a commit work, inside the user-exit? I am worried about it.

 

Please advise. Below the abap code.

 

   if  sy-tcode = 'VF01' and
    sy-ucomm = 'SICH'      "gravação selecionada
and sy-uname = 'GAIAJOA'"<===== tirar !!!!

* definicao de variaveis
  data: l_steuc type marc-steuc       , "NCM do material
        l_user  type usr02-bname      ,
        p_view  like dd02v-tabname
                value 'ZXVBRP_ICMS_ST'.

* definicao de tabelas transparentes
  tables: zxvbrp_icms_st.

* definicao tabela auxiliar
  types:
    begin of ty_zxvbrp_icms_st.
          include structure zxvbrp_icms_st.
  types  flag_tax(01) type c. "indica se o item sera exibido no popup
  types:
    end of   ty_zxvbrp_icms_st.

  data: it_zxvbrp_icms_st    type standard table of ty_zxvbrp_icms_st,
        wa_zxvbrp_icms_st type                   ty_zxvbrp_icms_st.

* definicao de constantes
  constants:
        c_mensagem_01(040) type c value
        'Usuário sem autorização p/entrar ICMS-ST' ,
        c_mensagem_02(021) type c value
        'Obrigatório informar.'.

* inicio
  refresh it_zxvbrp_icms_st.
  clear   wa_zxvbrp_icms_st.

  loop at xvbrp.

* obter o NCM do material
    clear  l_steuc.
    select single steuc
           from   marc
           into   l_steuc
           where  matnr = xvbrp-matnr and
                  werks = xvbrp-werks.

    if sy-subrc eq 0.

* Verificar na tabela ZSD_ICMS_ST a existencia deste parametros.
* Caso exista registro, será necessario
* exibir pop-up para entrar valor do ICMS-ST.
* Esta entrada de imposto é para cada item e somente usuarios cadastrados
* tem autorizacao

      select single ncm
             from   zsd_icms_st
             into   l_steuc
             where  shipfrom = xvbrp-wkreg         and
                    shipto   = xvbrp-regio_auft    and
                    ncm      = l_steuc             and
                    tax      = xvbrp-j_1btaxlw1.

      if sy-subrc eq 0.

        movexvbrp-posnr  to wa_zxvbrp_icms_st-posnr   ,
               xvbrp-matnr  to wa_zxvbrp_icms_st-matnr   ,
               xvbrp-arktx  to wa_zxvbrp_icms_st-arktx   .
        clear:                 wa_zxvbrp_icms_st-tax     ,
                               wa_zxvbrp_icms_st-taxval  ,
                               wa_zxvbrp_icms_st-othbas  .
        move   'X'          to wa_zxvbrp_icms_st-flag_tax.
        append wa_zxvbrp_icms_st to it_zxvbrp_icms_st.

      endif.

    endif.

  endloop.

*   verifica se o usuario tem autorizacao para entrar valor dos impostos
  clear  l_user.
  select single bname
         from   zsd_icms_st_user
         into   l_user
         where  bname = sy-uname.

  if sy-subrc eq 0.
*   usuario tem autorizacao. Carrega tabela/chama SM30/exporta p/memoria

*   carrega tabela transparente
    modify zxvbrp_icms_st from table it_zxvbrp_icms_st.

*   chamada da SM30 para entrada dos impostos
    call function 'VIEW_MAINTENANCE_CALL'
      exporting
        action                       = 'U'
        view_name                    = p_view  "maint.View
      exceptions
        client_reference             = 1
        foreign_lock                 = 2
        invalid_action               = 3
        no_clientindependent_auth    = 4
        no_database_function         = 5
        no_editor_function           = 6
        no_show_auth                 = 7
        no_tvdir_entry               = 8
        no_upd_auth                  = 9
        only_show_allowed            = 10
        system_failure               = 11
        unknown_field_in_dba_sellist = 12
        view_not_found               = 13
        others                       = 14.

*   exporta dados para a memoria
**



  else.
*   usuario nao tem autorizacao. mas é obrigatorio  entrar impostos
    message e997(zi) with c_mensagem_01 c_mensagem_02.
  endif.

endif.

Thanks in advance.

João Gaia


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>