```
TABLES: EKKO.
DATA: GV_ERROR(1).
SELECT-OPTIONS: S_DATE FOR EKKO-AEDAT.
*-----------------------------------------------------------------------
START-OF-SELECTION.
*-----------------------------------------------------------------------
* CHECK SY-BATCH EQ ABAP_TRUE.
PERFORM UPDATE_TABLE USING : 'EKBE' 'BUDAT' 'ZMMT_EKBE',
'EBAN' 'ERDAT' 'ZMMT_EBAN',
'EKKO' 'AEDAT' 'ZMMT_EKKO',
'EKPO' 'AEDAT' 'ZMMT_EKPO',
'MKPF' 'AEDAT' 'ZMMT_MKPF',
'MSEG' '/BEV2/ED_AEDAT' 'ZMMT_MSEG'.
*&---------------------------------------------------------------------*
* UPDATE_TABLE
*&---------------------------------------------------------------------*
FORM UPDATE_TABLE USING VALUE(PV_STAB) type tabname
VALUE(PV_FIELD)
VALUE(PV_CTAB).
DATA: o_ref TYPE REF TO data.
FIELD-SYMBOLS: <lt_table> TYPE STANDARD TABLE.
CHECK GV_ERROR IS INITIAL.
CREATE DATA o_ref TYPE TABLE OF (PV_STAB).
ASSIGN o_ref->* TO <lt_table>.
data(lv_clause) = conv string( PV_FIELD && ' IN S_DATE' ).
SELECT * FROM (PV_STAB)
INTO TABLE <lt_table>
WHERE (lv_clause).
IF SY-SUBRC EQ 0.
MODIFY (PV_CTAB) FROM TABLE <lt_table>.
IF SY-SUBRC NE 0.
GV_ERROR = ABAP_TRUE.
MESSAGE S000 WITH 'ERROR!' DISPLAY LIKE 'E'.
ENDIF.
ENDIF.
ENDFORM.
```
'ABAP' 카테고리의 다른 글
[ABAP] 문자열 자릿수만큼 split (0) | 2024.11.27 |
---|---|
[ABAP] 자주 까먹는 구문 (0) | 2024.11.27 |
[Field symbol] 가로데이터->세로로 (0) | 2023.03.10 |
[New syntax] 정리 (0) | 2023.03.02 |
[New Syntax] COLLECT (0) | 2023.03.02 |
댓글