Programs holding its own documents – “Stop running to find the documents”.
Purpose : 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 text–a00.
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 sy–subrc <> 0.
MESSAGE ID sy–msgid TYPE sy–msgty NUMBER sy–msgno
WITH sy–msgv1 sy–msgv2 sy–msgv3 sy–msgv4.
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 sy–ucomm.
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 = sy–mandt
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 sy–subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF sy–subrc = 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 sy–subrc <> 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 = sy–mandt
doc_id = t_signat–doc_id
EXCEPTIONS
nothing_found = 1
parameter_error = 2
not_allowed = 3
error_kpro = 4
internal_error = 5
not_authorized = 6
OTHERS = 7
.
IF sy–subrc <> 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.
hi
kind of good development..
but have some queries regarding the same
1) how you are going to cover version managment of document and there may be several changes in object at later stage
2) Can this will be extended to funtional configuration?
The idea can be used to have information document instead of keeping Technical specification attached , as the technical specification and configuration document are governed for audit, so once should not ignore the importance of document managment.
Hi Sachin,
Version Mangaement is possible.
The way you could do that is by going to OAOR execute as like i mentioned above,then select the file which you want to change an click on the check box.
Then in the menu Documents--->Export it will ask for a pet in your local machine, enter that and give ok.
It will be available in your system make changes to that document and add that same document as i mentioned above.
Then it will prompt you for a TR which will help you in transporting.
Regarding Functional configuration, i hope it is not possible.
Sure for audit purpose it will be so helpful.
Thanks for your comments.
Regards,
Dinesh.
Hi dinesh ,
Good Try .
With Regards
Prakash.S
nice.............
Hi Dinesh,
Really I appreciate to write this blog, its different scenario in reports.
Regard's,
Shashi Kanth.
Yes shakshi it would me more helpful in case of the reports.
Hi Dinesh.
Great and good idea.
This will reduce the functional and technical gap's.
Can you please clarify my doubts...
How we are maintaining version? in same document or creating new documents
How we are going to tracking who edited and changed the document.
The Document will available in all instance? is it transportable?
Regards,
Vijayashankar V.
Hi Vijay,
We can maintain versions just by downloading and making changes to the file,then need to upload by the same process.i have explained above about this also.
We could track the changes based on the TR also, because it will prompt for a transport request as well.
Thanks,
Dinesh.
innovative and useful
Nice document. Its very useful for the developers who can update/create document and find the documents easily instead of searching for it in share points/ share folders.
Good thinking!
Thanks for sharing Dinesh.
Thanks Jaffer.It would be more useful to maintain versions.