top of page
Abstract Futuristic Background

Settings

Program Settings

Screen and process settings of /TSDOC/CREATE_TS transaction can be set by the /TSDOC/SETUP transaction. First of all we have to create a profile for the settings and this profile will contain several settings. The newly created profile must have an ID and Description. If these have been set, we can prepare the setting profile for the /TSDOC/CREATE_TS transaction. So-call a DEFAULT profile should be existed, which contains the default settings, but we can also create and use any number of profiles. The screen bellow shows a default profile.

After that, the /TSDOC/BADI_TECH_TS BADI of the /TSDOC/ENH_TECH_TS enhancement spot needs to be implemented and use the CHANGE_PROFILE method for the actual profile determination. The profile can be changed by ABAP code inside the CHANGE_PROFILE method. The changing parameter (CH_PROFILE) of this method needs to change to a pre-created (in /TSDOC/SETUP transaction) Profile ID. We can set a suitable logic here by ABAP code.

For example:

  • We can check for the existence of a user role and set a profile based on it

  • We can create and use a table where users can be assigned to profiles and set a profile based on it (...etc.)

The screen of /TSDOC/SETUP transaction contains several sections grouped by function.

"Screen - Fields disabled/required" section contains checkboxes that can be used to disable or make mandatory some fields on the /TSDOC/CREATE_TS transaction.

"Screen - Default value of fields" section contains the the default field values ​​that can be used when creating a new Technical Specification record by the /TSDOC/CREATE_TS transaction. 

Next section is the "Program - Functions" where the /TSDOC/CREATE_TS transaction can be controlled.​​​

Fields

Description

TS Creation disabled [NEW]

New button can be disabled by this checkbox

TS Change disabled [CHANGE]

Change button can be disabled by this checkbox

TS Deletion disabled [DELETE]

Delete button can be disabled by this checkbox

TS Document Gen. disabled

Technical Specification generation button can be disabled by this checkbox

Disable path checking

(at create)

File path checking can be disabled

Disable file existence check

(at create)

File existence can be disabled

IF doc. has been gen. THEN Doc.Gen. dis.

If Technical Document has been already generated the document re-generation can be disabled by this checkbox

IF doc. has been gen. THEN Change dis.

If Technical Document has been already generated the Technical Specification record change can be disabled by this checkbox

IF doc. has been gen. THEN Delete dis.

If Technical Document has been already generated the Technical Specification record deletion can be disabled by this checkbox

Modifiable TR denied for using

Modifiable (not released) transport denied for using. Modifiable TR can't be used for TS document creation.

The following two lists are displayed on the "Configuration Tables" TAB:

  • ​​​Regex Table

This list references the /TSDOC/REGEX table, which can be maintained by transaction SM30 (/TSDOC/V_REGEX). This table contains the regular expressions which the Technical Specification of a newly created program is created. The program looks for the string in program code based on the regular expression and takes over all the comments of its environment into the TS document.​​​​​​​​​

You can find more details about the Regex Table at the link below:

  • ​​​​​​​​​Object Table

This list references the /TSDOC/OBJECT table. This table contains that objects that are managed by program.​

Technical Parameters

Some settings reach from /TSDOC/PARAM table, which can be maintained by transaction SM30 (/TSDOC/V_PARAM). This table currently contains the following setting options:​

  • BLOCK_BEG - Begin of the Code Section / BLOCK_END - End of the Code Section

Possible parameters: any regex expression

