SAP Launchpad: Calling Transaction

Calling transactions from WebDynpro applications via Launchpad configuration is a simple task once you know how it works. The key elements to this are:

  • LPD_CUST Configuration
  • Analyzing the Receiver Transaction
  • Preparing Business Parameters for Receiver Transaction
  • Triggering LPD_CUST Navigation from WebDynpro

LPD_CUST Configuration

  • Go to transaction LPD_CUST, create a new launchpad (skip next step if you already have a launchpad to edit)
  • Enter a Role, Instance, Description and use ‘Z’ or ‘Y’ as Namespace
  • Once you are inside the launchpad, create a new application
  • Enter Link Text, Transaction Code, System Alias and Application Type as ‘TRA’ or Transaction (see Figure 1)
Figure 1: Launchpad Application Configuration
  • You can leave the rest of the fields with their default values
  • You can change the Entries Once Started field to Skip Initial Screen if Possible if your program sets the values on initial screen

Tip: Fill Application Alias with a unique value withing the launchpad to identify it within your program.

Analyzing Receiver Transaction

All types of transaction except OO transaction work well with LPD_CUST. If you have an OO transaction you will not be able to set parameters on the initial screen which makes it impossible to use Skip Initial Screen if Possible option. However, you will still be able to navigate to the transaction itself even for OO transaction.

Sample Receiver Transaction

Figure 2: Report Transaction
REPORT ycodex_tra_demo.
TABLES vicncn.
SELECT-OPTIONS: s_bukrs  FOR vicncn-bukrs,
                s_recnnr FOR vicncn-recnnr.

START-OF-SELECTION.
  WRITE: s_bukrs, s_recnnr.

Preparing Business Parameters

The proper way to pass business parameters to a transaction might sound a bit unconventional to most ABAPers. The secret is to use the Data Element name as Key instead of the screen field name (see Figure 3 & Figure 4). The reason behind this is, the launchpad program gets the report screen fields and match field with data elements rather than field names.

Key value pairs with data element used as keys
Figure 3: Sample Table Values
Figure 4: Screen Field Details

Tip: In case of SELECT-OPTIONS field you can pass multiple entries with the same key and different values and the program automatically assigns all the values to the same selection field.

Tip: You can use global sets by appending _SET to the key field in business parameters internal table.

Trigger Receiver Transaction

  • Get reference of WebDynpro Component API
  • Get reference of POWL Runtime Services
  • Use the above two references get a reference to LPD_CUST for the Role & Instance you’ve created at the beginning
  • GET_CONTENT method returns all the applications under the launchpad and APPLICATION_ALIAS field can be used to uniquely identify your application
  • From the content structure you retrieve above, you may have some default entries in APPLICATION_PARAMETER and BUSINESS_PARAMETER based on your configuration
  • Add your screen field key-value pair to BUSINESS_PARAMETER and launch the application using LAUNCH_APPLICATION method
DATA: lr_provider     TYPE REF TO if_apb_lpd_provider,
      lr_wd_component TYPE REF TO if_wd_component,
      lv_role         TYPE apb_lpd_role VALUE 'ZAM_DASH',
      lv_instance     TYPE apb_lpd_instance VALUE 'TASKS',
      lr_launchpad    TYPE REF TO cl_apb_launchpad_api,
      lt_content      TYPE apb_lpd_t_content,
      ls_content      TYPE apb_lpd_s_content.

lr_wd_component = wd_this->wd_get_api( ).
CREATE OBJECT lr_provider TYPE cl_powl_runtime_services.
cl_apb_launchpad_api=>read_for_display(
      EXPORTING
        id_role           = lv_role
        id_instance       = lv_instance
        ir_provider       = lr_provider
        ir_wd_component   = lr_wd_component
      RECEIVING
        er_launchpad      = lr_launchpad
      EXCEPTIONS
        parameter_missing = 1
        not_found         = 2
        OTHERS            = 3 ).

lt_content = lr_launchpad->get_content( ).
READ TABLE lt_content WITH KEY application_alias = 'CONTRACT_DEMO' INTO ls_content.
IF sy-subrc EQ 0.
  APPEND VALUE #( key = 'BUKRS' value = '3000' ) TO ls_content-business_parameter.
  APPEND VALUE #( key = 'RECNNUMBER' value = '1000892' ) TO ls_content-business_parameter.
  lr_launchpad->launch_application( it_application_parameters = ls_content-application_parameter
                                    it_business_parameters    = ls_content-business_parameter ).
ENDIF.

SAP Project Management: Adding Links & Buttons to Dashboard

There is no straight forward way that SAP provides to add links to column grids for Dashboard. Luckily for us we have a way to get past that limitation by using some OOP hacks and the BAdI DPR_EVE_DASHBOARD.

Create an implementation for the afore mentioned BAdI and in the method IF_EX_DPR_EVE_DASHBOARD~GET_FIELDS_FOR_SELECTION, use the below code to access the SALV table configuration.


DATA: lo_locator TYPE REF TO cl_wd_alv_ui_log_reuse,
      lo_deligate TYPE REF TO cl_wdr_delegating_view,
      lo_data TYPE REF TO object,
      lo_config_table TYPE REF TO cl_salv_wd_config_table.


lo_locator ?= cl_dpr_ui_log_locator=>get_instance( ).
lo_deligate ?= lo_locator->get_alv_context_node( )->get_context( )->controller.
lo_data ?= lo_deligate->delegate.
ASSIGN lo_data->('IF_VI_LOCATOR~MR_CONFIG_TABLE') TO FIELD-SYMBOL( <lo_config_table>).
lo_config_table = <lo_config_table>.
lt_columns = lo_config_table->if_salv_wd_column_settings~get_columns( ).

The statement lo_deligate ?= lo_locator->get_alv_context_node( )->get_context( )->controller. is only for type casting purposes to avoid object slicing. Without doing this we will not have access to delegate attribute of the class.

The statement lo_data ?= lo_deligate->delegate. is added to be able to dynamically access IF_VI_LOCATOR~MR_CONFIG_TABLE attribute via ASSIGN keyword. To know more about this you can refer to the SAP help documentation of how the ASSIGN statement behaves differently for class reference variables and interface reference variables.

SAP Project Management: Things You Shouldn’t Do (Technical)

BAdI DPR_EVENTS

The BAdI DPR_EVENTS is a very powerful one as it allows you to catch all the events that affect a cProject. Such extensive control over the application always comes with some unwanted side effects. In this case, if you try to get all of nodes’ children from which the event originated within ON_CHANGED method, it might break your application (short dump).

Related SAP Notes:

1480895 – Create subtask: Exception ‘NOT_FOUND’ triggered

cProject Subsystems

Subsystems in cProjects is another great enhancement option we have in SAP Portfolio & Project Management. Since this has impact over core functions like transaction commit; not implementing them correctly can crash your application (short dump).

Always ensure that your subsystem is activated only when necessary. You can deactivate it by not returning an instance from IF_DPR_APPL_PLUG_IN_SUBSYSTEM~GET_INSTANCE method or by returning -1 from IF_DPR_APPL_BOOTSTRAP_MEMBER~GET_SEQUENCE_PLACE method.

Method IF_DPR_APPL_PLUG_IN_SUBSYSTEM~HAS_CHANGES is very critical as returning ABAP_TRUE at the wrong time can break your application during transaction commit.