SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Транзакция с параметром



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
Сергей
Участник
Участник



Joined: 25 Oct 2007
Posts: 49

PostPosted: Fri Dec 28, 2007 2:12 pm    Post subject: Транзакция с параметром Reply with quote

Столкнулся с проблемой при проверке авторизации по имени транзакции.

Создана транзакция с параметром, z_respo
в качестве транзакции указывается другая
транзакция OOCU_RESP
и параметр P1000-OBJID = 90600006

В процессе записи вызывается user-exit в котором нужно проверить авторизацию

AUTHORITY-CHECK OBJECT 'Z_BUKRS'
ID 'BUKRS' FIELD L_BUKRS
ID 'TCODE' FIELD SY-TCODE.

sy-tcode указывает OOCU_RESP, но бизнес требует, чтобы авторизация проверялась на транзакцию, которую непосредственно запустил пользователь - z_respo.

???
Back to top
View user's profile Send private message
John Doe
Модератор
Модератор


Age: 45
Joined: 05 Nov 2007
Posts: 725
Location: КраснАдар

PostPosted: Fri Dec 28, 2007 2:15 pm    Post subject: Reply with quote

Существуют какие-либо препятствия, чтобы дать пользователю полномочия на транзакцию OOCU_RESP?
Back to top
View user's profile Send private message Blog
Сергей
Участник
Участник



Joined: 25 Oct 2007
Posts: 49

PostPosted: Fri Dec 28, 2007 2:26 pm    Post subject: Reply with quote

Если решения не найдется, то придется этой транзакции давать.
У нас внутренний контроль требует, что авторизация проверялась по имени запущенной транзакции, видимо так гибче настраивать. Иначе придется объяснять.


Last edited by Сергей on Fri Dec 28, 2007 2:36 pm; edited 1 time in total
Back to top
View user's profile Send private message
John Doe
Модератор
Модератор


Age: 45
Joined: 05 Nov 2007
Posts: 725
Location: КраснАдар

PostPosted: Fri Dec 28, 2007 2:28 pm    Post subject: Reply with quote

Тогда перед проверкой запустите ФМ RS_PARAMETER_TRANSACTION_GET, и проверяйте не sy-tcode, а значение этого ФМ.
Back to top
View user's profile Send private message Blog
mike1
Модератор
Модератор



Joined: 22 Nov 2007
Posts: 82

PostPosted: Fri Dec 28, 2007 2:31 pm    Post subject: Reply with quote

Вроде должна помочь функция RS_HDSYS_GET_TCODE и ее параметр param_tcode.
Back to top
View user's profile Send private message
Сергей
Участник
Участник



Joined: 25 Oct 2007
Posts: 49

PostPosted: Fri Dec 28, 2007 2:34 pm    Post subject: Reply with quote

John Doe wrote:
Тогда перед проверкой запустите ФМ RS_PARAMETER_TRANSACTION_GET, и проверяйте не sy-tcode, а значение этого ФМ.


У нас этот ФМ пустышка, в нем ничего нет Crying or Very sad
Можете код внутреннестей привести?

mike1 wrote:
Вроде должна помочь функция RS_HDSYS_GET_TCODE и ее параметр param_tcode.


Пустой param_tcode возвратил:
call function 'RS_HDSYS_GET_TCODE'
importing
PARAM_TCODE = l_tcode.
Back to top
View user's profile Send private message
John Doe
Модератор
Модератор


Age: 45
Joined: 05 Nov 2007
Posts: 725
Location: КраснАдар

PostPosted: Fri Dec 28, 2007 3:30 pm    Post subject: Reply with quote

Code:
function rs_parameter_transaction_get.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     REFERENCE(P_CALLED_TRANSACTION) TYPE  TCODE OPTIONAL
*"     REFERENCE(P_PARAMETERS) TYPE  S_PARAM OPTIONAL
*"  EXPORTING
*"     REFERENCE(P_TRANSACTIONS) TYPE  S_TCODES
*"  EXCEPTIONS
*"      NO_SPECIFICATION
*"      NOT_FOUND
*"----------------------------------------------------------------------
  data: l_param type tcdparam,
        l_tstcp type table of tstcp,
        l_h_tstcp type tstcp,
        l_h_parameters type rsparam,
        l_tstc type table of tstc,
        l_h_tstc type tstc,
        l_pvs type s_param,
        l_h_pvs type rsparam,
        l_called_tcode type tcode,
        l_error.

* Vorselektion
  if not p_called_transaction is initial.
*    gerufene Transaktion bekannt
     concatenate '%' p_called_transaction '%' into l_param.
  else.
     read table p_parameters index 1 into l_h_parameters.
     if sy-subrc ne 0. raise no_specification. endif.
*    Parametername bekannt
     if not l_h_parameters-field is initial.
        concatenate '%' l_h_parameters-field '%' into l_param.
     elseif not l_h_parameters-value is initial.
