Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Call Transaction BP with specific Company Code

yoppy_santoso
Participant
0 Kudos

Hi all,

I want to Call Transaction 'BP' with specific Company Code in abap, how to?
I have this parameter

And I want display like below picture


I found this article, but its not working, and I dont know what is value for rfha?

SET PARAMETER ID'BUK'FIELD i_final-bukrs.
SET PARAMETER ID'T55'FIELD i_final-rfha.

CALL TRANSACTION 'TM03' AND SKIP FIRST SCREEN.


Thanks

1 ACCEPTED SOLUTION

mateuszadamus
Active Contributor

Hi yoppy.santoso

First, I'd like to ask you to change the subject of your question, to give information about Company Code and not Customer Code. If that's something you cannot do, then please ask moderator for it.

Second, the SET PARAMETER keyword is responsible for setting a value to a global parameter, which name is provided just after the keyword, from the variable that is provided after FIELD option. In the example provided by you, global parameter BUK will have a value from field I_FINAL-BUKRS and parameter T55 will have a value from field I_FINAL-RFHA.

This will work fine for the TM03 transaction, as this transaction has to fields (with mentioned parameters) on the initial screen. But won't work for BP transaction, as the transaction itself is a bit more complicated.

To solve your question you need to make use of the CL_BUPA_DIALOG_JOEL class and its START_WITH_NAVIGATION method. Below is the code on how to do it.

CONSTANTS:
  gc_activity_create  TYPE bu_aktyp VALUE '01',
  gc_activity_change  TYPE bu_aktyp VALUE '02',
  gc_activity_display TYPE bu_aktyp VALUE '03'.

PARAMETERS: p_bp TYPE bu_partner.
PARAMETERS: p_cc TYPE bukrs.

START-OF-SELECTION.
  PERFORM open_bp USING p_bp p_cc gc_activity_change.

FORM open_bp
  USING
    iv_bp TYPE bu_partner
    iv_cc TYPE bukrs
    iv_activity TYPE bu_aktyp.

  DATA:
    ls_role TYPE bus_roles.

  " need to set it as a parameter
  " so that it's read in the Company Code subscreen
  SET PARAMETER ID 'BUK' FIELD iv_cc.

  " create new request
  DATA(lo_request) = NEW cl_bupa_navigation_request( ).
  " open request with selected partner number
  lo_request->set_partner_number( iv_bp ).
  " set the activity you want the user to start the maintenance with
  lo_request->set_bupa_activity( iv_activity ). " 01 - Create, 02 - Change, 03 - Display

  " change the role of the BP to the desired one
  " together with the sub header id
  ls_role-role = 'FS0000'.
  lo_request->set_bupa_partner_role( ls_role ).
  lo_request->set_bupa_sub_header_id( 'FS0001' ).

  " display general data by default
  lo_request->set_maintenance_id( 'B' ). " B - Partner

  " set start-up options
  DATA(lo_options) = NEW cl_bupa_dialog_joel_options( ).
  " start the transaction with an invisible locator
  lo_options->set_locator_visible( space ).

  " open New BDT Instance for display of selected partner
  CALL METHOD cl_bupa_dialog_joel=>start_with_navigation
    EXPORTING
      iv_request              = lo_request
      iv_options              = lo_options
      iv_in_new_internal_mode = abap_true
    EXCEPTIONS
      already_started         = 1
      not_allowed             = 2
      OTHERS                  = 3.
ENDFORM.

Regards,

Mateusz

4 REPLIES 4

venkateswaran_k
Active Contributor

Hi

You need to pass BPA as parameter id as belwo

data lv_partnerid TYPE BU_PARTNER VALUE '0000000107'.
SET PARAMETER ID 'BPA' FIELD lv_partnerid.
CALL TRANSACTION 'BP' AND SKIP FIRST SCREEN.

Regards,

Venkat

0 Kudos

I have tried to pass BPA as a parameter it works fine.

mateuszadamus
Active Contributor

Hi yoppy.santoso

First, I'd like to ask you to change the subject of your question, to give information about Company Code and not Customer Code. If that's something you cannot do, then please ask moderator for it.

Second, the SET PARAMETER keyword is responsible for setting a value to a global parameter, which name is provided just after the keyword, from the variable that is provided after FIELD option. In the example provided by you, global parameter BUK will have a value from field I_FINAL-BUKRS and parameter T55 will have a value from field I_FINAL-RFHA.

This will work fine for the TM03 transaction, as this transaction has to fields (with mentioned parameters) on the initial screen. But won't work for BP transaction, as the transaction itself is a bit more complicated.

To solve your question you need to make use of the CL_BUPA_DIALOG_JOEL class and its START_WITH_NAVIGATION method. Below is the code on how to do it.

CONSTANTS:
  gc_activity_create  TYPE bu_aktyp VALUE '01',
  gc_activity_change  TYPE bu_aktyp VALUE '02',
  gc_activity_display TYPE bu_aktyp VALUE '03'.

PARAMETERS: p_bp TYPE bu_partner.
PARAMETERS: p_cc TYPE bukrs.

START-OF-SELECTION.
  PERFORM open_bp USING p_bp p_cc gc_activity_change.

FORM open_bp
  USING
    iv_bp TYPE bu_partner
    iv_cc TYPE bukrs
    iv_activity TYPE bu_aktyp.

  DATA:
    ls_role TYPE bus_roles.

  " need to set it as a parameter
  " so that it's read in the Company Code subscreen
  SET PARAMETER ID 'BUK' FIELD iv_cc.

  " create new request
  DATA(lo_request) = NEW cl_bupa_navigation_request( ).
  " open request with selected partner number
  lo_request->set_partner_number( iv_bp ).
  " set the activity you want the user to start the maintenance with
  lo_request->set_bupa_activity( iv_activity ). " 01 - Create, 02 - Change, 03 - Display

  " change the role of the BP to the desired one
  " together with the sub header id
  ls_role-role = 'FS0000'.
  lo_request->set_bupa_partner_role( ls_role ).
  lo_request->set_bupa_sub_header_id( 'FS0001' ).

  " display general data by default
  lo_request->set_maintenance_id( 'B' ). " B - Partner

  " set start-up options
  DATA(lo_options) = NEW cl_bupa_dialog_joel_options( ).
  " start the transaction with an invisible locator
  lo_options->set_locator_visible( space ).

  " open New BDT Instance for display of selected partner
  CALL METHOD cl_bupa_dialog_joel=>start_with_navigation
    EXPORTING
      iv_request              = lo_request
      iv_options              = lo_options
      iv_in_new_internal_mode = abap_true
    EXCEPTIONS
      already_started         = 1
      not_allowed             = 2
      OTHERS                  = 3.
ENDFORM.

Regards,

Mateusz

Thank you very much Mateusz!
I just copy/past your code and it works for me!
To be frank, I do not understand the complete Abap code, but it works!
I couldn't have done this on my own.