在以编程方式将表的行添加到传输请求时遇到问题。
当我写下运输请求编号时,出现错误:
您不能使用请求EAMK913244
我用于运输日期的代码是:
form add_data_to_transaction .
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_position type ddposition,
lv_tabkey type trobj_name,
ls_e071 type e071,
ls_e071k type e071k.
"before adding to transort request check for transport query
if var_query is not initial.
call method grid->get_selected_rows " get index of row
importing
et_index_rows = lt_rows.
"rows that i need to add to the table
if lt_rows is not initial.
loop at lt_rows into ls_row.
read table lt_variable index ls_row into ls_variable.
append ls_variable to lt_variable_changed.
endloop.
else.
message 'Select 1 or more rows' type 'I'.
endif.
if lt_rows is not initial.
""e071 contains only one row per table. the objfunc is 'K' if we need to transport //specific entries as specified in the e071k structure.
"ls_e071-trkorr = var_query.
"ls_e071-as4pos = 1.
ls_e071-pgmid = 'R3TR'.
ls_e071-object = 'TABU'. "for table
ls_e071-obj_name = 'ZTABLE_TASK2'.
ls_e071-objfunc = 'K'.
ls_e071-lang = sy-langu.
append ls_e071 to lt_e071.
clear ls_e071.
clear lv_position.
"add all table entries in table zxa_header that need to be transported to lt_e071k
loop at lt_variable_changed into ls_variable.
lv_position = lv_position + 1.
lv_tabkey = ls_variable-num.
"ls_e071k-trkorr = var_query.
ls_e071k-pgmid = 'R3TR'.
ls_e071k-object = 'TABU'.
ls_e071k-objname = 'ZTABLE_TASK2'.
"ls_e071k-as4pos = lv_position.
ls_e071k-mastertype = 'TABU'.
ls_e071k-mastername = 'ZTABLE_TASK2'.
ls_e071k-lang = sy-langu.
ls_e071k-tabkey = lv_tabkey.
append ls_e071k to lt_e071k.
clear ls_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'.
endif.
else.
message 'Fill in tranport request number' type 'I'.
endif.
endform.
se01的屏幕:
感谢您的帮助和好运!
答案 0 :(得分:1)
应使用三个功能模块来传输更改
CharSequence string = (DateUtils.getRelativeDateTimeString(getActivity(), System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS,
DateUtils.DAY_IN_MILLIS, DateUtils.FORMAT_ABBREV_RELATIVE)).subSequence(string.length() - 5, string.length());
答案 1 :(得分:0)
您还可以使用面向对象的方法来传输表。
这部分创建一个定制请求,并将表的内容放入其中:
DATA(instance) = cl_adt_cts_management=>create_instance( ).
TRY.
instance->insert_objects_in_wb_request( EXPORTING pgmid = 'R3TR'
object = 'TABU'
obj_name = CONV trobj_name( 'Z_TABLE' )
CHANGING trkorr = l_trkorr ).
CATCH cx_adt_cts_insert_error.
RETURN.
ENDTRY.
这部分使用ADT CTS类,并且非常灵活。尽管名称为wb_request
,但该方法是自适应的,将根据传递的对象创建工作台或自定义请求。