Default BLOCK_BEG parameter: ^[*"][ ]*[>]{2}|^[ ]*["][ ]*[>]{2} (it means: * >> or " >>)

Default BLOCK_END parameter: ^[*"][ ]*[>]{2}|^[ ]*["][ ]*[>]{2} (it means * << or " <<)

​These parameters is a regular expression, it is a comment format, which can be used to transfer a complete set of code into the TS document​.

​

For example:

Begin of the code - Regular expression: ^[*"][ ]*[>]{2}|^[ ]*["][ ]*[>]{2}

It means these comment format of code:

* >> 

" >>


End of the code - Regular expression: ^[*"][ ]*[<]{2}|^[ ]*["][ ]*[<]{2}

It means these comment format of code: 

* <<  

" ​<<

​​

In this case, if you want to transfer a complete code section to the TS document, you must use the following comments in the program code:

​

* >> Begin - Comment of Statement

code line 1

code line 2

code line 3

* << End - Comment of Statement 

​

OR

​

" >> Begin - Comment of Statement

code line 1

code line 2

code line 3

" << End - Comment of Statement 

​​​

If you do not use a closing comment (* <<), the code lines are transferred to the TS document from the opening comment to the first empty line.

​

For example the "code line 1" and "code line 2" will be transferred to the TS document, but the "code line 3" won't be transferred.

* >> Begin - Comment of Statement

code line 1

code line 2

​

code line 3​

​​​​​​​

  • CODE_LEN - Length of the comparing code line​

Possible parameters: any integer number

Default parameter: 60

Length of the code line can be controlled by this parameter in the "Code Changes" section of the TS document.

​

  • CODE_LEN_N - Length of the new code line

Possible parameters: any integer number

Default parameter: 110

Length of the code line can be controlled by this parameter in the "New Codes" section of the TS document.

​​

  • FORMAT_DAT - Date format of TS Document

Possible parameters: ENVIR / ISO / RAW / USER

Default parameter: ISO

This parameter can be used to set for the date format of generated Technical Specification.

​​​​​​

  • FORMAT_TIM - Time format of TS Document

Possible parameters: ENVIR / ISO / RAW / USER

Default parameter: ISO

This parameter can be used to set for the time format of generated Technical Specification.

​​​​​

  • LINK_CHG - Change web link

Possible parameters: any web link

Default parameter: EMPTY

If this field has been populated the button next to the Change ID field will be active. The parameter can be contained the following place holder: $document_id$ for the Change Document ID. This place holder will be replaced by the value of the Change ID field.

​​

  • LINK_SOL - Solman web link

Possible parameters: any web link

Default parameter: EMPTY

If this field has been populated the button next to the Solman ID field will be active. The parameter can be contained the following place holder: $document_id$ for the Solman Document ID. This place holder will be replaced by the value of the Solman ID field.

​

  • MIN_CODE - Minimum code line number

Possible parameter values: any integer number

Default parameter value: 120

​If the code line number of a new program does not reach this value, then entire code will be transferred on the TS Document "New Code" section.​​

​

  • SCREEN_CUST - Custom Screen Enable

Possible parameters: EMPTY / X 

Default parameter: X

This parameter can be used to enable the display of the customer screen.

​

  • SNOTE_WEB - SAP Note Web Page

Possible parameters: any web link

Default parameter: https://me.sap.com/notes/&1

​SAP Note prefix Web URL. This prefix URL will be used by the program for SAPNOTE links. The parameter can be contained the following place holder: &1 for the SAP Note ID. This place holder will be replaced by the SAP Note ID.

​​​​

  • TEMP_PRE - Template prefix

Possible parameters: any string

Default parameter: /TSDOC/

Several different document templates can be uploaded  by SMW0 transaction . Template contains the document frame, headers, footers, logos and placeholders. For example these temples can be separated based on language. We must enter an Template ID, when creating a new template. The prefix of these Template IDs should be matched to the one set here.

​​​​

  • TOC_SKIP - Skip TOC's versions

Possible parameters: EMPTY / X 

Default parameter: X

It may happen that several TOC versions of object are created during development, in the interest of being able to test your development in a test environment. Usually we need to exclude these TOC versions when creating the Technical Specification document. We can do this TOC exclusion with this checkbox. The best practice to turn off TOC version creation in SAP.

User Parameters

Parameters

Description

PAGING lock by consultant

UserID can be written into this field, which will be affected the paging. 
The paging will only affect the documents of the consultant.
This field will be filled automatically by the /TSDOC/PAGING_CON parameter, which can be set in SU3 transaction.

by developer

UserID can be written into this field, which will affect the paging.

The paging will only affect the documents of the developer.

This field will be filled automatically by the /TSDOC/PAGING_DEV parameter, which can be set in SU3 transaction.

by creator

UserID can be written into this field, which will be affected the paging. 
The paging will only affect the documents of the creator.
This field will be filled automatically by the /TSDOC/PAGING_CREAT parameter, which can be set in SU3 transaction.

Parameters in SU3 transaction:

Business Add-Ins

We can control our processes with the BADIs of the /TSDOC/ENH_TECH_TS enhancement spot.

 

​Enhancement Spot: /TSDOC/ENH_TECH_TS

BADIs: /TSDOC/BADI_TECH_TS

​

Methods:

  • CHANGE_PARAMETER - Use to change the parameters which was pre-set in the /TSDOC/PARAM table

  • CHANGE_PARAMETER_SCREEN - Use to change the Template Prefix / Change Document link and Solman link

  • CHANGE_PROFILE - Use to set the proper profile for the user more details...

  • CHANGE_VALUE - Use to change the values on the screen (on new/display/change/report screen)

  • CHECK_TS - Use to check the TS record before saving more details...

  • DOC_GEN_AFTER - Use to change the full path after the TS document generation

  • DOC_GEN_BEFORE - Use to change the path and filename before the TS document generation

  • INTEGRATION_METADATA - Use to populate the metadata table on the TS document more details...

  • SAVE_BEFORE - Use to mange data before saving

Business Add-In: Custom Fields 

It is possible to place your custom fields on a separate tab on the screen. For this you have to set the SCREEN_CUS field to 'X' in the parameter table. As result an empty TAB named Custom Fields will appear on the /TSDOC/CREATE_TS transaction screen. Then you need to create a custom program and an associated screen, then configure it in the Screen Enhancement interface.

If you want to display the field on the screen, you must append it to the /TSDOC/TS_SRC structure as an append structure. If you want to store the field value in a database also, the new field must be added to the /TSDOC/TS table as an append structure.

Let's see an example of handling custom fields in a custom program. The program uses the /TSDOC/CUST_SCREEN_DATA_TRANS function for data transport.

*&-------------------------------------------------------*
*& Program /TSDOC/BADI_CUSTOM_SCREEN
*&-------------------------------------------------------*
*& Example Program for Screen BADI Implementation
*&
*& Screen Elements Update:
*& Add a new append structure to the /TSDOC/TS_SCR screen structure
*&
*& Database Fields Update:
*& Add a new append structure to the /TSDOC/TS database table
*&
*&-------------------------------------------------------*


PROGRAM /tsdoc/badi_custom_screen.

  TABLES: /tsdoc/ts_scr.
  DATA  : gv_mode TYPE /tsdoc/mode.

  MODULE status_1000 OUTPUT.

  " Receive data from Main Program
    CALL FUNCTION '/TSDOC/CUST_SCREEN_DATA_TRANS'
      IMPORTING
        ex_ts   = /tsdoc/ts_scr
        ex_mode = gv_mode.

  " Display Mode - All Fields are Disabled
    IF gv_mode EQ 'DIS'.
      LOOP AT SCREEN.
        screen-input = 0.
        MODIFY SCREEN.
      ENDLOOP.
    ENDIF.

  " New Mode    - All Fields are Enabled
  " Change Mode - All Fields are Enabled

    IF gv_mode EQ 'NEW' OR gv_mode EQ 'CHG'.
      LOOP AT SCREEN.
        screen-input = 1.
        MODIFY SCREEN.
      ENDLOOP.
    ENDIF.

  ENDMODULE.

  MODULE user_command_1000.

  " Send data to Main Program
    CALL FUNCTION '/TSDOC/CUST_SCREEN_DATA_TRANS'
      EXPORTING
        im_ts = /tsdoc/ts_scr.

  ENDMODULE.

Business Add-In: Change Profile

Business Add-In: Change Profile

​​User permission and the TS creation process can be controlled by CHANGE_PROFILE method. First of all we have to create a profile by /TSDOC/SETUP transaction. These new created profiles can be used inside this CHANGE_PROFILE method. We have to set the CH_PROFILE change parameter inside this method. If you do not set a profile here, the system will use the DEFAULT profile​. We can set a suitable logic here by ABAP code.

 

For example:

  • We can check for the existence of a user role and set a profile based on it

  • We can create and use a table where users can be assigned to profiles and set a profile based on it (...etc.)

​​

Parameters:

CH_PROFILE - Change parameter

​

Let's see an example:

METHOD /tsdoc/if_tech_ts~change_profile.

  ch_profile = 'PROFILE_ADMIN'.           " Administrator Profile
" ch_profile = 'PROFILE_DEV'.             " Developer Profile
" ch_profile = 'PROFILE_USER'.            " User Profile

ENDMETHOD.

Business Add-In: Check TS record before saving

Business Add-In: Check TS record before saving

We can add info/warning/error messages to the TS record creation/update process by this CHECK_TS method. 

​​

Parameters:

IM_MODE - Import parameter. Value of this parameter can be NEW - New / CHG - Change

IM_TS_TRANS_TAB - Import parameter. Transport table.

IM_TS_DOC_TAB - Import parameter. Document table.

CH_MESSAGES - Change parameter. Message table.

​

Let's see an example:

METHOD /tsdoc/if_tech_ts~check_ts.
*&--------------------------------------------------------------*

*& Description:
*&   IM_MODE parameter value can be
*&     > NEW - New
*&     > CHG - Change
*&--------------------------------------------------------------*


  APPEND INITIAL LINE TO ch_messages ASSIGNING FIELD-SYMBOL(<fs_message>).
  <fs_message>-msgid  = '00'.
  <fs_message>-msgno  = '001'.
  <fs_message>-msgty  = 'S'.
  <fs_message>-msgv1  = 'Success Message'.
  <fs_message>-lineno = 1.

  APPEND INITIAL LINE TO ch_messages ASSIGNING <fs_message>.
  <fs_message>-msgid  = '00'.
  <fs_message>-msgno  = '001'.
  <fs_message>-msgty  = 'I'.
  <fs_message>-msgv1  = 'Info Message'.
  <fs_message>-lineno = 2.

  APPEND INITIAL LINE TO ch_messages ASSIGNING <fs_message>.
  <fs_message>-msgid  = '00'.
  <fs_message>-msgno  = '001'.
  <fs_message>-msgty  = 'W'.
  <fs_message>-msgv1  = 'Warning Message'.
  <fs_message>-lineno = 3.

  APPEND INITIAL LINE TO ch_messages ASSIGNING <fs_message>.
  <fs_message>-msgid  = '00'.
  <fs_message>-msgno  = '001'.
  <fs_message>-msgty  = 'E'.
  <fs_message>-msgv1  = 'Error Message'.
  <fs_message>-lineno = 4.

  APPEND INITIAL LINE TO ch_messages ASSIGNING <fs_message>.
  <fs_message>-msgid  = '00'.
  <fs_message>-msgno  = '001'.
  <fs_message>-msgty  = 'A'.
  <fs_message>-msgv1  = 'Abort Message'.
  <fs_message>-lineno = 5.

ENDMETHOD.

Business Add-In: Metadata Integration

Business Add-In: Metadata Integration

We can display the metadata integration part of the TS documentation with INTEGRATION_METADATA method. Afterwards the auto-formatting script is run, the metadata fields of the file will be filled with the text specified in the table.

​

Let's see an example:

METHOD /tsdoc/if_tech_ts~integration_metadata.
* Possible Metadata Elements:
*   - Title
*   - Comments
*   - Subject
*   - Keywords
*   - Author
*   - Category
*   - Company
*   - Language
*   - Content Status


  DATA: ls_address TYPE bapiaddr3,
        lt_return  TYPE TABLE OF bapiret2.

  INCLUDE /tsdoc/create_ts_top.

  FIELD-SYMBOLS: <fs_metadata> TYPE tt_meta_table.
  ASSIGN ch_metadata TO <fs_metadata>.

" Metadata Title = Technical Specificaton Title
  APPEND INITIAL LINE TO <fs_metadata> ASSIGNING FIELD-SYMBOL(<fs_metadata_item>).
  <fs_metadata_item>-meta_id    = 'Title'.
  <fs_metadata_item>-meta_value = im_ts-title.

" Metadata Comment = Technical Specificaton Change ID and Solman ID
  APPEND INITIAL LINE TO <fs_metadata> ASSIGNING <fs_metadata_item>.
  <fs_metadata_item>-meta_id    = 'Comments'.
  <fs_metadata_item>-meta_value = im_ts-change_id && | | && '|' && | | && im_ts-solman_id.

" Metadata Subject = Technical Specificaton ID
  APPEND INITIAL LINE TO <fs_metadata> ASSIGNING <fs_metadata_item>.
  <fs_metadata_item>-meta_id    = 'Subject'.
  <fs_metadata_item>-meta_value = im_ts-id.

" Metadata Category = Technical Specificaton Module
  APPEND INITIAL LINE TO <fs_metadata> ASSIGNING <fs_metadata_item>.
  <fs_metadata_item>-meta_id    = 'Category'.
  <fs_metadata_item>-meta_value = im_ts-module_id.

" Metadata Author = Developer Name and ID
  CLEAR: ls_address.
  REFRESH: lt_return[].
  CALL FUNCTION 'BAPI_USER_GET_DETAIL'
    EXPORTING
      username      = im_ts-developer
      cache_results = 'X'
    IMPORTING
      address       = ls_address
    TABLES
      return        = lt_return.

  APPEND INITIAL LINE TO <fs_metadata> ASSIGNING <fs_metadata_item>.
  <fs_metadata_item>-meta_id    = 'Author'.
  <fs_metadata_item>-meta_value = ls_address-fullname && ' (' && im_ts-developer && ')'.

" Metadata Keywords = Consultant Name and ID
  CLEAR: ls_address.
  REFRESH: lt_return[].
  CALL FUNCTION 'BAPI_USER_GET_DETAIL'
    EXPORTING
      username      = im_ts-consultant
      cache_results = 'X'
    IMPORTING
      address       = ls_address
    TABLES
      return        = lt_return.

  APPEND INITIAL LINE TO <fs_metadata> ASSIGNING <fs_metadata_item>.
  <fs_metadata_item>-meta_id    = 'Keywords'.
  <fs_metadata_item>-meta_value = ls_address-fullname && ' (' && im_ts-consultant && ')'.

ENDMETHOD.

Result on the TS Document

Result in File Explorer

Function Modules

New Technical Specification document can be created by the /TSDOC/CREATE_TS_DOC function. First we need a TS record that contains the required data for the document creation. This identifier is passed to the function and it generates the document based on it.

​

Import parameters:

  • IM_TS_ID - Technical Specification ID

  • IM_PROFILE_ID - Profile ID

  • IM_DOC_MODE - Document Mode (DOC/DRF)

  • IM_WO_CONF_OVERWRITTEN - Without file overwritten confirmation

  • IM_WO_CONF_OPEN - Without file open confirmation

​​

Exceptions:

  • NOT_FOUND_TS - TS record doesn't exist

  • NOT_FOUND_PROFILE - Profile doesn't exist

  • NOT_FOUND_TRANSPORT - Transport doesn't exist

  • NOT_FOUND_OBJECT - Object doesn't exist

FUNCTION /TSDOC/CREATE_TS_DOC.
 

Local Interface:
  IMPORTING
     REFERENCE(IM_TS_ID)        TYPE  /TSDOC/TS_ID
     REFERENCE(IM_PROFILE_ID)   TYPE  /TSDOC/PROFILE_ID
     REFERENCE(IM_DOC_MODE)     TYPE  CHAR3
     REFERENCE(IM_WO_CONF_OVERWRITTEN)

                                TYPE  ACTIVE OPTIONAL
     REFERENCE(IM_WO_CONF_OPEN) TYPE  ACTIVE OPTIONAL
  EXCEPTIONS
      NOT_FOUND_TS
      NOT_FOUND_PROFILE
      NOT_FOUND_TRANSPORT
      NOT_FOUND_OBJECT

bottom of page