首页 > 应用开发 > IT综合 > BAdI: Documents
Use
This Business Add-In (BAdI) can be utilized in the usage of documents on BW objects.
With this BADI you are able to interrupt when saving or reading BW documents and execute customer specific changes. The following operations are supported:
You can find details in the method documentation for the assigned IF_EX_RSOD_DOC_BADI interfaces.
Standard settings
The BAdi can be used more than once and is not dependent on a filter.
Activities
After you call the IMG activity, the system displays a dialog box where you enter a name for the implementation.
If implementations of this Business Add-In have already been created, the system displays them in a dialog box. You then choose one of them by choosing Create, and continue as follows:
Example
Again you can find examples in the method documentation for the IF_EX_RSOD_DOC_BADI interfaces.
Also see:
Methods:
Change the properties of a document
Create properties of a document
Delete properties of a document
Write the content of a document to the DB
Selection of Documents (Administrator Workbench or Web Application)
Controlling triggering hierarchies in reporting
**************************************************
This method is called up when properties of a document are changed.
Only the logical document properties that were changed are dealt with.
An implementation must have been created for BADI RSOD_DOC_BADI via transaction SE19.
The list of properties can be changed in the method.
For example, properties can be changed or deleted.
I_R_DOC: Document whose properties are being changed.
C_T_PROP: Changed logical document properties as a name / value pairs. You can see all available properties in the Document Modeling Workbench, under 'BW'.
All logical properties of the document (also the ones that were not changed) can be taken from parameter I_R_DOC in the following way:
DATA: l_t_prop TYPE sdokproptys.
CALL METHOD i_r_doc->get_all_prop_values_loio
* EXPORTING
* I_ONLY_BW_SPECIFIC = RS_C_FALSE
RECEIVING
r_t_prop = l_t_prop.
If you want to prevent properties from being changed, you need to send exception CX_RSOD. A message describing the cause of the error can be given with this exception:
RAISE EXCEPTION TYPE cx_rsod
EXPORTING
MSGID = 'RSOD' "Message Class
MSGNO = '152' "Message Number
MSGTY = 'E' "Message Type Error
MSGV1 = 'Text Variable 1'
MSGV2 = 'Text Variable 2'
MSGV3 = 'Text Variable 3'
MSGV4 = 'Text Variable 4'.
This message is then displayed on the user interface.
**************************************************
This method is called up when properties of a document are newly created.
The system only deals with the logical document properties.
You need to have created an inplementation for BADI RSOD_DOC_BADI via transaction SE19.
The list of properties can be changed in the method.
For example, the properties can be changed or deleted.
I_R_DOC: Document which is being changed or newly created
C_T_PROP: All logical properties of the document as name / value pairs. You can see all available properties in the Document Modeling Workbench, under 'BW'.
If you want to prevent properties from being changed, you need to send exception CX_RSOD. A message describing the cause of the error can be sent with this exception:
RAISE EXCEPTION TYPE cx_rsod
EXPORTING
MSGID = 'RSOD' "Message Class
MSGNO = '152' "Message Number
MSGTY = 'E' "Message Type Error
MSGV1 = 'Text Variable 1'
MSGV2 = 'Text Variable 2'
MSGV3 = 'Text Variable 3'
MSGV4 = 'Text Variable 4'.
This message is then displayed on the user interface.
**************************************************
This method is called up when properties of a document are deleted.
The system only deals with the logical document properties.
The list of properties to be deleted can be changed in the method.
For example, you can prevent the properties from being deleted.
I_R_DOC: Document whose properties are being deleted.
C_T_PROP: Logical properties of a document to be deleted as name / value pairs. You can see all available properties in the Document Modeling Workbench, under 'BW'. If entries in this table are deleted, these properties are not deleted with them.
If you want to prevent the document from being saved, exception CX_RSOD needs to be triggered ( see CREATE_PROPERTIES method ).
**************************************************
Saving the content of a document.
This method is called up when the content of a document is to be changed or newly created.
The content can be changed before saving.
I_R_DOC: Document whose properties are being deleted.
C_S_FILE_ACCESS_INFO: Information about content (mime type, file name, ....)
C_T_FILE_CONTENT_ASCII: Table with text document content
C_T_FILE_CONTENT_BINARY: SDOK: Table with binary document content
Only one of tables C_T_FILE_CONTENT_ASCII and C_T_FILE_CONTENT_BINARY is filled.
The properties of the document can be read as in method CHANGE_PROPERTIES.
If saving the content is to be prevented, exception CX_RSOD needs to be triggered ( see CREATE_PROPERTIES method ).
**************************************************
You can use this method to change the selection condition for documents before they are read by the database. In this way you can influence the number of selected documents.
Example: In a report, figures for the current period and for the previous one are displayed. However, you only want to display documents for the current period and not the previous one. There would normally be two entries for the period in the selection. This method enables you to delete the entry for the previous period. Thus, the system only reads documents for the current period.
This method is called up in the following cases:
I_DOC_CLASS Document class: This parameter can have the following values:
I_MODUS Callup mode: the method is called up at the following points in time:
I_R_REQUEST Request class, which shows the current status of the query or DataProvider:
This parameter is only filled when document selection is called up directly for a Web item or a query. In other words, this parameter is not filled with the document browser or in the AWB.
Useful attributes:
I_R_ITEM Web item which last selected documents:
This parameter is always filled when document selection was called up from the document browser.
With Web Applications, there are 2 variants:
I_R_PAGE Reference to page, that is, to the Web application template :
This parameter is only filled when the parameter I_R_ITEM is filled.
You can use the method I_R_PAGE->GET_TEMPLATE_NAME to get the technical name of the template.
C_TS_QUPROP Filter selection of the document properties:
The entries in this table can be changed, added or deleted to enable you to adjsut the selection to your specific reqiurements.
C_R_REQ_SEL Request selection
This class represents the selection of the DataProvider without the filter selection. This is where the rows and columns are stored.
C_SEARCH_TEXT Such string if a text search (via TREX) is also to be carried out.
**************************************************
This method allows you to control the resolution of hierarchy nodes for the selection of documents in reporting. One option is to have the resolution of hierarchy nodes completely hidden.
Example: You want to save documents on transaction data in a hierarchy
at node level. As documents cannot be stored on hierarchy nodes, use a hierarchy with postable nodes and create the documents at the corresponding characteristic values.
If such a node is restricted, all the documents that match any of its subordinate nodes are selected. The node is then resolved. However, with the restricted hierarchy node you only want to see the documents for the corresponding characteristic value. In order to be able to do this, use this BADI method to hide the hierarchy resolution.
The coding that follows shows how this requirement is implemented - resolution is hidden for all postable nodes. Furthermore, the nodes are transformed into leaves:
FIELD-SYMBOLS:
LOOP AT c_t_range ASSIGNING
CASE
WHEN space.
* leaf
* ...
WHEN i_field_info-chabasnm.
* postable node
CLEAR: c_t_node_resolve,
c_node_resolve = rs_c_false.
WHEN rsd_c_dpanm-hier_node.
* text node
* ...
WHEN OTHERS.
* other characteristic
* ...
ENDCASE.
ENDLOOP.
I_INFOPROV: InfoProvider on which the current query or the current DataProvider is based
I_COMPID: Technical name of the query (on which the current DataProvider is based)
I_FIELD_INFO: Information on the hierarchy-defining characteristic (field IOBJNM) and its reference characteristic (field CHABASNM)
I_HIENM: Technical name of the hierarchy
I_VERSION: Hierarchy version
I_HDATE: Selection date (for time-dependant hierarchies)
C_T_RANGE: Selection of hierarchy nodes / characteristic values
When calling the BADI method, this table only contains single values (SIGN = 'I' and OPT = 'EQ')
The characteristic value stands in the field LOW
The characteristic stands in the field HIGH. The following cases are to be differentiated:
To transform a postable hierarchy node into a characteristic value it is only necessary to delete the field HIGH.
C_NODE_RESOLVE:
= 'X': Resolve node
= ' ' : Do not resolve node
This parameter is set to 'X' (resolve) by default. Set this parameter to ' '(SPACE), if the node is not to be resolved.
**************************************************
[@more@]来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7941665/viewspace-970843/ ,如需转载,请注明出处,否则将追究法律责任。