Posted: Sun Mar 02, 2008 12:49 pm Post subject: Howto transport Travel expenses across SAP systems…
Howto transport Travel expenses across SAP systems…
Original: geocities.com/krapinskij/TRV2CR.htm
It happens that there are systems with identical customizing (fed from the same DEV system automatically) that are used to hold data of different employees.
Whatever reason there might be to do so I think it is somewhat crazy, but it happens.
Prerequisites:
First of all we need to identify what travel expense for an employee are:
1) Transparent table PTRV_HEAD (subkey pernr reinr)
2) Transparent table PTRV_PERIO (subkey pernr reinr)
3) Cluster TE in table PCL1 (srtfd pernr(8 ) concatenated with reinr(10))
In this few thoughts I ignore the versioning of the travel expenses because I want to take all versions with me in the new system.
Todays task:
move the travel expenses from one system to the other, without having an RFC from one system to the other.
Solution:
write the data to a Transport request (pro: one program only. Con: depending on the system it might be quite hard to write data to a Transport request)
Alternatives could have been to create an RFC and use it to transfer the data (provide Unicode is the same and releases are the same) (cons: requires to open ports in a firewall and requires 2 programs to be written) or to download the data to a file (cons: requires 2 programs and is quite error prone)
The program:
The program is quite simple it uses a simple local class to write data to a transport request.
The selection part of the Travel expenses data is really trivial.
Here it is:
Code:
*
*Copyright (C) 2006 Krapinskij ([email protected])
*
*This program is free software; you can redistribute it and/or
*modify it under the terms of the GNU General Public License
*as published by the Free Software Foundation; either version 2
*of the License, or (at your option) any later version.
*
*This program is distributed in the hope that it will be useful,
*but WITHOUT ANY WARRANTY; without even the implied warranty of
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*GNU General Public License for more details.
*
*You should have received a copy of the GNU General Public License
*along with this program; if not, write to the Free Software
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*REPORT z_trv_2_cr .
TABLES: t777d, pcl1.
PARAMETERS: wbtrkorr TYPE trkorr.
*Here put the pernr concateneted with the trip number
SELECT-OPTIONS: cidreinr FOR pcl1-srtfd.
DATA uname TYPE sy-uname.
INITIALIZATION.
uname = sy-uname.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR wbtrkorr.
PERFORM select_tr_korr USING uname 'SYST' CHANGING wbtrkorr.
*---------------------------------------------------------------------*
* CLASS lcl_tabu_k_2_trkorr_writer DEFINITION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
CLASS lcl_tabu_k_2_trkorr_writer DEFINITION.
PUBLIC SECTION.
* gets the name of the receiver given the temse file type.
METHODS: init IMPORTING p_trkorr TYPE trkorr
p_wb_trkorr TYPE trkorr
p_tabname TYPE tabname
CHANGING p_error TYPE i.
METHODS: write_to_trkorr CHANGING p_error TYPE i.
METHODS: add_line_key IMPORTING p_line TYPE any
CHANGING p_error TYPE i .
METHODS: add_object IMPORTING pgmid TYPE pgmid
object TYPE trobjtype
obj_name TYPE trobj_name
p_trkorr TYPE trkorr
CHANGING p_error TYPE i .
METHODS: add_star_key CHANGING p_error TYPE i .
METHODS: get_metahead CHANGING p_error TYPE i.
PRIVATE SECTION.
DATA: a_trkorr TYPE trkorr.
DATA: a_wb_trkorr TYPE trkorr.
DATA: as_obj TYPE LINE OF tredt_objects.
DATA: as_metahead TYPE x030l.
DATA: a_tabname TYPE tabname.
DATA: ar_typedescr TYPE REF TO cl_abap_typedescr.
DATA: ar_tableline TYPE REF TO data.
DATA: at_key TYPE tredt_keys.
ENDCLASS. "DEFINITION
*---------------------------------------------------------------------*
* CLASS lcl_tabu_k_2_trkorr_writer IMPLEMENTATION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
CLASS lcl_tabu_k_2_trkorr_writer IMPLEMENTATION.
* Initialize entry for table key transport
MOVE-CORRESPONDING as_obj TO ls_key.
ls_key-objname = as_obj-obj_name.
ls_key-objfunc = space.
ls_key-mastername = as_obj-obj_name.
ls_key-mastertype = as_obj-object.
* Extract tablekey
CLEAR ls_key-tabkey.
ASSIGN ls_key-tabkey TO <lv_xtabkey> CASTING.
* If table has fields of type STRING or RAWSTRING, casting to type
* 'X' is not possible -> generic solution unknown -> indiv. handling
CASE as_metahead-tabname.
WHEN 'PCL2' OR 'PCL1'.
DATA l_key(46) TYPE c.
l_key+0(45) = p_line.
l_key+45(1) = '*'.
ASSIGN l_key TO <lv_xtableline> CASTING.
<lv_xtabkey>(46) = <lv_xtableline>(46).
INSERT ls_key INTO TABLE at_key.
EXIT.
WHEN OTHERS.
ASSIGN p_line TO <lv_xtableline> CASTING.
ENDCASE.
* Insert key of tableline into transport request
INSERT ls_key INTO TABLE at_key.
ENDMETHOD.
METHOD: write_to_trkorr.
DATA lt_ko200 TYPE TABLE OF ko200.
DATA ls_e071 TYPE e071.
IF as_obj IS INITIAL.
EXIT.
ENDIF.
IF as_obj-objfunc = 'K' AND
at_key IS INITIAL.
EXIT.
ENDIF.
APPEND as_obj TO lt_ko200.
** Check data for transport request
* Add data to transport request
CALL FUNCTION 'TR_OBJECTS_CHECK'
TABLES
wt_ko200 = lt_ko200
wt_e071k = at_key
EXCEPTIONS
OTHERS = 1.
START-OF-SELECTION.
DATA l_cnt TYPE i.
DATA l_cnt_cid TYPE i.
CLEAR l_cnt.
CLEAR l_cnt_cid.
DATA lt_pcl1 TYPE TABLE OF pcl1.
DATA ls_pcl1 TYPE pcl1.
DATA lt_perio TYPE TABLE OF ptrv_perio.
DATA lt_head TYPE TABLE OF ptrv_head.
DATA ls_head TYPE ptrv_head.
DATA lt_tperio TYPE TABLE OF ptrv_perio.
DATA ls_perio TYPE ptrv_perio.
DATA l_error TYPE i.
DATA l_tabname1 TYPE tabname VALUE 'PCL1'.
DATA lr_trkk TYPE REF TO lcl_tabu_k_2_trkorr_writer .
IF lr_trkk IS INITIAL.
CREATE OBJECT lr_trkk.
ENDIF.
LOOP AT cidreinr.
cidreinr-low+18(1) = '%'.
SELECT * FROM pcl1 APPENDING TABLE lt_pcl1 WHERE relid = 'TE' AND
srtfd LIKE cidreinr-low.
l_cnt = l_cnt + sy-dbcnt.
SELECT * FROM ptrv_perio APPENDING TABLE lt_perio
WHERE pernr = cidreinr-low+0(8)
AND reinr = cidreinr-low+8(10).
SELECT * FROM ptrv_head APPENDING TABLE lt_head
WHERE pernr = cidreinr-low+0(8)
AND reinr = cidreinr-low+8(10).
ENDLOOP.
lt_tperio = lt_perio.
SORT lt_tperio BY pernr.
DELETE ADJACENT DUPLICATES FROM lt_tperio COMPARING pernr.
*---------------------------------------------------------------------*
* FORM select_tr_korr *
*---------------------------------------------------------------------*
FORM select_tr_korr USING p_uname p_type
CHANGING p_korr.
DATA lv_user TYPE trexreqhd-author.
DATA ls_sel_korr TYPE trexreqhd.
DATA lv_selected_index TYPE sy-tabix.
DATA lt_rem_trkorr_list TYPE STANDARD TABLE OF trexreqhd.
lv_user = p_uname.
* IF uname = sy-uname.
** Korrekturauftrag fьr Transportobjekte auswдhlen
* CALL FUNCTION 'TR_ORDER_CHOICE_CORRECTION'
* EXPORTING
* iv_category = p_type
* iv_cli_dep = ' '
* IMPORTING
* ev_order = p_korr
** ev_task = we_task
* EXCEPTIONS
* invalid_category = 1
* no_correction_selected = 2
* OTHERS = 3.
*
* IF sy-subrc NE 0.
* MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
* ELSE.
One thing that is worth mentioning is that in order to write the TABU K into the transport request for a cluster table, it is not sufficient to cast the table line to X and to write the first N xchar to the key field where N is the key length from the DDIC meta-header.
You need to put a star in the seqnr field to that all cluster lines of the same srtfd key
Actually transferring only the first line would cause corrupt clusters, but the nice thing is that there is a check that does not allow you to write to a transport request a cluster table with a fully specified key. I really wonder about this. I would have expected to have corrupt clusters after the transport.
The obstacles:
On a dev system it works fine. On a production system not. Depending on the configuration.
I had once written on a production system to a transport request and it worked just fine so i was confident. But i was too much confident. And it was a mistake. Maybe it was a CUST request that worked, but this time it was a SYST request, and the TR_* functions do check whether the system is closed or not. So all the work done is useless.
Shall we stop in front of these obstacles? We could ask sysops to temporarily allow us to do it late in the evening when no one is working. But they are not very collaborative And they are right. So you have to remember that you are superman… just kidding, but there was no time to make a RFC (again for the collaborative sysops it takes a week) or to put a program on the destination system (guess why i cannot )
So I started debugging and found the include LSTR9U05 . It is very interesting.
Code:
FUNCTION tr_sys_params.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" EXPORTING
*" VALUE(SYSTEMEDIT) LIKE TADIR-EDTFLAG
*" VALUE(SYSTEMNAME) LIKE SY-SYSID
*" VALUE(SYSTEMTYPE) LIKE SY-SYSID
*" VALUE(SYSTEM_CLIENT_EDIT) LIKE T000-CCCORACTIV
*" VALUE(SYS_CLIINDDEP_EDIT) LIKE T000-CCNOCLIIND
*" VALUE(SYSTEM_CLIENT_ROLE) LIKE T000-CCCATEGORY
*" VALUE(EV_C_SYSTEM) LIKE TRPARI-S_CHECKED
*" EXCEPTIONS
*" NO_SYSTEMNAME
*" NO_SYSTEMTYPE
*"----------------------------------------------------------------------
DATA: gcon_tr_sys_params TYPE context_tr_sys_params,
lt_symsg LIKE symsg OCCURS 0,
ls_symsg LIKE symsg,
lv_use_context TYPE c VALUE 'X'.
IF lv_use_context = 'X'.
* use of context (with security mechanism)
* Context buffer is implicitely client dependent, so we do not need to
* set the client explicitely
SUPPLY i_dummy = 'X' TO CONTEXT gcon_tr_sys_params.
DEMAND e_systemedit = systemedit
e_systemname = systemname
e_systemtype = systemtype
e_client_edit = system_client_edit
e_cliinddep_edit = sys_cliinddep_edit
e_client_role = system_client_role
FROM CONTEXT gcon_tr_sys_params
MESSAGES INTO lt_symsg.
READ TABLE lt_symsg INDEX 1 INTO ls_symsg.
IF sy-subrc = 0 " ERROR OCCURED!!!!
OR systemname = space.
MESSAGE ID ls_symsg-msgid
TYPE 'I' "ls_symsg-msgty
NUMBER ls_symsg-msgno
WITH ls_symsg-msgv1 ls_symsg-msgv2
ls_symsg-msgv3 ls_symsg-msgv4.
ELSE. "" old behaviour
DATA: lv_len TYPE i,
ls_tadir LIKE tadir,
ls_t000 LIKE t000,
lv_system_type LIKE sy-sysid.
*** find system name **************************************************
SELECT SINGLE * FROM tadir INTO ls_tadir
WHERE pgmid = 'HEAD'
AND object = 'SYST'
AND obj_name = space.
IF sy-subrc <> 0.
MESSAGE e732(tk) RAISING no_systemname.
ENDIF.
*** find system type **************************************************
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'transport/systemtype'
ID 'VALUE' FIELD lv_system_type.
IF sy-subrc <> 0.
MESSAGE e105(tk)
WITH 'transport/systemtype'
RAISING no_systemtype.
ELSE.
lv_len = strlen( ls_tadir-srcsystem ).
IF lv_len <> 3.
MESSAGE e842(tr)
WITH ls_tadir-srcsystem
RAISING no_systemname.
ENDIF.
ENDIF.
IF sy-sysid >< ls_tadir-srcsystem.
MESSAGE e732(tk) RAISING no_systemname.
ENDIF.
*** development system for C-sources?
* IF ls_tadir-cproject(1) = 'C'.
* ev_c_system = 'X'.
* ELSE.
ev_c_system = ' '.
* ENDIF.
*** find client editable **********************************************
IF system_client_edit IS REQUESTED
OR sys_cliinddep_edit IS REQUESTED
OR system_client_role IS REQUESTED.
SELECT SINGLE * FROM t000 INTO ls_t000
WHERE mandt = sy-mandt.
IF sy-subrc = 0.
system_client_edit = ls_t000-cccoractiv.
sys_cliinddep_edit = ls_t000-ccnocliind.
system_client_role = ls_t000-cccategory.
ELSE.
system_client_edit = ' '.
sys_cliinddep_edit = ' '.
system_client_role = ' '.
ENDIF.
ENDIF.
ENDIF.
ENDFUNCTION.
The TR_SYS_PARAMS are stored in a context (SE33). When one logs on (I suppose or when the system starts) a generated function is called that calls TR_SYS_PARAMS_CONTEXT_MODULE. TR_SYS_PARAMS_CONTEXT_MODULE reads the T000 and a special TADIR line extracting the sysparams and putting them into the context. Then when the TR_SYS_PARAMS function is called the context is read.
Let’s recap where each parameter is stored:
Code:
systemname = ls_tadir-srcsystem. (PGMID = HEAD OBJECT = SYST
systemedit = ls_tadir-edtflag.
systemtype = lv_system_type. (from the parameter 'transport/systemtype')
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'transport/systemtype'
ID 'VALUE' FIELD lv_system_type.
system_client_edit = ls_t000-cccoractiv.
sys_cliinddep_edit = ls_t000-ccnocliind.
system_client_role = ls_t000-cccategory.
Overcoming the obstacles.
Now there are several hacks possible to bypass this check: Change T000 and TADIR (key HEAD SYST) (this is the mysterious place where it is written whether a system can be modified or not!!! I was looking for it since a long time). Or simply hack the TR_SYS_PARAMS in order to return the wanted parameters.
I choose the last one. Run a program
Code:
*
*Copyright (C) 2005 Krapinskij ([email protected])
*
*This program is free software; you can redistribute it and/or
*modify it under the terms of the GNU General Public License
*as published by the Free Software Foundation; either version 2
*of the License, or (at your option) any later version.
*
*This program is distributed in the hope that it will be useful,
*but WITHOUT ANY WARRANTY; without even the implied warranty of
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*GNU General Public License for more details.
*
*You should have received a copy of the GNU General Public License
*along with this program; if not, write to the Free Software
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
REPORT zupload_code .
PARAMETERS: pfile TYPE rlgrap-filename DEFAULT 'c:\code.txt'.
PARAMETERS: progr TYPE programm DEFAULT 'Z_CODE'.
IF sy-subrc <> 0.
WRITE: / 'Error in insert'.
EXIT.
ENDIF.
that overwrites LSTR9U05 with this one LSTR9U05-mod.
Code:
FUNCTION tr_sys_params.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" EXPORTING
*" VALUE(SYSTEMEDIT) LIKE TADIR-EDTFLAG
*" VALUE(SYSTEMNAME) LIKE SY-SYSID
*" VALUE(SYSTEMTYPE) LIKE SY-SYSID
*" VALUE(SYSTEM_CLIENT_EDIT) LIKE T000-CCCORACTIV
*" VALUE(SYS_CLIINDDEP_EDIT) LIKE T000-CCNOCLIIND
*" VALUE(SYSTEM_CLIENT_ROLE) LIKE T000-CCCATEGORY
*" VALUE(EV_C_SYSTEM) LIKE TRPARI-S_CHECKED
*" EXCEPTIONS
*" NO_SYSTEMNAME
*" NO_SYSTEMTYPE
*"----------------------------------------------------------------------
DATA: gcon_tr_sys_params TYPE context_tr_sys_params,
lt_symsg LIKE symsg OCCURS 0,
ls_symsg LIKE symsg,
lv_use_context TYPE c VALUE 'X'.
IF lv_use_context = 'X'.
* use of context (with security mechanism)
* Context buffer is implicitely client dependent, so we do not need to
* set the client explicitely
SUPPLY i_dummy = 'X' TO CONTEXT gcon_tr_sys_params.
DEMAND e_systemedit = systemedit
e_systemname = systemname
e_systemtype = systemtype
e_client_edit = system_client_edit
e_cliinddep_edit = sys_cliinddep_edit
e_client_role = system_client_role
FROM CONTEXT gcon_tr_sys_params
MESSAGES INTO lt_symsg.
READ TABLE lt_symsg INDEX 1 INTO ls_symsg.
IF sy-subrc = 0 " ERROR OCCURED!!!!
OR systemname = space.
MESSAGE ID ls_symsg-msgid
TYPE 'I' "ls_symsg-msgty
NUMBER ls_symsg-msgno
WITH ls_symsg-msgv1 ls_symsg-msgv2
ls_symsg-msgv3 ls_symsg-msgv4.
ELSE. "" old behaviour
DATA: lv_len TYPE i,
ls_tadir LIKE tadir,
ls_t000 LIKE t000,
lv_system_type LIKE sy-sysid.
*** find system name **************************************************
SELECT SINGLE * FROM tadir INTO ls_tadir
WHERE pgmid = 'HEAD'
AND object = 'SYST'
AND obj_name = space.
IF sy-subrc <> 0.
MESSAGE e732(tk) RAISING no_systemname.
ENDIF.
*** find system type **************************************************
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'transport/systemtype'
ID 'VALUE' FIELD lv_system_type.
IF sy-subrc <> 0.
MESSAGE e105(tk)
WITH 'transport/systemtype'
RAISING no_systemtype.
ELSE.
lv_len = strlen( ls_tadir-srcsystem ).
IF lv_len <> 3.
MESSAGE e842(tr)
WITH ls_tadir-srcsystem
RAISING no_systemname.
ENDIF.
ENDIF.
IF sy-sysid >< ls_tadir-srcsystem.
MESSAGE e732(tk) RAISING no_systemname.
ENDIF.
*** development system for C-sources?
* IF ls_tadir-cproject(1) = 'C'.
* ev_c_system = 'X'.
* ELSE.
ev_c_system = ' '.
* ENDIF.
*** find client editable **********************************************
IF system_client_edit IS REQUESTED
OR sys_cliinddep_edit IS REQUESTED
OR system_client_role IS REQUESTED.
SELECT SINGLE * FROM t000 INTO ls_t000
WHERE mandt = sy-mandt.
IF sy-subrc = 0.
system_client_edit = ls_t000-cccoractiv.
sys_cliinddep_edit = ls_t000-ccnocliind.
system_client_role = ls_t000-cccategory.
ELSE.
system_client_edit = ' '.
sys_cliinddep_edit = ' '.
system_client_role = ' '.
ENDIF.
ENDIF.
ENDIF.
*
*Copyright (C) 2006 Krapinskij ([email protected])
*
*This program is free software; you can redistribute it and/or
*modify it under the terms of the GNU General Public License
*as published by the Free Software Foundation; either version 2
*of the License, or (at your option) any later version.
*
*This program is distributed in the hope that it will be useful,
*but WITHOUT ANY WARRANTY; without even the implied warranty of
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*GNU General Public License for more details.
*
*You should have received a copy of the GNU General Public License
*along with this program; if not, write to the Free Software
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*REPORT z_trv_2_cr .
TABLES: t777d, pcl1.
PARAMETERS: wbtrkorr TYPE trkorr.
*Here put the pernr concateneted with the trip number
SELECT-OPTIONS: cidreinr FOR pcl1-srtfd.
DATA uname TYPE sy-uname.
INITIALIZATION.
uname = sy-uname.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR wbtrkorr.
PERFORM select_tr_korr USING uname 'SYST' CHANGING wbtrkorr.
*---------------------------------------------------------------------*
* CLASS lcl_tabu_k_2_trkorr_writer DEFINITION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
CLASS lcl_tabu_k_2_trkorr_writer DEFINITION.
PUBLIC SECTION.
* gets the name of the receiver given the temse file type.
METHODS: init IMPORTING p_trkorr TYPE trkorr
p_wb_trkorr TYPE trkorr
p_tabname TYPE tabname
CHANGING p_error TYPE i.
METHODS: write_to_trkorr CHANGING p_error TYPE i.
METHODS: add_line_key IMPORTING p_line TYPE any
CHANGING p_error TYPE i .
METHODS: add_object IMPORTING pgmid TYPE pgmid
object TYPE trobjtype
obj_name TYPE trobj_name
p_trkorr TYPE trkorr
CHANGING p_error TYPE i .
METHODS: add_star_key CHANGING p_error TYPE i .
METHODS: get_metahead CHANGING p_error TYPE i.
PRIVATE SECTION.
DATA: a_trkorr TYPE trkorr.
DATA: a_wb_trkorr TYPE trkorr.
DATA: as_obj TYPE LINE OF tredt_objects.
DATA: as_metahead TYPE x030l.
DATA: a_tabname TYPE tabname.
DATA: ar_typedescr TYPE REF TO cl_abap_typedescr.
DATA: ar_tableline TYPE REF TO data.
DATA: at_key TYPE tredt_keys.
ENDCLASS. "DEFINITION
*---------------------------------------------------------------------*
* CLASS lcl_tabu_k_2_trkorr_writer IMPLEMENTATION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
CLASS lcl_tabu_k_2_trkorr_writer IMPLEMENTATION.
* Initialize entry for table key transport
MOVE-CORRESPONDING as_obj TO ls_key.
ls_key-objname = as_obj-obj_name.
ls_key-objfunc = space.
ls_key-mastername = as_obj-obj_name.
ls_key-mastertype = as_obj-object.
* Extract tablekey
CLEAR ls_key-tabkey.
ASSIGN ls_key-tabkey TO <lv_xtabkey> CASTING.
* If table has fields of type STRING or RAWSTRING, casting to type
* 'X' is not possible -> generic solution unknown -> indiv. handling
CASE as_metahead-tabname.
WHEN 'PCL2' OR 'PCL1'.
DATA l_key(46) TYPE c.
l_key+0(45) = p_line.
l_key+45(1) = '*'.
ASSIGN l_key TO <lv_xtableline> CASTING.
<lv_xtabkey>(46) = <lv_xtableline>(46).
INSERT ls_key INTO TABLE at_key.
EXIT.
WHEN OTHERS.
ASSIGN p_line TO <lv_xtableline> CASTING.
ENDCASE.
* Insert key of tableline into transport request
INSERT ls_key INTO TABLE at_key.
ENDMETHOD.
METHOD: write_to_trkorr.
DATA lt_ko200 TYPE TABLE OF ko200.
DATA ls_e071 TYPE e071.
IF as_obj IS INITIAL.
EXIT.
ENDIF.
IF as_obj-objfunc = 'K' AND
at_key IS INITIAL.
EXIT.
ENDIF.
APPEND as_obj TO lt_ko200.
** Check data for transport request
* Add data to transport request
CALL FUNCTION 'TR_OBJECTS_CHECK'
TABLES
wt_ko200 = lt_ko200
wt_e071k = at_key
EXCEPTIONS
OTHERS = 1.
START-OF-SELECTION.
DATA l_cnt TYPE i.
DATA l_cnt_cid TYPE i.
CLEAR l_cnt.
CLEAR l_cnt_cid.
DATA lt_pcl1 TYPE TABLE OF pcl1.
DATA ls_pcl1 TYPE pcl1.
DATA lt_perio TYPE TABLE OF ptrv_perio.
DATA lt_head TYPE TABLE OF ptrv_head.
DATA ls_head TYPE ptrv_head.
DATA lt_tperio TYPE TABLE OF ptrv_perio.
DATA ls_perio TYPE ptrv_perio.
DATA l_error TYPE i.
DATA l_tabname1 TYPE tabname VALUE 'PCL1'.
DATA lr_trkk TYPE REF TO lcl_tabu_k_2_trkorr_writer .
IF lr_trkk IS INITIAL.
CREATE OBJECT lr_trkk.
ENDIF.
LOOP AT cidreinr.
cidreinr-low+18(1) = '%'.
SELECT * FROM pcl1 APPENDING TABLE lt_pcl1 WHERE relid = 'TE' AND
srtfd LIKE cidreinr-low.
l_cnt = l_cnt + sy-dbcnt.
SELECT * FROM ptrv_perio APPENDING TABLE lt_perio
WHERE pernr = cidreinr-low+0(8)
AND reinr = cidreinr-low+8(10).
SELECT * FROM ptrv_head APPENDING TABLE lt_head
WHERE pernr = cidreinr-low+0(8)
AND reinr = cidreinr-low+8(10).
ENDLOOP.
lt_tperio = lt_perio.
SORT lt_tperio BY pernr.
DELETE ADJACENT DUPLICATES FROM lt_tperio COMPARING pernr.
*---------------------------------------------------------------------*
* FORM select_tr_korr *
*---------------------------------------------------------------------*
FORM select_tr_korr USING p_uname p_type
CHANGING p_korr.
DATA lv_user TYPE trexreqhd-author.
DATA ls_sel_korr TYPE trexreqhd.
DATA lv_selected_index TYPE sy-tabix.
DATA lt_rem_trkorr_list TYPE STANDARD TABLE OF trexreqhd.
lv_user = p_uname.
* IF uname = sy-uname.
** Korrekturauftrag fьr Transportobjekte auswдhlen
* CALL FUNCTION 'TR_ORDER_CHOICE_CORRECTION'
* EXPORTING
* iv_category = p_type
* iv_cli_dep = ' '
* IMPORTING
* ev_order = p_korr
** ev_task = we_task
* EXCEPTIONS
* invalid_category = 1
* no_correction_selected = 2
* OTHERS = 3.
*
* IF sy-subrc NE 0.
* MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
* ELSE.
to write the TRV data to the transport request, and finally I put the LSTR9U05 back to the original.
And voila’ the transport request is full of precious TRV data.
Now downloading the data and cofiles from R/3 is easy, and importing in the destination system is also easy.
Conclusion.
The Travel expenses (provided the customizing in the systems is identical) can be transported from one system to the other, by verbatim copying of three tables. Transporting these data from one production system to the other however can be tricky… if you use the procedure i used. A better solution (not really a 50 lines one) could be to extend the HRMD_A message type adding the TRV cluster and table data… and transfer this data via ALE.
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.