Attach Document in ABAP selection Screen / Screen


Aim of the Topic : Create a button in selection screen and assign Word document on it. It can be useful in order to attached documentation on specific Abap Report.

See below the steps to do :

§  01) Execute transaction OAOR or 0FPM002 or execute report BDSFIND_1.

Class name = 'PICTURES'
Class Type = 'OT'
Object Key = 'your codification' => Can be the name of Abap Report in our example 'ZABAP_DJOUDJOU'

§  02) In the bottom left windows, (in the "create" tabs ; double click on Word icon and upload your MS Word document.

§  03) In order to transport Word document on Simulation and Production system : Menu : "Documents" --> Transport

§  04) Sample Abap Coding :

REPORT Zdocument_selection.
*
tables: sscrfields.
selection-screen pushbutton 5(26) txtdoc user-command docu.
*
*-----------------------------------------------------------------------
* initialization.
*-----------------------------------------------------------------------
initialization.
txtdoc = '@J7@ Documentation'.

*-----------------------------------------------------------------------
* at selection-screen.
*-----------------------------------------------------------------------
at selection-screen .
if sscrfields-ucomm = 'DOCU'.
perform online_docu.
endif.
*
*&---------------------------------------------------------------------*
*& Form ONLINE_DOCU
*&---------------------------------------------------------------------*
form online_docu.
*
data: t_signat like bapisignat occurs 0 with header line,
t_compon like bapicompon occurs 0 with header line.
*
refresh :
t_signat,
t_compon.
*
call function 'BDS_BUSINESSDOCUMENT_GET_URL'
exporting
classname = 'PICTURES'
classtype = 'OT'
client = sy-mandt
object_key = 'ZABAP_DJOUDJOU'
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.
read table t_signat index 1.
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.
endif.
endform. " ONLINE_DOCU

Comments

Popular posts from this blog

SAP ABAP-Internal Table Operations and Example Program

HR ABAP Interview Questions and Answers

BDC (Batch Data Communication) - SAP ABAP