Code: Alles auswählen.
DATA: LIF_REC TYPE REF TO IF_PT_TD_CONTROL,
LO_CTLOBJECT TYPE REF TO IF_PT_TD_CONTROL,
LIF_P2001 TYPE REF TO IF_PT_TD_IT2001,
LIF_P2001_CLONE TYPE REF TO IF_PT_TD_IT2001,
LIF_P2002 TYPE REF TO IF_PT_TD_IT2002,
LS_PA2001 TYPE PA2001,
LT_PA2001 TYPE TABLE OF PA2001,
LS_TMP_P2001 TYPE P2001. "Ex DATA(LS_TMP_P2001) =
LOOP AT I_TIME_DATA INTO LIF_REC.
IF LIF_REC->DATA->CATEGORY = CL_PT_TMW_TDM_CONST=>CAT_INFTY.
CASE LIF_REC->DATA->TYPE.
WHEN '2001'.
LIF_P2001 ?= LIF_REC->DATA.
* bei Krankheit/Unfall -> Sperrkennzeichen setzen oder löschen
IF LIF_P2001->P2001-SUBTY = '0300'.
* beim Ändern des Krankheits/Unfallsatzes werden die gesperrten Sätze nicht mehr eingelesen; Satz clonen und an E_TIME_DATA anhängen??
* DB-Select für gesperrte Sätze
SELECT * FROM PA2001
INTO TABLE LT_PA2001
WHERE PERNR EQ LIF_P2001->P2001-PERNR AND
BEGDA GT LIF_P2001->P2001-ENDDA AND
SPRPS EQ ABAP_TRUE.
LOOP AT LT_PA2001 INTO LS_PA2001.
LO_CTLOBJECT = LIF_REC.
CALL METHOD LO_CTLOBJECT->CLONE
EXPORTING
I_ORIGIN = LIF_REC
* I_PRIVCONT =
RECEIVING
R_CTLOBJECT = LO_CTLOBJECT.
* DATA-P2001 Einträge ändern
LIF_P2001_CLONE ?= LO_CTLOBJECT->DATA.
LS_TMP_P2001 = LIF_P2001_CLONE->P2001.
MOVE-CORRESPONDING LS_PA2001 TO LS_TMP_P2001.
LS_TMP_P2001-SPRPS = ABAP_FALSE.
LIF_P2001_CLONE->SET_DATA(
EXPORTING
I_P2001 = LS_TMP_P2001
EXCEPTIONS
READ_ONLY = 1 " Das Objekt darf nicht geändert werden
INCONSISTENT_STATE = 2 " Das Datenobjekt ist in einem inkonsistenten Zustand
OTHERS = 3
).
IF SY-SUBRC <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Exporttabelle füllen
APPEND LO_CTLOBJECT TO E_TIME_DATA.
ENDLOOP.
ENDCASE.
ENDLOOP.