2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Windows端末にSAPCARをインストールして利用してみる

Last updated at Posted at 2023-07-17

SAPが提供している拡張子がSARとなっているファイルについて。

SARファイルはSAPが提供するSAPCARを用いてアーカイブされたファイルとなっており、ファイルを抽出するにはSAPCARコマンドを利用します。

本記事ではWindows端末にSAPCARをインストールしてSARファイルを作成したり、SARファイルからファイルを取り出してみます。

なおSAPCARのダウンロードにはS-Userが必要となります。

ドキュメント

SAPCARとは?

SAPCARはSAPがCARコマンドに変わって提供するアーカイブコマンドになります。

ノートに記載がありますが、R/3 4.6cより前、SAPからは提供されるアーカイブファイルはCAR形式で提供されていたようです。

それがR/3 4.6c以降はSAPが提供するSAPCARを用いたSAR形式に切り替わりました。

今回の環境

  • Windows 10 21H2

WindowsにSAPCARをインストール

SAPCARコマンドはsap for meソフトウェアダウンロードセンターから入手できます。

sap fo meのソフトウェアダウンロードについてURLでアクセスする場合、https://me.sap.com/softwarecenter にアクセス。

画面から遷移する場合はサービスおよびサポートの画面 または システムおよびプロビジョニング から遷移できます。

image.png

image.png

ソフトウェアのダウンロードまできたら、サポートおよびパッチ => カテゴリ別 => SAP Technology Components => SAPCAR => バージョン を選択

image.png

2023年7月現在は7.22が最新となっていました、今回はこちらのWindows版をダウンロードするため、プルダウンからWindowsを選択

image.png

リンクをクリックすればブラウザでダウンロードできます。

image.png

EXEファイルがそのままダウンロードできました。

image.png

ダウンロードしたexeファイルを適当なディレクトリに配置する

ダウンロードしたコマンドを(SAPCAR_1115-70006231.EXE)適用なディレクトリに配置して利用可能なオプションを確認してみます。

今回はc:\qiita\sapcar\sapcar.exeに配置してみました。

必要な場合はPATHに適宜、追加して利用して下さい。

利用方法とオプションを確認してみる

ダウンロードした実行ファイルに引数をなにもつけずに実行すると、利用方法とオプションの確認ができます。

image.png

SARファイルを作成してみる

create a new archive:
SAPCAR -c[vir][f archive] [-P] [-C directory]
   [-A filename] [-T filename] [-X filename]
   [-p value] [-V] file1 file2 ...

今回は、PowerShellでhelloworld.txtとfoobar.txtを作成して、これをアーカイブしてsample.SARファイルを作成してみます。

# 今回、sapcarを配置したディレクトへカレントディレクトリを移動
cd c:\qiita\sapcar

# helloworld.txt と foobar.txtを作成
New-Item .\helloworld.txt -value helloworld | Out-Null
New-Item .\foobar.txt -value foobar | Out-Null

.\sapcar.exe -cvf sample.SAR helloworld.txt foobar.txt

image.png

sample.SARが作成されました。

SARファイルの中身をリストしてみる

list the contents of an archive:
SAPCAR -t[vs][f archive] [file1 file2....]

オプション-tを利用するとアーカイブに含まれているファイルをリストできるようなので、ここでは先程作成したsample.SARファイルに含まれているファイルを確認してみます。

オプションの意味は下記参照

  • -t : list the contents of an archive
  • -v : verbosely list files processed
  • -s : do free space check
  • -f FILE : use archive file FILE (default DEFAULT.SAR)
# 今回、sapcarを配置したディレクトへカレントディレクトリを移動
cd c:\qiita\sapcar

.\sapcar.exe -tvsf sample.SAR

image.png

画像のようにsample.SARにfoobar.txtとhellworold.txtが含まれている事が確認できます

また今回はオプションsをつけているので、下記のメッセージも表示されています。

The extraction does not require free disk space (maybe
the extraction will only overwrite existing files of
greater or equal size or the uncompressed size of each
file in the archive is zero).

image.png

c:\qiita\sapcar\のディレクトリにはhelloworld.txtfooar.txtをおいたままだったので上書きするだけだよって感じのメッセージになっていました。
結構賢いですよね。

ためしにhelloworld.txtfoobar.txtを削除してから実行したメッセージは下記

image.png

テキストファイルでサイズが小さすぎてちょっと面白みがなかったですね。

SARファイルを展開してみる

extract files from an archive:
SAPCAR -x[v][f archive] [-R directory] [-A filename]
   [-V] [file1 file2....]

オプションの意味は下記参照

  • -x : extract files from an archive
  • -v : verbosely list files processed
  • -f FILE : use archive file FILE (default DEFAULT.SAR)
  • -R dir : use dir instead of current directory
  • -A FILE : get names to include from file FILE
  • -V : activate signature verification in existing commands -a, -c, -d, -t and -x.
# 今回、sapcarを配置したディレクトへカレントディレクトリを移動
cd c:\qiita\sapcar

# saple.SARを展開
.\sapcar.exe -xvf sample.SAR

# helloworld.txtだけをsample.SARから展開
.\sapcar.exe -xvf sample.SAR helloworld.txt

# helloworld.txtとfoobar.txtをsample.SARから展開
.\sapcar.exe -xvf sample.SAR helloworld.txt foobar.txt

# sample.SARを ディレクトリ sampleDir に展開
.\sapcar -xvf sample.SAR -R sampleDir

image.png

総評

初見ではSAPから提供されるファイルは、独自の形式でアーカイブされてるって驚きがあった気がします。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?