Show TOC Start of Content Area

Procedure documentation Implementing BSP Callable Objects  Locate the document in its SAP Library structure

Use

You can implement a Business Server Page (BSP) application and expose it as a callable object with a user interface.

To enable the interaction with the Guided Procedures framework, you must implement a specific data handling mechanism.

Procedure

1. Implement the Design Time Aspects of the Callable Object

The technical description of a BSP callable object includes input, output, and configuration parameters, as well as result states.

...

       1.      Define the input and output parameters of the callable object.

The input and output parameters are stored in preexisting structures. For each parameter, there is a type label and type data pair that represent metadata for the data type. In addition, there is a value label and value data pair that identify the data stored in the parameter. The input and output structures are managed using the function EUP_STRUCTURE_FACTORY.

       2.      Define configuration parameters for the callable objects.

They are represented as string attributes stored in internal tables.

Example

DATA: lv_input_type  TYPE STRING,

      lv_input_value TYPE STRING,

      lv_process_id  TYPE GUID_32,

      lv_task_id     TYPE GUID_32,

      lv_conf_props  TYPE EUP_BSP_CONF_PROPS_TABLE,

      lv_value_label TYPE REF TO EUP_VALUE_LABEL.

 

CALL METHOD PAGE->GET_ATTRIBUTE

  EXPORTING

    NAME  = 'process_id'

  IMPORTING

    VALUE = lv_process_id.

 

CALL METHOD PAGE->GET_ATTRIBUTE

  EXPORTING

    NAME  = 'task_id'

  IMPORTING

    VALUE = lv_task_id.

       3.      Create one or more result states for the callable object.

Result states are also defined as string attributes and stored in a table. At runtime, they show the result of the callable object execution, and can be used for modeling the process flow.

Example

DATA: lt_result_state TYPE EUP_BSP_ST_RESULT_STATE,

      lt_result_states TYPE EUP_BSP_RESULT_STATES,

      str type string.

 

lt_result_state-result_state = 'COMPLETED'.

APPEND lt_result_state TO lt_result_states.

2. Implement the Runtime Logic of the Object

Data is transferred from the GP framework in the SAP Web Application Server Java stack to the ABAP environment using XML representation. To transform XML data to object representation, and vice versa, you use EUP_STRUCTURE_FACTORY.

       4.      Retrieve the input data by executing function EUP_GET_BSP_INPUT_DATA.

Example

CALL FUNCTION 'EUP_GET_BSP_INPUT_DATA'

  EXPORTING

    IV_PROCESS_ID  = lv_process_id

    IV_TASK_ID     = lv_task_id

  IMPORTING

    EV_INPUT_VALUE = lv_input_value

    EV_INPUT_TYPE  = lv_input_type

    EV_OUTPUT_TYPE = lv_output_type

  TABLES

    ET_CONF_PROPS  = lv_conf_props.

 

CALL METHOD EUP_STRUCTURE_FACTORY=>UNPACK_VALUE_LABEL_FROM_XML

  EXPORTING

    IV_XML         = lv_input_value

  IMPORTING

    EV_VALUE_LABEL = lv_value_label.

 

       5.      Set the output parameters and the execution result state.

The output is packed to XML, and then stored temporarily in the ABAP stack using EUP_STORE_BSP_OUTPUT_DATA. When the Java server receives a notification for the completion of the execution, it reads the output, and it is deleted on the ABAP side.

Example

DATA: lv_value_label TYPE REF TO eup_value_label.

CALL FUNCTION 'EUP_CREATE_BSP_OUTPUT_STRUCT'

  IMPORTING

    EV_VALUE_LABEL = lv_value_label.

 

lv_value_label->set_float_struct_element( element = '1.12'

                                          label_name = 'double' ).

 

CALL METHOD EUP_STRUCTURE_FACTORY=>PACK_VALUE_LABEL_TO_XML

  EXPORTING

    IV_VALUE_LABEL = lv_value_label

  IMPORTING

    EV_XML = str.

 

CALL FUNCTION 'EUP_STORE_BSP_OUTPUT_DATA'

  EXPORTING

    IV_PROCESS_ID    = process_id

    IV_TASK_ID       = task_id

    IV_OUTPUT_VALUE  = str

  TABLES

    IT_RESULT_STATES = lt_result_states.

       6.      Complete the object’s execution.

To indicate that the execution of the callable object is completed, you use server-side scripting. You fire a completion event to URN com.sap.eu.gp.co.bsp.

Example

function raiseEvent() {

     parent.EPCM.raiseEvent("urn:com.sap.eu.gp.co.bsp", "Complete", "");

}

Result

You can activate the BSP application.

Next, you must expose the Web Dynpro component as a callable object in the GP design time. For more information, see Exposing BSPs as Callable Objects.

Example

For an example, see Implementing and Exposing a BSP Callable Object.

 

End of Content Area