以编程方式将表行添加到 TR? [英] Add table rows to a TR programmatically?

查看:36
本文介绍了以编程方式将表行添加到 TR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在以编程方式向传输请求添加表行时遇到问题.

I have a problem with adding rows of table to the transport request in programming way.

当我写下传输请求编号时,出现错误:

When i wrote down the transport request number i get the error:

您不能使用请求 EAMK913244

You cannot use request EAMK913244

我使用的代码是

  data lt_variable_changed type table of ztable_task2.
  data: l_request   type trkorr,
        lt_e071     type tr_objects,
        lt_e071k    type tr_keys,
        lv_tabkey   type trobj_name,
        ls_e071     type e071,
        ls_e071k    type e071k.

      ls_e071-pgmid    = 'R3TR'.
      ls_e071-object   = 'TABU'.                            "for table
      ls_e071-obj_name = 'ZTABLE_TASK2'.
      ls_e071-objfunc  = 'K'.
      append ls_e071 to lt_e071.

      loop at lt_variable_changed into ls_variable.
        lv_tabkey = ls_variable-num.
        ls_e071k-pgmid      = 'R3TR'.
        ls_e071k-object     = 'TABU'.
        ls_e071k-objname    = 'ZTABLE_TASK2'.
        ls_e071k-mastertype = 'TABU'.
        ls_e071k-mastername = 'ZTABLE_TASK2'.
        ls_e071k-tabkey     = lv_tabkey.
        append ls_e071k to lt_e071k.
      endloop.

      call function 'TR_REQUEST_CHOICE'
        exporting
          iv_suppress_dialog   = 'X'
          iv_request           = var_query
          it_e071              = lt_e071
          it_e071k             = lt_e071k.
      message 'Ok' type 'I'.

来自 se01 的屏幕:

Screen from se01:

感谢您的帮助,祝您好运!

Thanks for help and good luck!

推荐答案

应使用三个功能模块来传输更改

three function modules shall be used to transport changes

call function 'TR_ORDER_CHOICE_CORRECTION'
  exporting
    iv_category            = 'CUST'
  importing
    ev_order               = ev_request
    ev_task                = ev_task
  exceptions
    invalid_category       = 1
    no_correction_selected = 2
    others                 = 3.

  call function 'TR_OBJECTS_CHECK'
    exporting
      iv_no_show_option       = abap_true
    tables
      wt_ko200                = lt_ko200_customizing
      wt_e071k                = lt_e071k_customizing
    exceptions
      cancel_edit_other_error = 1
      show_only_other_error   = 2
      others                  = 3.

  call function 'TR_OBJECTS_INSERT'
    exporting
      wi_order                = lv_request
      iv_no_show_option       = abap_true
    tables
      wt_ko200                = lt_ko200_customizing
      wt_e071k                = lt_e071k_customizing
    exceptions
      cancel_edit_other_error = 1
      show_only_other_error   = 2
      others                  = 3.

这篇关于以编程方式将表行添加到 TR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