Programs holding its own documents: The idea of this documentation concept is to make your programs have their own documents in SAP system itself,which helps the developer who makes changes to the program in future.Even helps a layman to understand what the program does and what for the program is done.

Idea Behind : The idea behind this Blog is to give an idea to the developers how to make their program hold their own documents.Usually in our daily routine developers and functional consultants searching the person who developed that object.

Advantages :

 

1. No need to maintain the documents in a share folder or in a different repository.

2. Since this can be created as a Function module or subroutine it can be used in any of the programs.

3.It Supports most of the commonly used formats like DOC,XLS,PDF and more like JPG, JPEG.

4.Last but not least “It is also transportable to other landscapes like Quality and Prod.

Procedure:

In this blog i will take you to the process in 5 quick steps.

Step 1:

Run the transaction OAOR or execute the program BDSFIND_1.

The selection screen looks like this:

 

In this enter

class name  : pictures.

class type  : OT (other type of objects).

object key : Enter your Program or object name.

Then Execute (F8).

STEP 2 :

Executing that we will get a screen like below.In that expand the standard document types menu.

 

In that double click the attachment or Text because we are going to add the word documents related to the program (TS & FS).

Then it will allow you to import file from your local machine,then select the file and give open.

 

Then You could give the Short Description for the Documents in the next screen.

Like the above step we added the Technical Specification document also.We can see the added documents by clicking on text tree.

 

Now the step 2 is been completed. we have  successfully  added our documents to the SAP system.

Step 3:

Now the File is been added to the SAP system.If you want the file to be transported to the Quality and Production system then follow the below step by creating a TR or adding it to an existing TR.

Check the check boxes of the documents that you want to transport and click on documents–>Transport.

It will prompt you to transfer all the selected documents,click yes then will ask for TR.

You could create a new TR or assign it to an open TR.It is advisable to use the same TR of the program to which you want to display the documents.

 

Enter the TR details,then it will be ready to be transported.

Step 4:

Linking this file to your program and make it available to view while executing the program.

use the following code:

 

report ZDOCUMENTATION_HELP.

*—Data Declaration.

DATA: t_signat LIKE bapisignat OCCURS 0 WITH HEADER LINE,

t_compon LIKE bapicompon OCCURS 0 WITH HEADER LINE,

v_doccnt TYPE char08, “bds_dcount,

v_choice TYPE char300,

v_answer TYPE c.

*—selection screen design for the help icon.

SELECTION-SCREEN BEGIN OF BLOCK doc_help WITH FRAME TITLE texta00.

SELECTION-SCREEN PUSHBUTTON /1(20) but1 USER-COMMAND call_help VISIBLE LENGTH 24.

SELECTION-SCREEN END OF BLOCK doc_help.

*——————————————————————–*

*              AT SELECTION SCREEN OUTPUT – PBO

*——————————————————————–*

*—Here with the below function module in the At selection-screen output

*   event we create an icon in the selection screen where by clicking that

*   it will show the documents we added in the system.

AT SELECTION-SCREEN OUTPUT.

*—To create an icon in selection screen.

CALL FUNCTION ‘ICON_CREATE’

EXPORTING

name                  = ‘ICON_SYSTEM_HELP’

text                  = ‘Tech Details’

add_stdinf            = ‘X’

IMPORTING

RESULT                = but1

EXCEPTIONS

icon_not_found        = 1

outputfield_too_short = 2

OTHERS                = 3.

IF sysubrc <> 0.

MESSAGE ID symsgid TYPE symsgty NUMBER symsgno

WITH symsgv1 symsgv2 symsgv3 symsgv4.

ENDIF.

*——————————————————————–*

*               AT SELECTION SCREEN – PAI                            *

*——————————————————————–*

*—Here we are linking the user command of this help buton to fetch the

*   the data from the SAP system.

AT SELECTION-SCREEN.

*—If the push button is clicked call the Help Files

CASE syucomm.

WHEN ‘CALL_HELP’.

CLEAR: v_choice, v_answer, v_doccnt.

*—Call the program to process HELP Files

*—Read document details

CALL FUNCTION ‘BDS_BUSINESSDOCUMENT_GET_URL’

EXPORTING

classname                        = ‘PICTURES’

classtype                        = ‘OT’

client                           = symandt

object_key                       = ‘ZDOCUMENTATION_HELP’

url_lifetime                     = ‘T’

TABLES

signature                        = t_signat

components                       = t_compon

EXCEPTIONS

nothing_found                    = 1

parameter_error                  = 2

not_allowed                      = 3

error_kpro                       = 4

internal_error                   = 5

not_authorized                   = 6

OTHERS                           = 7

.

IF sysubrc <> 0.

*        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

*                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

IF sysubrc = 0.

*—To Display the Pop up with all document information.

CALL FUNCTION ‘POPUP_WITH_TABLE’

EXPORTING

endpos_col   = ’80’

endpos_row   = ’10’

startpos_col = ‘4’

startpos_row = ‘5’

titletext    = ‘Double CLICK the HELP file to OPEN’

IMPORTING

choice       = v_choice

TABLES

valuetab     = t_compon

EXCEPTIONS

break_off    = 1

OTHERS       = 2.

IF sysubrc <> 0.

*          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

*                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

MESSAGE  ‘User CANCELLED Processing’ TYPE ‘S’.

*—There are situations after the BDS Call the program hangs,to avoid that.

SUBMIT zdocumentation_help VIA SELECTION-SCREEN.

ELSE.

IF v_choice IS INITIAL.

MESSAGE  ‘User CANCELLED Processing’ TYPE ‘S’.

*—There are situations after the BDS Call the program hangs,to avoid that.

SUBMIT zdocumentation_help VIA SELECTION-SCREEN.

ELSE.

MESSAGE  ‘Opening SELECTED file’ TYPE ‘I’.

ENDIF.

ENDIF.

*—Process data

v_doccnt = v_choice.

SORT t_signat BY doc_count.

READ TABLE t_signat WITH KEY doc_count = v_doccnt.

*—Open the selected document

CALL FUNCTION ‘BDS_DOCUMENT_DISPLAY’

EXPORTING

client                = symandt

doc_id                = t_signatdoc_id

EXCEPTIONS

nothing_found         = 1

parameter_error       = 2

not_allowed           = 3

error_kpro            = 4

internal_error        = 5

not_authorized        = 6

OTHERS                = 7

.

IF sysubrc <> 0.

*          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

*                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

*–Again after HELP File is displayed, call back the program to prevent slowing down or hanging issues

SUBMIT zdocumentation_help  VIA SELECTION-SCREEN.

ENDIF.

WHEN OTHERS.

ENDCASE.

 

Step 5:

Then execute the code the selection screen looks like the below screenshot.

 

Click on the TECH DATA icon which we created through our code.

a popup appears like below,there select Tech spec or functional spec whatever you want to view.

 

Here i have selected the Tech spec and clicked ok.

The Word document for Tech spec which we uploaded in the SAP system will be opened like below.

 

we are done…

We can add the rest part of our code so that the documents explaining about that code can be stored here.

Hereafter no need to maintain the documents in a different repository,just have it with your program itself.

Enjoy ???? ….

Thanks,

Dinesh.

 

New NetWeaver Information at SAP.com

Very Helpfull

 

 

User Rating: Be the first one !