Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

extracting tar-file

andreas_mann3
Active Contributor
0 Likes
1,844

Hi all,

have anyone a tool (in abap) to extract tar-files in SAP?

regards

Andreas

1 ACCEPTED SOLUTION
Read only

chaouki_akir
Contributor
0 Likes
1,180

Hello,

do you have found a solution ?

Cordialement,

Chaouki.

Hi all,

have anyone a tool (in abap) to extract tar-files in SAP?

regards

Andreas

2 REPLIES 2
Read only

chaouki_akir
Contributor
0 Likes
1,181

Hello,

do you have found a solution ?

Cordialement,

Chaouki.

Read only

0 Likes
1,180

Hello,

you will find below a report that will untar file p_file to directory p_tardir

REPORT zchaouki_0001 .
*----------------------------------------------------------------------*
* PARAMETERS / SELECTION SCREEN                                        *
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME
                                   TITLE text-b01.
  PARAMETERS : p_file    TYPE  pathextern DEFAULT '/tmp/test/toto.tar',
               p_tardir  TYPE  pathextern DEFAULT '/tmp/'.
SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

* Unzipp files of archive  p_file in directory p_tardir
  PERFORM unzip_file    USING:   p_file  p_tardir.

END-OF-SELECTION.

*&---------------------------------------------------------------------*
*&      Form  unzip_file
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->WPV_FILE            Directory + filename text
*      -->WPV_DIR_TARGET      Directory
*----------------------------------------------------------------------*
FORM unzip_file USING    wpv_file           TYPE pathextern
                         wpv_dir_target     TYPE pathextern.
DATA  :
       wlt_system_list    TYPE msssqlcode OCCURS 0 WITH HEADER LINE,
       wlv_cmd_unix       TYPE line1000.
* UNIX command
  CONCATENATE 'cd' wpv_dir_target ';'
              'tar xvf' wpv_file  
                                   INTO wlv_cmd_unix SEPARATED BY space.


  CALL 'SYSTEM' ID 'COMMAND' FIELD wlv_cmd_unix
                ID 'TAB'     FIELD wlt_system_list-*sys*.


ENDFORM.                    " unzip_file

Edited by: Chaouki AKIR on Oct 11, 2009 1:27 AM