Openning business partner in BP transaction

Problem: You want to programmatically show Business Partner details in BP transaction.

Solution: Again, there are at least two ways to achieve your goal.

First is to use solution from previous post: [cref openning-transaction-in-a-new-windowsession]. This however will require you to record Batch Input session using SHDB transaction and paste it into the LT_USING parameter.

Second solution is neater in my opinion. You can use two standard classes that have been designed to fit this particular requirement. These are CL_BUPA_NAVIGATION_REQUEST and CL_BUPA_DIALOG_JOEL_OPTIONS. Combined, these classes give you enough options to allow showing Business Partner in BP transaction. Here is what you should do.

  DATA: lv_partner TYPE bu_partner,
        lo_request TYPE REF TO cl_bupa_navigation_request,
        lo_options TYPE REF TO cl_bupa_dialog_joel_options.
 
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = iv_partner
    IMPORTING
      output = lv_partner.
 
  CREATE OBJECT lo_request.
  CALL METHOD lo_request->set_partner_number( lv_partner ).
  CALL METHOD lo_request->set_maintenance_id
    EXPORTING
      iv_value = lo_request->gc_maintenance_id_partner.
  CALL METHOD lo_request->set_bupa_activity
    EXPORTING
      iv_value = lo_request->gc_activity_display.
 
* Set locator invisible
  CREATE OBJECT lo_options.
  CALL METHOD lo_options->set_locator_visible( space ).
 
  CALL METHOD cl_bupa_dialog_joel=>start_with_navigation
    EXPORTING
      iv_request              = lo_request
      iv_options              = lo_options
      iv_in_new_internal_mode = abap_false
      iv_in_new_window        = abap_true
    EXCEPTIONS
      already_started         = 1
      not_allowed             = 2
      OTHERS                  = 3.
  DATA: lv_partner TYPE bu_partner,
        lo_request TYPE REF TO cl_bupa_navigation_request,
        lo_options TYPE REF TO cl_bupa_dialog_joel_options.

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = iv_partner
    IMPORTING
      output = lv_partner.

  CREATE OBJECT lo_request.
  CALL METHOD lo_request->set_partner_number( lv_partner ).
  CALL METHOD lo_request->set_maintenance_id
    EXPORTING
      iv_value = lo_request->gc_maintenance_id_partner.
  CALL METHOD lo_request->set_bupa_activity
    EXPORTING
      iv_value = lo_request->gc_activity_display.

* Set locator invisible
  CREATE OBJECT lo_options.
  CALL METHOD lo_options->set_locator_visible( space ).

  CALL METHOD cl_bupa_dialog_joel=>start_with_navigation
    EXPORTING
      iv_request              = lo_request
      iv_options              = lo_options
      iv_in_new_internal_mode = abap_false
      iv_in_new_window        = abap_true
    EXCEPTIONS
      already_started         = 1
      not_allowed             = 2
      OTHERS                  = 3.

Komentowanie jest zakończone.