BAdI: Web Item

ZCLouis發表於2007-09-21

BAdI: Web Item "List of 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 change HTML created from "Document Lists" items or specify it entirely yourself.

Specifically you can change the HTML for

  • the context (the selections),
  • the "additional functions" pushbutton,
  • the document lists
  • the complete item

Use:

  • Display document content instead of only showing links.

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:

    1. In the dialog box, enter a name for the implementation of the Add-In and choose Create.
    The system displays the initial screen for creating Business Add-In implementations.
    2. On this screen, enter a short description for you implementation in the Implementation Short Text field.
    3. If you choose the Interface tab, you will notice that the system has filled in the Name of the Implementing Class field automatically, by assigning a class name based on the name of your implementation.
    4. Save your entries and assign the Add-In to a package.
    5. To edit a method, double-click its name.
    6. Enter your implementation code between the method ~. aund endmethod. statements.
    7. Save and activate your code. Navigate back to the Change Implementation screen.
    Note: You can also create an implementation for an Add-In and not activate it until later. If you want to do this, do not carry out the following step:
    8. Choose Activate.
    When the application program is executed, the system carries out the code in the method you wrote.

Example

Again you can find examples in the method documentation for the IF_EX_RSOD_ITEM_DOC_LIST interfaces.

Also see:

Methods

***************************************************

Change Output of Context (of Selection)

Functionality

You can use this method to modify the context output (of the selection) for the item.

Result

You can change the HTML coding in parameter C_HTML or you can formulate it yourself completely.

Parameters

Extensive documentation is available for the following parameters in the :

  • I_R_PAGE
  • I_R_ITEM
  • I_R_CONTEXT

C_T_HTML: HTML generated from the item for the context

Here, the HTML coding is stored in a table. A row exists in table C_T_HTML for each dropdown box in the context. Each row has two entries:

    1. The HTML coding for the dropdown box label
    2. The HTML coding for the dropdown box itself.

You can delete and insert rows and also change the content within a row. The changed table is displayed from the item using a HTML table.

***************************************************

Modify Output of "Additional Functions" Pushbutton

Functionality

You can use this method to modify the output of the "Additional Functions" pushbutton.

Result

You can change the HTML coding in parameter C_HTML or you can formulate it yourself completely.

Parameters

Extensive documentation is available for the following parameters in the :

  • I_R_PAGE
  • I_R_ITEM
  • I_R_CONTEXT

C_HTML HTML generated from the item for the document list
This can be changed and/or added to.

***************************************************

Modify Total Output of Item

Functionality

You can use this method to change the HTML generated from the "List of Documents" item or to formulate it completely yourself.

Result

The HTML coding in parameter C_HTML is changed or formulated completely by you.

Parameters

I_R_PAGE: Reference to the page, that is, to the Web application template.
For example, you can use method I_R_PAGE->GET_TEMPLATE_NAME to get the technical name of the template.

I_R_ITEM: Reference to the item "List of Documents".
You can use attribute I_R_ITEM->N_NAME to access the name of the item (as maintained in the Web Application Designer).
Additionally, you can also use attribute I_R_ITEM->N_R_ATTRIBUTE to access the attributes of the items. In the following example, the system gets the value of the parameter SHOW_PROPERTIES (properties are displayed):

L_SHOW_PROPERTIES = I_R_ITEM->N_R_ATTRIBUTE->GET( ID = I_R_ITEM->C_PARAMETER_SHOW_PROPERTIES).

Additional properties of the item:

  • C_PARAMETER_TARGET_FRAME: Frame (for frameset or IFRAME)
  • C_PARAMETER_SHOW_CONTEXT: Context displayed (how)
  • C_PARAMETER_SHOW_PROPERTIES: Properties displayed
  • C_PARAMETER_MAXVALUES: Maximum number of values in the dropdown boxes
  • C_PARAMETER_CAPTION: Caption
  • C_PARAMETER_CLOSED: Closed
  • C_PARAMETER_GENERATE_LINKS: Generate links
  • C_PARAMETER_HEIGHT: Height
  • C_PARAMETER_HIDDEN: Hide
  • C_PARAMETER_ITEM_NAME: Render item name
  • C_PARAMETER_WIDTH: Width

The following item methods are of interest here:

  • SET_HTML_INTO_ACTIVE_TABSTRIP: This method packs the HTML code into the active tab page (search or selection).
  • RENDER_DOCUMENT_LINK: Builds the HTML for the link to a document. Additionally, the pushbutton used to change the document can also be displayed.
  • RENDER_CONTEXT_DROP_DOWN: Builds the HTML for a dropdown box in the context.
  • RENDER_ATTRIBUTES: Builds the HTML for the properties of a document.

I_R_CONTEXT: Reference for documents selection. The following methods are of interest here:

  • GET_DOCUMENTS: Gets a list (R_R_DOCS) of the documents currently selected. The documents in this list can be accessed using parameter N_TH_DOC.
  • GET_PROPERTIES_SELECTION: Gets the filtered properties- that is, the content of the context.

The following parameters contain the fragments of the HTML coding. These HTML fragments in this method can be displayed in a different order or with a different layout using HTML tables.

I_HTML_BACK: HTML Coding for the pushbutton "Close and Back"

I_T_HTML_SEARCH: HTML Coding for the search

I_T_HTML_CONTEXT: HTML Coding for the context (the selection). This coding conists of a table with two columns. The first column contains the labels- the second one contains the dropdown boxes. The item displays this information using an HTML table.

I_HTML_FUNCTIONS: HTML Coding pushbutton "Additional Functions". This coding consists of a table with one column. The item displays this information using an HTML table.

I_HTML_LIST: HTML Coding of document list.

C_HTML: HTML generated from item as string.
This can be changed or enhanced. For example, you can create an HTML table with 2 cells. You add the HTML code generated from the item into the first cell. In the second cell you add your own specific HTML. You then return the entire HTML code in parameter C_HTML.

***************************************************

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7941665/viewspace-970846/,如需轉載,請註明出處,否則將追究法律責任。

相關文章