ABAP

ABAP
Showing posts with label yetkilendirme. Show all posts
Showing posts with label yetkilendirme. Show all posts

Thursday, January 3, 2013

Authorizations & Roles & Message Class Generator(Mesaj Class Yaratma Programı Batch)


suim  --->> user information system
 pfcg --- >> role maintenance

su21 --- >> maintain authorization objects
se54 --- >> auth group cr.



constants :
       gc_app(1)   type c value  'Y',
       gc_mc(25type c value  'Message Class For'.


data : gt_bdcdata like bdcdata    occurs 0 with header line,
       gt_messtab like bdcmsgcoll occurs 0 with header line,
       gt_data1   type table of yutbc0002 with header line,
       gt_cname   type table of yutbc0001 with header line,
       gv_record  type string,
       gv_color,
       lt_t100a   type table of t100a with header line,
       lv_name    type string,
       ls_opt     like  ctu_params.


 data : begin of gt_messall occurs 0,
        message(255),
        end of gt_messall.

*--SELECTION-SCREEN
selection-screen : begin of block b1 with frame title text-001.
parameters : p_cntry like yutbc0001-cntry obligatory matchcode object
             yubczz01,
             p_reqno like ko008-trkorr,
             p_mode  like ctu_params-dismode obligatory default 'A'.

selection-screen : end of block b1.


start-of-selection.

  perform selection.

  loop at gt_data1.

    concatenate gc_app p_cntry gt_data1-spmdl into gv_record.
    perform cname.
    perform check.

  endloop.
*====================================================================*
*  Form : selection                                                *
*====================================================================*
form selection.

  select spmdl from yutbc0002
               into corresponding fields of table gt_data1.

  select * from yutbc0001
           into corresponding fields of table gt_cname.

endform.                    "selection
*====================================================================*
*  Form : cname                                                     *
*====================================================================*
form cname.

  clear lv_name.
  read table gt_cname
  with key cntry = p_cntry.
  if sy-subrc eq 0.
    if p_cntry eq gt_cname-cntry.
      concatenate gc_mc gt_data1-spmdl gt_cname-descr
      into lv_name
       separated by space.
    endif.
  endif.

endform.                    "cname
*====================================================================*
*  Form : fiil                                                        *
*====================================================================*
form fill.

    perform fill_bdcdata using 'SAPLWBMESSAGES' '0100' 'X' '' ''.
    perform fill_bdcdata using '' '' '' 'BDC_CURSOR' 'RSDAG-ARBGB'.
    perform fill_bdcdata using '' '' '' 'RSDAG-ARBGB' gv_record.
    perform fill_bdcdata using '' '' '' 'BDC_OKCODE' '=WB_CREATE'.
    perform fill_bdcdata using '' '' '' 'RSDAG-MSGFLAG' 'X'.


    perform fill_bdcdata using 'SAPLWBMESSAGES' '1000' 'X' '' ''.
    perform fill_bdcdata using '' '' '' 'BDC_OKCODE' '=MESS'.
    perform fill_bdcdata using '' '' '' 'BDC_SUBSCR'
           'SAPLWBMESSAGES                          0102SUB'.
    perform fill_bdcdata using '' '' '' 'BDC_CURSOR' 'T100A-STEXT'.
    perform fill_bdcdata using '' '' '' 'T100A-RESPUSER' 'SOZYURT'.
    perform fill_bdcdata using '' '' '' 'T100A-STEXT' lv_name.


    perform fill_bdcdata using 'SAPLSTRD' '0100' 'X' '' ''.
    perform fill_bdcdata using '' '' '' 'BDC_CURSOR' 'KO007-L_DEVCLASS'.
    perform fill_bdcdata using '' '' '' 'BDC_OKCODE' '=ADD'.
    perform fill_bdcdata using '' '' '' 'KO007-L_DEVCLASS' gv_record.
    perform fill_bdcdata using '' '' '' 'KO007-L_AUTHOR' sy-uname.


    perform fill_bdcdata using 'SAPLSTRD' '0300' 'X' '' ''.
    perform fill_bdcdata using '' '' '' 'BDC_CURSOR' 'KO008-TRKORR'.
    perform fill_bdcdata using '' '' '' 'BDC_OKCODE' '=LOCK'.
    perform fill_bdcdata using '' '' '' 'KO008-TRKORR' p_reqno.


    perform fill_bdcdata using 'SAPLWBMESSAGES' '1000' 'X' '' ''.
    perform fill_bdcdata using '' '' '' 'BDC_OKCODE' '=WB_SAVE'.
    perform fill_bdcdata using '' '' '' 'BDC_SUBSCR'
          'SAPLWBMESSAGES                          0101SUB'.
    perform fill_bdcdata using '' '' '' 'NUMMER' '000'.
    perform fill_bdcdata using '' '' '' 'T100-TEXT(01)' '& & & &'.


    perform fill_bdcdata using 'SAPLWBMESSAGES' '1000' 'X' '' ''.
    perform fill_bdcdata using '' '' '' 'BDC_OKCODE' '=WB_BACK'.
    perform fill_bdcdata using '' '' '' 'BDC_SUBSCR'
          'SAPLWBMESSAGES                          0101SUB'.
    perform fill_bdcdata using '' '' '' 'BDC_CURSOR' 'NUMMER'.
    perform fill_bdcdata using '' '' '' 'NUMMER' '000'.


    perform fill_bdcdata using 'SAPLWBMESSAGES' '0100' 'X' '' ''.
    perform fill_bdcdata using '' '' '' 'BDC_CURSOR' 'RSDAG-ARBGB'.
    perform fill_bdcdata using '' '' '' 'BDC_OKCODE' '=WB_BACK'.
    perform fill_bdcdata using '' '' '' 'RSDAG-ARBGB' ''.
    perform fill_bdcdata using '' '' '' 'RSDAG-MSGFLAG' 'X'.


endform.                    "fill
*====================================================================*
*  Form : fill_bdcdata                                                *
*====================================================================*
form fill_bdcdata  using  p1 p2 p3 p4 p5.
     gt_bdcdata-program  = p1.
     gt_bdcdata-dynpro   = p2.
     gt_bdcdata-dynbegin = p3.
     gt_bdcdata-fnam     = p4.
     gt_bdcdata-fval     = p5.

  append gt_bdcdata.
endform.                    "fill_bdcdata
*====================================================================*
*  Form : call_transaction_se91                                       *
*====================================================================*
form call_transaction_se91 using prf_record.

  ls_opt-dismode =  p_mode.

  call transaction 'SE91' using gt_bdcdata options from ls_opt
  messages into gt_messtab.

  clear : gt_bdcdata,gt_bdcdata[].


  loop at gt_messtab.

    message id gt_messtab-msgid type gt_messtab-msgtyp
    number gt_messtab-msgnr
    with gt_messtab-msgv1 gt_messtab-msgv2 gt_messtab-msgv3
    gt_messtab-msgv4
    into gt_messall-message.



    at first.
      write : / 'For Message Class' color = 1, gv_record color = 1.
      uline.
      uline.
    endat.
      write : gt_messall-message.

  endloop.
    clear gt_messtab[].
  uline.
endform.                         "call_transaction_se91
*====================================================================*
*  Form : check                                                       *
*====================================================================*
form check.
  select * from t100a into corresponding fields of table lt_t100a.
  read table lt_t100a with key arbgb = gv_record.

  if lt_t100a-arbgb eq gv_record.


    write : / 'For Message Class' color = 1 , gv_record color = 1.
    write : / 'Message Class Exist' color = 6.
    uline.
  else.
    perform fill.
    perform call_transaction_se91 using gv_record.
  endif.

endform.                    "check

Monday, April 11, 2011

Authorization

*** Kayıt Silmeli Auth ***

LOOP AT gt_filedata.

(lv_tabix = sy-tabix.)
authority-check object 'YRGNPM01'
                         id 'ACTVT' field '01'
                         id 'WERKS' field gt_filedata-werks.

if sy-subrc ne 0
delete gt_filedata (index lv_tabix).
lv_check = 'X'.
continue.
endif.



  if lv_check is not initial.
    message text-005 type 'I'.
  endif.


**** Kontrol ve mesaj parametre


  form f_authority_check .

      AUTHORITY-CHECK OBJECT 'YRGNMM10'
       ID 'CEERKRS' FIELD p_erkrs
       ID 'ACTVT' field '03'.

      IF sy-subrc <> 0.
        MESSAGE e001(yuauth) WITH p_erkrs.

      ENDIF.

endform.


*** Çoklu (Select-options) da Authorization 2

 1- data: lr_vkorg like table of sdsls_vkorg_range.
  call function 'YUSD_AUTHORITY_CHECK'
    exporting
      r_vkorg   = s_vkorg[]
      chk_vkorg = 'X'
    tables
      er_vkorg  = lr_vkorg.

  if lr_vkorg[] is initial.
    message e130(yusd) with s_vkorg-low s_vkorg-high.
  endif.
  clear : s_vkorg[], s_vkorg.
  s_vkorg[] = lr_vkorg[].



2-form f_authority_check_bukrs .
data : begin of lt_t001 occurs 0,
         bukrs like t001-bukrs,
         end of lt_t001.

  clear : lt_t001, lt_t001[].

  select bukrs into table lt_t001
               from t001
               where bukrs in s_bukrs.
  clear : s_bukrs, s_bukrs[].
  loop at lt_t001.
    authority-check object 'YRGNCO01'
              id 'BUKRS' field lt_t001-bukrs
              id 'ACTVT' field '03'.
    if sy-subrc eq 0.
      s_bukrs-sign    = 'I'  .
      s_bukrs-option  = 'EQ' .
      s_bukrs-low     = lt_t001-bukrs.
      append s_bukrs.
    endif.
  endloop.
  if s_bukrs[] is initial.
    message e000(yuauth) with text-001.
  endif.
endform.


Total Pageviews