ABAP to content server check

A content server can be used to store attachments and other documents. In some cases both the ABAP stack and content server are up and running, but the connection between the two is broken for some reason.

This blog will provide a check program which you can plan in a batch job to check the connection between the ABAP stack content repository and the the content server.

Questions that will be answered in this blog are:

  • How can I automate the content server check?
  • How can I be alerted if the connection between ABAP stack and content server is broken?

The OAC0 connection check

In transaction OAC0 for maintaining the content server link there is a check button:

We will use the function module SCMS_HTTP_PING which is behind this button for our custom code ABAP test program.

Custom code ABAP check program for testing the ABAP to content server connection

Load this ABAP code into your system and create the texts:

*&---------------------------------------------------------------------*
*& Report ZCSCHECK
*&---------------------------------------------------------------------*
REPORT ZCSCHECK.

DATA: z_ok TYPE boolean.
CONSTANTS: c_mesid      TYPE char3 VALUE 'ZZZ', "system log message ID defined in SE92
           c_zero       TYPE string VALUE '0 ',
           c_secirity_n TYPE c VALUE 'N',
           c_secirity_s TYPE c VALUE 'S'.
PARAMETERS p_crep TYPE scms_crep MATCHCODE OBJECT h_crep_http.

* initialize ok code
  z_ok = abap_true.

*Fetch http server details
  SELECT SINGLE crep_id, http_serv, http_port, http_sport, http_scrpt, version
         FROM   crep_http INTO @DATA(ls_crep)
         WHERE  crep_id = @p_crep.
  IF sy-subrc EQ 0.
    IF NOT ls_crep-http_port CO c_zero OR
            ls_crep-http_sport CO c_zero.
      CALL FUNCTION 'SCMS_HTTP_PING'
        EXPORTING
          crep_id    = ls_crep-crep_id
          http_serv  = ls_crep-http_serv
          http_port  = ls_crep-http_port
          http_sport = ls_crep-http_sport
          http_scrpt = ls_crep-http_scrpt
          version    = ls_crep-version
          security   = c_secirity_n"'N'
        EXCEPTIONS
          error_http = 1
          OTHERS     = 2.
      IF sy-subrc <> 0.
        z_ok = abap_false. "not ok
      ENDIF.
    ENDIF.
*Check Security with S
    IF z_ok <> abap_false AND NOT ls_crep-http_sport CO c_zero.
      CALL FUNCTION 'SCMS_HTTP_PING'
        EXPORTING
          crep_id    = ls_crep-crep_id
          http_serv  = ls_crep-http_serv
          http_port  = ls_crep-http_port
          http_sport = ls_crep-http_sport
          http_scrpt = ls_crep-http_scrpt
          version    = ls_crep-version
          security   = c_secirity_n"'S'
        EXCEPTIONS
          error_http = 1
          OTHERS     = 2.
      IF sy-subrc <> 0.
        z_ok = abap_false. "not ok
      ENDIF.
    ENDIF.

    IF z_ok = abap_false. "not ok
* write to SM21 system log
      WRITE: / TEXT-004. "ping not ok
      CALL FUNCTION 'RSLG_WRITE_SYSLOG_ENTRY'
        EXPORTING
          sl_message_area    = c_mesid(2)
          sl_message_subid   = c_mesid+2
          data_word1         = ls_crep-crep_id
        EXCEPTIONS
          data_missing       = 1
          data_words_problem = 2
          other_problem      = 3
          pre_params_problem = 4
          OTHERS             = 5.

      IF sy-subrc EQ 0.
        WRITE: / TEXT-001  , ls_crep-crep_id. "succes to write to SM21
      ELSE.
        WRITE: / TEXT-002  , ls_crep-crep_id. "fail to write to SM21
      ENDIF.
    ELSE.
      WRITE: / TEXT-003  ,  ls_crep-crep_id. "ping ok
    ENDIF.
  ELSE.
    WRITE: / TEXT-004  ,  ls_crep-crep_id. "Ping to webservice not ok
  ENDIF.

The program uses function module SCMS_HTTP_PING to test the connection. In case of issues it will write an entry to the application log. Use SE92 to create a new system log message. You can choose to replace this code by sending a mail or do anything else.

Running the check program

Running the program is simple:

If the connection fails it writes an entry to SM21.

In case you have multiple content repositories to check: create multiple variants and run the program in background with multiple steps.

Content server migration of documents

If you have configured attachments of document info records to be stored in the content server, you still might have a lot of old document stored into the SAP database.

This blog will explain how to migrate these documents from the database to the content server.

Questions that will be answered are:

  • How to migrate documents from database to content server?
  • What are relevant background OSS notes?

Running the migration

