Но сделать надо это по некому признаку, в данном случае по дате.
Да, можно было через TVARV, но как то хотелось реализовать по другому.
В общем, идея простая...
Запускается DTP, находит последний загруженный пакет в B, смещает дату и аглы.
DATA: l_date type d. "get target DATA(l_target) = i_r_request->get_tgt( ). "type of target "DATA(l_target_type) = i_r_request->get_tgttp( ). "ref to target DATA(lo_request_list) = cl_rsdso_data_request_list=>create( i_adsonm = l_target(30) ). "refresh list lo_request_list->refresh( ). "get list of all requests in XREF format DATA(lt_request_xref) = lo_request_list->get_t_request_xref( ). IF lt_request_xref IS NOT INITIAL. "get last request SORT lt_request_xref BY SRC_POS DESCENDING. ASSIGN lt_request_xref[ 1 ]-SRC_TSN TO FIELD-SYMBOL(<SRC_TSN>). TRY. "ref to request object (DTP) DATA(lo_request) = cl_rsbk_request=>create_from_db( i_process_tsn = <SRC_TSN> i_request_tsn = <SRC_TSN> ). "get filters in table view DATA(lt_filter) = lo_request->get_th_range( ). CATCH cx_rs_not_found. p_subrc = 1. EXIT. ENDTRY. "get value for i_fieldnm READ TABLE lt_filter WITH KEY FIELDNM = i_fieldnm ASSIGNING FIELD-SYMBOL(<ls_filter>). IF sy-subrc = 0. "increment date l_date = <ls_filter>-LOW. l_date = l_date + 1. "set restriction in DTP READ TABLE l_t_range WITH KEY fieldname = i_fieldnm. IF sy-subrc = 0. l_t_range-low = l_date. modify l_t_range index sy-tabix. ELSE. l_t_range-FIELDNAME = i_fieldnm. l_t_range-SIGN = 'I'. l_t_range-OPTION = 'EQ'. l_t_range-LOW = l_date. append l_t_range. ENDIF. ENDIF. ENDIF. p_subrc = 0.
DATA: l_date type d. DATA: l_fiscper type /BI0/OIFISCPER. DATA: ls_tlogo TYPE rstran_s_tlogo. "fill TLOGO structure ls_tlogo-tlogo = i_r_request->get_tgttp( ). ls_tlogo-objnm = i_r_request->get_tgt( ). "ref to target DATA(lo_request_list) = cl_rsdso_data_request_list=>create( i_s_tlogo = ls_tlogo ). "refresh list lo_request_list->refresh( ). "get list of all requests in XREF format DATA(lt_request_xref) = lo_request_list->get_t_request_xref( ). IF lt_request_xref IS NOT INITIAL. "get last request SORT lt_request_xref BY SRC_POS DESCENDING. ASSIGN lt_request_xref[ 1 ]-SRC_TSN TO FIELD-SYMBOL(<SRC_TSN>). TRY. "ref to request object (DTP) DATA(lo_request) = cl_rsbk_request=>create_from_db( i_process_tsn = <SRC_TSN> i_request_tsn = <SRC_TSN> ). "get filters in table view DATA(lt_filter) = lo_request->get_th_range( ). CATCH cx_rs_not_found. p_subrc = 1. EXIT. ENDTRY. "get value for i_fieldnm READ TABLE lt_filter WITH KEY FIELDNM = i_fieldnm ASSIGNING FIELD-SYMBOL(<ls_filter>). IF sy-subrc = 0. "increment date l_fiscper = <ls_filter>-LOW. l_date = |{ l_fiscper(4) }{ l_fiscper+5(2) }01|. l_date = l_date + 33. l_fiscper = |{ l_date(4) }0{ l_date+4(2) }|. "set restriction in DTP READ TABLE l_t_range WITH KEY fieldname = i_fieldnm. IF sy-subrc = 0. l_t_range-low = l_fiscper. l_t_range-sign = 'I'. l_t_range-option = 'EQ'. modify l_t_range index sy-tabix. ELSE. l_t_range-FIELDNAME = i_fieldnm. l_t_range-SIGN = 'I'. l_t_range-OPTION = 'EQ'. l_t_range-LOW = l_fiscper. append l_t_range. ENDIF. ENDIF. ENDIF. p_subrc = 0.