FM to Create Transport Request


Function module to create transport request with code.

Import Parameters:

import

Result:

 result

Codes:

FUNCTION ZTB_CREATE_TRANSPORT_REQUEST.

*”———————————————————————-

*”*”Local Interface:

*”  IMPORTING

*”     REFERENCE(I_TYPE) TYPE  STRING

*”     REFERENCE(I_TEXT) TYPE  STRING OPTIONAL

*”     REFERENCE(I_OWNER) TYPE  STRING OPTIONAL

*”     REFERENCE(I_TARGET) TYPE  STRING

*”     REFERENCE(IT_USERS) TYPE  STRING_TABLE OPTIONAL

*”———————————————————————-

* iv_type = ‘W’ or iv_type = ‘K’

* W – Customized

* K – Workbench request

* iv_text   = Description of request

* iv_owner  = Owner of the request

* iv_target = Target system of request

* it_users  = Users who want to create task

typestrwbo_charflag(1type c.

typesbegin of trwbo_request_header.

include   structure e070.

typesas4text        like e07tas4text,

       as4text_filled type trwbo_charflag,

       client         like e070cclient,

       tarclient      like e070ctarclient,

       clients_filled type trwbo_charflag,

       tardevcl       like e070mtardevcl,

       devclass       like e070mdevclass,

       tarlayer       like e070mtarlayer,

       e070m_filled   type trwbo_charflag,

       end of   trwbo_request_header.

typestrwbo_request_headers type trwbo_request_header  occurs 0.

data:

“Import Data

lv_type   type trfunction,

lv_text   type as4text,

lv_owner  type as4user,

lv_target type tr_target,

lt_users  type scts_users,

ls_users  type scts_user,

“Export Data

ls_request_header type trwbo_request_header,

lt_task_headers   type trwbo_request_headers,

“General Data

lv_string type string.

lv_type   i_type.

lv_text   i_text.

lv_owner  i_owner.

if lv_owner is initial.

   lv_owner syuname.

endif.

lv_target i_target.

loop at it_users into lv_string.

  clear ls_users.

  ls_usersuser lv_string.

  ls_userstype lv_type.

  append ls_users to lt_users.

endloop.

call function ‘TR_INSERT_REQUEST_WITH_TASKS’

  exporting

    iv_type           lv_type

    iv_text           lv_text

    iv_owner          lv_owner

    iv_target         lv_target

*   it_attributes     =

    it_users          lt_users

*   iv_tardevcl       =

*   iv_devclass       =

*   iv_tarlayer       =

 importing

   es_request_header ls_request_header

   et_task_headers   lt_task_headers

* exceptions

*   insert_failed     = 1

*   enqueue_failed    = 2

*   others            = 3

.

Leave a comment

Your email address will not be published. Required fields are marked *