The main OSS note is 389366 – Relocation of documents. This basically tells you to run program RSIRPIRL. The exact use is explained in OSS note 2459712 – How to use report RSIRPIRL.

To run start transaction SE38 and start program RSIRPIRL and fill out the required data:

Select a time frame that has little documents in a test environment first. Check how long it takes and that it ends correctly. After the relocation is done you get a list of technical ID’s migrated. When confident in a test environment, run in production environment, and monitor the storage of the content server (so it does not fill up to 100%).

New modification note for delayed deletion: 2991944 – Introducing the Delay mode in report RSIRPIRL.

Migration of GOS objects

The program RSIRPIRL does not have many selection criteria. You might also find out that the time to migrate takes too long. If you need to migrate GOS document (global object services attachments), you can use program RSGOS_RELOCATE_ATTA:

This program migrates the GOS documents specified per type and page. GOS documents are normally the bulk of the documents. This way you can migrate most of the documents before running the full run with RSIRPIRL. Full background of program RSGOS_RELOCATE_ATTA can be found in OSS note 2293171 – RSGOS_RELOCATE_ATTA: Relocating attachments from generic object services.

Copying content repository

If you want to copy content from a content repository to another (not re-locate), install the program Z_DOC_COPY from OSS note 2774469 – Program to copy SAP content repositories.

Relevant OSS notes

OSS notes:

Data archiving: store files in SAP content server

With data archiving you reduce the database size of SAP and increase the performance by reducing the amount of records in the SAP tables. The data archiving process write files with the archived data. These files must still be stored securely, since on file level any admin can delete the files and you might loose valuable business data.

This blog explains the setup of storage of data archiving files by using SAP content server as storage medium.

Questions that will be answered are:

  • How do I setup the link from SAP netweaver ABAP stack to the SAP content server?
  • Which settings do I need to make in the archiving objects to store the archiving file to SAP content server?
  • How do I store the files in the SARA transaction?

General tips and tricks for SAP content server can be found in this blog.

Setup of SAP content server 7.5 information can be found in this blog.

How to setup archiving technically can be found in this blog.

How to run archiving can be found in this blog.

Linking the SAP Netweaver ABAP stack to SAP content server

First we need to maintain a special protocol in customizing using this path:

Create a new protocol:

This protocol can now be assigned to the SAP content server you want to use for storing the data archiving files. Go to transaction OAC0 to link the protocol to your content server:

If the field protocol is not visible immediately there, click the button Full administration first.

Data archiving object specific linking

After the steps above to make the general connection to content server available, the content server needs to be explicitly mentioned in each data archiving object. For any data archiving object (start transaction SARA first and select the object), click on the customizing button:

In the popup screen now select Technical Settings in Archiving Object-Specific Customizing:

At the bottom fill out the content server repository and decide if you want to start automatically or immediately:

Remark 1: the F4 search help does not work here! Key in the value directly and check using the check button. Then save the data.
Remark 2: always tick the option Delete Program Reads from Storage System. This forces that the archive file is securely stored first, before the deletion run is allowed to start. 

Use of archive routing

If you have a lot of archiving data and a lot of years of archiving done, it can be needed to set up a second or third content server.

With the use of Archive Routing you can determine in which content server to store which archive files.

On the SARA screen push the customizing button and select Archive Routing:

Now set up a rule:

And the conditions of the rule:

Storing archive files in SARA

After the configuration is done the new button Storage system appears on the screen in the SARA transaction for this specific object:

Storage system

If the button does not appear: check the technical settings above, and remember: this is to be repeated for each object.

Storing files that have been written by the Write phase of the data archiving process can now be stored by pressing the Archive Files button:

Select the file(s) to store:

Now a batch job starts (per file!) to store the archive file into the SAP content server.

After correct storage of the file, the file can be selected in the delete phase.

SAP content server 7.5

SAP has released content server 7.5. Content server can be used to store attachments, documents and archiving files outside of the SAP database.

Questions that will be answered in this blog are:

  • Where can I find more information on SAP content server 7.5?
  • How to upgrade to SAP content server 7.5?
  • What is the support on my SAP content server 6.5 installations?

SAP content server 7.5

The main OSS note for SAP content server 7.5 is 2786364 – SAP Content Server and Cache Server 7.5 (and higher). This is a major different technology setup: there is no Apache or Microsoft webserver needed any more. The content repository setup itself does not change.

For installation you can follow the instructions from the main OSS note, or follow the steps from the SAP blog on content server 7.5 installation.

Upgrading from 6.5 to 7.5

