Openning transaction in a new window/session

Problem: You want to open a transaction in a new window/session. This should be done from a customer program or function.

Solution: To achieve this goal you need to use a standard SAP FM called ABAP4_CALL_TRANSACTION. FM call is presented below.

  TYPE-POOLS:
    abap.
 
  DATA: lt_params TYPE TABLE OF rfc_spagpa,
        lt_using TYPE hrtb_bdcdata.
 
  CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
    STARTING NEW TASK 'PROGRAM'
    EXPORTING
      tcode                   = 'SE38'
      skip_screen             = abap_true
      mode_val                = 'A'
      update_val              = 'A'
    TABLES
      using_tab               = lt_using
      spagpa_tab              = lt_params
    EXCEPTIONS
      call_transaction_denied = 1
      tcode_invalid           = 2
      OTHERS                  = 3.
  TYPE-POOLS:
    abap.

  DATA: lt_params TYPE TABLE OF rfc_spagpa,
        lt_using TYPE hrtb_bdcdata.

  CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
    STARTING NEW TASK 'PROGRAM'
    EXPORTING
      tcode                   = 'SE38'
      skip_screen             = abap_true
      mode_val                = 'A'
      update_val              = 'A'
    TABLES
      using_tab               = lt_using
      spagpa_tab              = lt_params
    EXCEPTIONS
      call_transaction_denied = 1
      tcode_invalid           = 2
      OTHERS                  = 3.

MODE_VAL and UPDATE_VAL can contain any of the values of MODE and UPDATE parameters of the CALL TRANSACTION keyword syntax.

LT_USING can contain any Batch Input call. This way any transaction parameters can be filled in automatically during the transaction call.

LT_PARAMS can be empty.

Komentowanie jest zakończone.