Prompt for Customizing Transport Request

At first, call function module (FM) TRINT_ORDER_CHOICE. This function module will open the standard popup to select or create a transportation request. By setting the exporting parameters as shown below the system prompts for a customizing request.

DATA e071     TYPE STANDARD TABLE OF e071.
DATA e071k    TYPE STANDARD TABLE OF e071k.
DATA order    TYPE e071-trkorr.
DATA task     TYPE e071-trkorr.

CALL FUNCTION 'TRINT_ORDER_CHOICE'
  EXPORTING
    wi_order_type          = 'W'
    wi_task_type           = 'Q'
    wi_category            = 'CUST'
  IMPORTING
    we_order               = order
    we_task                = task
  TABLES
    wt_e071                = e071
    wt_e071k               = e071k
  EXCEPTIONS
    no_correction_selected = 1
    display_mode           = 2
    object_append_error    = 3
    recursive_call         = 4
    wrong_order_type       = 5
    OTHERS                 = 6.

Importing parameters we_order and we_task contain the transport request and transport task.

Adding table entries to transport task

In this step, we select the country US from database table T005. Afterward, the entry is added to the customizing transport request.

SELECT SINGLE * FROM t005 INTO @DATA(t005_us) WHERE land1 = 'US'.

INSERT VALUE #(
  pgmid       = 'R3TR'
  object      = 'TABU'
  obj_name    = 'T005'
  objfunc     = 'K'
) INTO TABLE e071.

INSERT VALUE #(
  pgmid      = 'R3TR'
  object     = 'TABU'
  objname    = 'T005'
  mastertype = 'TABU'
  mastername = 'T005'
  tabkey     = |{ sy-mandt }{ t005_us-land1 }|
) INTO TABLE e071k.

The important part here is the table key (tabkey). Depending on your scenario you need to concatenate all key fields of your table including the client.

Once all table entries are added to the internal tables e071 and e071k the objects need to be added to the selected transport task by calling function module TR_APPEND_TO_COMM_OBJS_KEYS.

Complete Example Code

DATA e071     TYPE STANDARD TABLE OF e071.
DATA e071k    TYPE STANDARD TABLE OF e071k.
DATA order    TYPE e071-trkorr.
DATA task     TYPE e071-trkorr.

CALL FUNCTION 'TRINT_ORDER_CHOICE'
  EXPORTING
    wi_order_type          = 'W'
    wi_task_type           = 'Q'
    wi_category            = 'CUST'
  IMPORTING
    we_order               = order
    we_task                = task
  TABLES
    wt_e071                = e071
    wt_e071k               = e071k
  EXCEPTIONS
    no_correction_selected = 1
    display_mode           = 2
    object_append_error    = 3
    recursive_call         = 4
    wrong_order_type       = 5
    OTHERS                 = 6.

CHECK sy-subrc = 0.

SELECT SINGLE * FROM t005 INTO @DATA(t005_us) WHERE land1 = 'US'.

INSERT VALUE #(
  pgmid       = 'R3TR'
  object      = 'TABU'
  obj_name    = 'T005'
  objfunc     = 'K'
) INTO TABLE e071.

INSERT VALUE #(
  pgmid      = 'R3TR'
  object     = 'TABU'
  objname    = 'T005'
  mastertype = 'TABU'
  mastername = 'T005'
  tabkey     = |{ sy-mandt }{ t005_us-land1 }|
) INTO TABLE e071k.

CALL FUNCTION 'TR_APPEND_TO_COMM_OBJS_KEYS'
  EXPORTING
    wi_trkorr                      = task
  TABLES
    wt_e071                        = e071
    wt_e071k                       = e071k
  EXCEPTIONS
    key_char_in_non_char_field     = 1
    key_check_keysyntax_error      = 2
    key_inttab_table               = 3
    key_longer_field_but_no_generc = 4
    key_missing_key_master_fields  = 5
    key_missing_key_tablekey       = 6
    key_non_char_but_no_generic    = 7
    key_no_key_fields              = 8
    key_string_longer_char_key     = 9
    key_table_has_no_fields        = 10
    key_table_not_activ            = 11
    key_unallowed_key_function     = 12
    key_unallowed_key_object       = 13
    key_unallowed_key_objname      = 14
    key_unallowed_key_pgmid        = 15
    key_without_header             = 16
    ob_check_obj_error             = 17
    ob_devclass_no_exist           = 18
    ob_empty_key                   = 19
    ob_generic_objectname          = 20
    ob_ill_delivery_transport      = 21
    ob_ill_lock                    = 22
    ob_ill_parts_transport         = 23
    ob_ill_source_system           = 24
    ob_ill_system_object           = 25
    ob_ill_target                  = 26
    ob_inttab_table                = 27
    ob_local_object                = 28
    ob_locked_by_other             = 29
    ob_modif_only_in_modif_order   = 30
    ob_name_too_long               = 31
    ob_no_append_of_corr_entry     = 32
    ob_no_append_of_c_member       = 33
    ob_no_consolidation_transport  = 34
    ob_no_original                 = 35
    ob_no_shared_repairs           = 36
    ob_no_systemname               = 37
    ob_no_systemtype               = 38
    ob_no_tadir                    = 39
    ob_no_tadir_not_lockable       = 40
    ob_privat_object               = 41
    ob_repair_only_in_repair_order = 42
    ob_reserved_name               = 43
    ob_syntax_error                = 44
    ob_table_has_no_fields         = 45
    ob_table_not_activ             = 46
    tr_enqueue_failed              = 47
    tr_errors_in_error_table       = 48
    tr_ill_korrnum                 = 49
    tr_lockmod_failed              = 50
    tr_lock_enqueue_failed         = 51
    tr_not_owner                   = 52
    tr_no_systemname               = 53
    tr_no_systemtype               = 54
    tr_order_not_exist             = 55
    tr_order_released              = 56
    tr_order_update_error          = 57
    tr_wrong_order_type            = 58
    ob_invalid_target_system       = 59
    tr_no_authorization            = 60
    ob_wrong_tabletyp              = 61
    ob_wrong_category              = 62
    ob_system_error                = 63
    ob_unlocal_objekt_in_local_ord = 64
    tr_wrong_client                = 65
    ob_wrong_client                = 66
    key_wrong_client               = 67
    OTHERS                         = 68.
IF sy-subrc = 0.
  " table entries added successfully
ENDIF.