As mentioned before the technology has changed on how data is put into content server and how it is retrieved, but the data structure itself is the same. Note 2786364 – SAP Content Server and Cache Server 7.5 (and higher) is also describing the migration process. Your database (most of the times MaxDB) remains as is. But you have to install new 7.5 content server. Then you migrate the configuration. You stop the old 6.5 server and start up the new 7.5 server. You test that all works via the content server check programs from this blog (you might need to perform changes in transaction OAC0). SAP recommends after successful migration to clean up the old 6.5 as soon as possible to avoid issues (like an overzealous admin starting it up again…).

Support of SAP content server 6.5

In the main OSS note on SAP content server 6.5 (1983930 – Availability of SAP Content Server 6.50) there is no direct indication of end of support date. SAP content server 6.50 is part of the Netweaver 7.40 stack. The support of this stack ends by 31st of December 2020.

See also OSS notes 761387 – SAP Content Server support information and 719971 – SAP Content Server release strategy.

Before raising SAP message, first read OSS note 3345452 – SAP Content Server – required information for analysis on the information SAP needs for a quick solution to your issue.

Changes to test programs

The content server test programs (for example RSCMST) can respond differently with the new content server. SAP is updating these. For more information see the blog on content server tips & tricks.

Content server license

For using content server from SAP using MaxDB no special licenses is needed. See OSS note 2553449 – Does the SAP Content/Cache Server require a separate license?.

Storing SAP office documents in content server

When you are storing a lot of SAP office documents, you will find that table SOFFCONT1 is growing to a large value. Out-of-the-box SAP stores SAP office documents in that table. This blog will explain how you can route the storage of these documents from database to a content server. If you no longer need the SAP office documents, you can also delete them (read this blog on the deletion).

Questions that will be answered are:

  • Which settings do I need to make to route SAP office documents to the content server?
  • Which settings do I need to make to route GOS attachments to the content server?
  • How can I test if the documents are stored correctly in the content server?

Check current settings

Start transaction OAC0 and open the entry for content repository SOFFDB:

Here you can see documents are written to SAP table SOFFCONT1.

Reconfiguration of SAP office to content server

First check with transaction OANR that the number range is defined properly:

Goto transaction OAC0 and alter the settings for SOFFDB to your content server settings:

Also set up a new content server:

Now goto transaction AOCT to change the category settings for 3 entries: SOFFDB, SOFFHTTP and SOFFPHIO:

More background can be found in OSS note 2571570 – Where are documents physically stored with Business Communication Services?. And in OSS note 1634908 – Reduce the number of entries of table SOFFCONT1.

Reconfiguration of GOS (generic object services) to content server

Goto transaction SKPR08 and assign the content server category to class SOFFPHIO:

More background can be found in OSS note 530792 – Storing documents in the generic object services.

Other settings

There are more settings to be done or validated. It might be that these settings are already done in your system. If not, make the settings.

First define the Data carrier in customizing:

Make sure the entry for Data Carrier for front end has the type PC defined with a temporary storage path:

Please make sure that the end user has full rights to this directory. Some companies shield a lot. Without write and delete rights a temporary file cannot be stored here and the function will not work.

Now check that the default entry for data carrier is present. If not present use the Create Default Entry button to create it:

Now check the workstation application settings in the customizing path below, or directly via transaction DC30:

Search for the application type PDF and make sure the entries for 1 (display), 2 (change) and 3 (print) are maintained:

%AUTO% means it will take over the value from windows default to open PDF file.

Repeat this check for the popular formats DOC and DCX (Word), PPT and PPX (powerpoint), XLS and XLX (excel), ZIP (compressed files).

Testing the setup for SAP office

To test the setup for SAP office goto transaction SBWP to create a new message:

Create a document with attachment:

During upload you will see in the left bottom side the Test HTTP destination and destination test ok:

This means the document will be moved to content server. If this does not come, it is not ok.

If all is uploaded and you have filled out a receiver: hit the send button.

Now go back to SBWP and select the outbox. Double click on your message you just created and go to the attachment tab:

The document opens now.

You can ask your basis team to stop the content server. If that is stopped the document will not open (you get a HTTP error). This proves that the attachment is stored in the content server.

Testing the setup for GOS

To test the setup for GOS goto one of the transactions supporting the GOS setup. In our example we will use purchase requisition change (transaction ME52N). Select a purchase requisition and open the GOS box top left:

Select Create… and then option Create Attachment and upload a file.

Now select attachment list:

Open the document. Ask you basis team to stop the content server. Now try to open again and you will get an http error proving the document is stored in the content server.

Migrating existing documents

To migrate existing documents from the database to the content server, you can use program RSIRPIRL. The use of this program is explained in OSS note 2459712 – How to use report RSIRPIRL. For GOS documents: better use program RSGOS_RELOCATE_ATTA.

More background is written in this blog.

Regaining storage space

