method LOAD_BTD DATA lo_nd_btd TYPE REF TO if_wd_context_node DATA lt_

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
method LOAD_BTD .
DATA lo_nd_btd TYPE REF TO if_wd_context_node.
DATA lt_btd TYPE wd_this->Elements_btd.
DATA ls_btd TYPE wd_this->Element_btd.
data ls_ctx TYPE /AIN/DM_DOC_CTX.
data ls_ctx2 TYPE /AIN/DM_DOC_CTX.
data lt_ctx TYPE TABLE OF /AIN/DM_DOC_CTX.
data LT_BTD_HEADER TYPE /AIN/PUB_BTD_HEADER_TAB.
data LS_BTD_HEADER like LINE OF LT_BTD_HEADER.
data lv_str TYPE string.
data ls_input TYPE wd_this->ELEMENT_INPUT.
data: ls_btd_intid TYPE /AIN/PUB_BTD_INTID_STR,
lt_btd_intid TYPE /AIN/PUB_BTD_INTID_tab,
lt_btd_othattr TYPE /AIN/PUB_BTD_OTHATTR_CRE_TAB,
ls_btd_othattr TYPE /AIN/PUB_BTD_OTHATTR_CRE_STR,
lt_btd_obj_act type /AIN/PUB_BTD_OBJ_ACT_TAB,
ls_btd_obj_act type /AIN/PUB_BTD_OBJ_ACT_STR.
data: lt_return type BAPIRETTAB.
lo_nd_btd = wd_context->get_child_node( name = wd_this->WDCTX_INPUT ).
LO_ND_BTD->GET_STATIC_ATTRIBUTES( IMPORTING STATIC_ATTRIBUTES = LS_INPUT ).
lo_nd_btd = wd_context->get_child_node( name = wd_this->wdctx_btd ).
select * INTO CORRESPONDING FIELDS OF TABLE LT_CTX from /AIN/DM_DOC_CTX where field_name in ('ZMS').
IF sy-subrc = 0.
LOOP AT LT_CTX INTO LS_CTX.
* select SINGLE * INTO LS_CTX2 from /AIN/DM_DOC_CTX where field_name = 'ZMBLNR' and doc_guid = LS_CTX-DOC_GUID.
* IF sy-subrc <> 0.
LS_BTD_INTID-BTD_INTID = LS_CTX-DOC_GUID.
APPEND LS_BTD_INTID to LT_BTD_INTID.
* ENDIF.
ENDLOOP.
lv_str = text-DRK.
IF lines( LT_BTD_INTID ) > 0.
CALL FUNCTION '/AIN/PUB_BO_BUFFER_REFRESH'.
CALL FUNCTION '/AIN/PUB_BTD_BY_INTIDS'
TABLES
IT_BTD_INTID = LT_BTD_INTID
ET_BTD_HEADER = lt_btd_header
* ET_BTD_ITM = ET_BTD_ITM
* ET_BTD_ITM_ACT = lt_btd_obj_act
* ET_BTD_ITM_EXP = ET_BTD_ITM_EXP
ET_BTD_OBJ_ACT = lt_btd_obj_act
* ET_BTD_OBIT_ACT =
* ET_BTD_OBJ_EXP = lt_btd_obj_exp
* ET_BTD_OBIT_EXP =
ET_BTD_OTHATTR = LT_BTD_OTHATTR
* ET_BTD_STATUS =
ET_RETURN = lt_return
* ET_BTD_ITM_OTHATTR =
* IT_BTD_INTID_ACTP =
* ET_BTD_OBIT_ACT_AGGR =
* ET_BTD_OBJ_ACT_AGGR =
* ET_QCHAR_COMB =
* IT_POBJ_INTID =
* ET_BTD_HEADER_TZONE =
EXCEPTIONS
TECHNICAL_LEVEL_ERROR = 1
BUSINESS_LEVEL_ERROR_INPUT = 2
OTHERS = 3.
IF sy-subrc = 0.
LOOP AT LT_CTX INTO LS_CTX.
clear LS_BTD-AMOUNT.
IF LS_CTX-FIELD_NAME = 'ZMS' and LS_CTX-FIELD_VALUE is NOT INITIAL.
LOOP AT LT_BTD_OBJ_ACT INTO LS_BTD_OBJ_ACT where BTD_INTID = LS_CTX-DOC_GUID.
add 1 to LS_BTD-AMOUNT.
ENDLOOP.
READ TABLE LT_BTD_HEADER INTO LS_BTD_HEADER WITH KEY BTD_INTID = LS_CTX-DOC_GUID.
IF sy-subrc = 0.
LS_BTD-DOC_EXTID = LS_BTD_HEADER-BTD_EXTID.
ENDIF.
* READ TABLE LT_CTX INTO LS_CTX2 with key DOC_GUID = LS_CTX-DOC_GUID FIELD_NAME = 'PLANT'.
* IF sy-subrc = 0.
* LS_BTD-PLANT = LS_CTX2-FIELD_VALUE.
* ENDIF.
LS_BTD-TIME = LS_CTX-CREATE_TIME.
LS_BTD-USER = LS_CTX-CREATE_UNAME.
LS_BTD-ZMS = LS_CTX-FIELD_VALUE.
LS_BTD-DOC_GUID = LS_CTX-DOC_GUID.
* IF LS_BTD-PLANT = LS_INPUT-WERKS.
APPEND LS_BTD to LT_BTD.
* ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
sort LT_BTD BY TIME DESCENDING.
lo_nd_btd->bind_table( new_items = lt_btd set_initial_elements = abap_true ).
endmethod.