*       Parameterinhalt bekannt
        concatenate '%' l_h_parameters-value '%' into l_param.
     else.
        raise no_specification.
     endif.
   endif.
   select * from tstcp into table l_tstcp
            where param like l_param.
   if sy-subrc ne 0. raise not_found. endif.
*
*  Prufung: Sind gefundene Transaktionen Parametertransaktionen? /
*  Feinselektion
   select * from tstc into table l_tstc
            for all entries in l_tstcp
            where tcode = l_tstcp-tcode.
   sort l_tstc by tcode.
   loop at l_tstcp into l_h_tstcp.
     read table l_tstc into l_h_tstc
                       with key tcode = l_h_tstcp-tcode
                       binary search.
     if sy-subrc ne 0. continue. endif.
     if not l_h_tstc-cinfo o hex_par. continue. endif.
*    Zerlege String
     perform split_parameters_internal using l_h_tstcp-param
                                       changing l_called_tcode l_pvs.
*    Prufe gegen Eingaben
*    Transaktionscode
     if not p_called_transaction is initial and
        l_called_tcode ne p_called_transaction.
        continue.
     endif.
*    Parameterwerte
     l_error = c_false.
     loop at p_parameters into l_h_parameters.
       if not l_h_parameters-field is initial.
          read table l_pvs with key field = l_h_parameters-field
                     into l_h_pvs.
          if sy-subrc ne 0. l_error = c_true. continue. endif.
          if not l_h_parameters-value is initial and
             l_h_parameters-value ne l_h_pvs-value.
             l_error = c_true.
             continue.
          endif.
       elseif not l_h_parameters-value is initial.
          read table l_pvs with key value = l_h_parameters-value
                     into l_h_pvs.
          if sy-subrc ne 0. l_error = c_true. continue. endif.
          if l_h_pvs-value ne l_h_parameters-value.
             l_error = c_true.
             continue.
          endif.
       endif.
     endloop.
*    Parametertransaktion entspricht den geforderten Werten
     if l_error = c_false.
        append l_h_tstcp-tcode to p_transactions.
     endif.
   endloop.
endfunction.

form split_parameters_internal using value(p_string) type tcdparam
                               changing p_called_tcode type tcode
                                        p_param type s_param.
  field-symbols <f>.
  data: param_beg type i,
        h_param type rsparam.

  clear p_param.
  if p_string(1) = '\'.             " OO-Transaktion ohne FR
     exit.
  elseif p_string(1) = '@'.         " Transaktionsvariante
    exit.
  elseif p_string(1) = '/'.
    if p_string ca ' '. endif.
    param_beg = sy-fdpos + 1.
    subtract 2 from sy-fdpos.
    if sy-fdpos gt 0.
      p_called_tcode = p_string+2(sy-fdpos).
    endif.
    shift p_string by param_beg places.
  endif.

  do 254 times.
    if p_string = space. exit. endif.
    clear h_param.
    condense p_string no-gaps.
    if p_string ca '='.
      check sy-fdpos ne 0.
      assign p_string(sy-fdpos) to <f>.
      h_param-field = <f>.
      if h_param-field(1) = space. shift h_param-field. endif.
      sy-fdpos = sy-fdpos + 1.
      shift p_string by sy-fdpos places.
      if p_string ca ';'.
        if sy-fdpos ne 0.
          assign p_string(sy-fdpos) to <f>.
          h_param-value = <f>.
          if h_param-value(1) = space. shift h_param-value. endif.
        endif.
        sy-fdpos = sy-fdpos + 1.
        shift p_string by sy-fdpos places.
        append h_param to p_param.
      elseif p_string ca ' '.       " Da _____; moglich
        check sy-fdpos ne 0.
        assign p_string(sy-fdpos) to <f>.
        h_param-value = <f>.
        if h_param-value(1) = space. shift h_param-value. endif.
        sy-fdpos = sy-fdpos + 1.
        shift p_string by sy-fdpos places.
        append h_param to p_param.
      endif.
    endif.
  enddo.
endform.                               " SPLIT_PARAMETERS
Back to top
View user's profile Send private message Blog
Сергей
Участник
Участник



Joined: 25 Oct 2007
Posts: 49

PostPosted: Fri Dec 28, 2007 4:07 pm    Post subject: Reply with quote

Все понятно, прямое чтение таблицы
TSTCP
Code:

TCODE             PARAM
Z_RESPO          /*OOCU_RESP P1000-OBJID=90600006;

так и сделал. Спасибо!

Code:
* get current tcode (if any)
DATA: l_tcode TYPE tstcp-tcode,
          l_param TYPE tstcp-param VALUE '/*%1 P1000-OBJID=%2;'.

    l_tcode = sy-tcode.
    REPLACE '%1' WITH sy-tcode INTO l_param.
    REPLACE '%2' WITH ls_i1218-ext_objid INTO l_param.
    CONDENSE l_param.
    SELECT SINGLE tcode FROM tstcp INTO l_tcode
       WHERE param LIKE l_param.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.