Depending on your database the moving of attachments from database to content server will immediately free up storage, or only after database table reorganization.

SAP content server technical tips and tricks

This blog will give you technical tips and tricks regarding the SAP content server.

Questions that will be answered are:

  • How can I check technical connection to content server?
  • How can I check that the content server functions work from technical side?
  • How can I test a cache server setup?
  • How can I extend to a file size limit above 2 GB?
  • How to check if a document exists in the content server?
  • How can I log document deletions?
  • How can I check and fix long response times?

Technical connection test to SAP content server

The first obvious connection test is in the administration function of the content server. Start transaction OAC0 (starts with letter O and ends with zero) and select your content server. On the next screen hit the check button. If the test is ok, click on the CSADMIN button and the detailed screen comes. There should be a green light behind your content repository. If no connection or no green light, there are issues in the linking and communication to content server (content server down, firewall block, etc). More details are in OSS note 2457912 – How to create a content repository in OAC0?.

CSADMIN only works properly with SAP content server. With external products there are restrictions. See OSS note 1879152 – CSADMIN: HTTP error: 400 Bad Request 5010: wrong usage.

Technical function test of SAP content server

To test if all the SAP content server functions are working from the technical level you can use test program RSCMST. Unfortunately there is no transaction linked by SAP, so you have to use SE38 or SA38 to start the program. After filling out the content server on first screen, you come to the second screen where you can launch the detailed tests. Per test you have to click the execute button.

Test program RSCMST result screen

Green means test has run and ok. Red is the unfortunate one where test has run and result is not ok. Yellow means test has not yet been executed.

In an ideal case all lights are green. If you have red light best to fix it by either applying OSS note to ABAP server or patch to content server.

Your specific company might not use all the technical options for content server (like the above HTTP using mCreate), but this is hard to correlate to end user scenario’s. If your users are facing issues with content server and not all lights are green on this report, it is a basis issue to be solved.

More background on the tests: OSS note 1482012 – Check the connection to content server.

Remark: the test program RSCMST can have bugs by itself. So check for latest version of this program and apply the OSS notes before running and relying on the program. Last known updates are from July 2017, by looking at keyword RSCMST in the SAP notes.

If you are running on content server 7.53 or higher, please read OSS notes 2888195 – Content Server 7.53 and report RSCMST and 2897793 – RSCMSTH2 reports errors for Content Server 7.53. This notes state that only the first 3 checks are relevant for 7.53 and higher.

Bug fix notes:

Content server check in monitoring

By using a custom ABAP program, you can test the link from ABAP server to content server and alert to monitoring. Read this blog on how to achieve this and the source of the custom ABAP program.

Content server performance

Program RSHTTP80 can be used to test the content server performance. Background OSS note: 579366 – Content server performance.

Testing cache server setup

If you have a cache server setup and want to check if that works properly, also here test program RSCMST is used. Read OSS note 2083855 – How to check cache server access on the exact parameters to fill out.

File size limit larger than 2 GB

If you want to store files larger than 2 GB, follow the instruction from this OSS note: 1705940 – Check in/out of files larger than 2GB in SAP Content Server. 2023376 – 2 GB Enablement from Knowledge Provider.

Migration of documents

You can migrate documents from the database to content server. Read this dedicated blog.

Timeout issues

For most timeout issues there is an issue with the content server. Check if the database or logfiles are not full. Reference: 2547719 – SAP Content Server: timeout error.

Long response times

In some cases attachments might have an unexpected long response time (despite small size of document). This can happen with GOS attachments and other (custom) code re-using the GOS attachments. Read OSS note 1783987 – Long response time for document display in Attachment list to set SU33 user parameters SAPHTTP_RFC_CHECK_TO and SAPCMS_RFC_CHECK_TO to value FAILED as solution. The note also explains the background.

Check document existence

To check if a document exists on the content server, follow the instructions from OSS note 2251113 – Check whether a document exists on SAP Content Server database.

Checking document deletion

If you want more information on document deletion, apply the settings from OSS note 2005308 – KPro Delete Logs to let the system log the knowledge provider document deletions in the SLG1 application log.

Signatures

Please be careful with the signature settings. They have to be consistent. This setting can be made in OAC0 for the repository and in CSADMIN for the content server. These have to be consistent. If not you get unexpected issues that it does not work, and it is hard to detect that this dis-balance in settings are causing the issue.

How to resolve the error “Tables COMPONENT and COMPONENT_DATA are inconsistent”?

In some very specific cases you will get the error “Tables COMPONENT and COMPONENT_DATA are inconsistent”. Solution for this issue might be to regenerate SAPHTTP and SAPHTTPA destinations with program RSHTTP05.

Reference OSS notes: