*&---------------------------------------------------------------------*
*& Report SAPRCKR1 *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT SAPBAPITESTDELETING1 NO STANDARD PAGE HEADING.
ENHANCEMENT-POINT SAPBAPITESTDELETING1_G4 SPOTS ES_SAPBAPITESTDELETING1 STATIC.
*$*$-Start: SAPBAPITESTDELETING1_G4-------------------------------------------------------------$*$*
ENHANCEMENT 1 MGV_GENERATED_SAPBAPITESTDE000. "active version
INITIALIZATION.
DATA: mgv_matnr_prog LIKE rsvar-report,
mgv_matnr_selopt_tab like rsldbdfs occurs 0 with header line.
FIELD-SYMBOLS <mgv_matnr_selopt_conv> TYPE STANDARD TABLE.
ENDENHANCEMENT.
*$*$-End: SAPBAPITESTDELETING1_G4-------------------------------------------------------------$*$*
ENHANCEMENT-POINT SAPBAPITESTDELETING1_G5 SPOTS ES_SAPBAPITESTDELETING1.
*$*$-Start: SAPBAPITESTDELETING1_G5-------------------------------------------------------------$*$*
ENHANCEMENT 2 MGV_GENERATED_SAPBAPITESTDE000. "active version
mgv_matnr_prog = sy-repid.
mgv_matnr_selopt_tab-name = 'P_MATNR' .
append mgv_matnr_selopt_tab.
call function 'MGV_SELOP_AFTER_INITIALIZATION'
EXPORTING
PROGRAM = mgv_matnr_prog
TABLES
SELOP = mgv_matnr_selopt_tab
EXCEPTIONS
NO_PROGRAMNAME = 1
OTHERS = 2
.
ENDENHANCEMENT.
*$*$-End: SAPBAPITESTDELETING1_G5-------------------------------------------------------------$*$*
ENHANCEMENT-POINT SAPBAPITESTDELETING1_G6 SPOTS ES_SAPBAPITESTDELETING1 STATIC.
*$*$-Start: SAPBAPITESTDELETING1_G6-------------------------------------------------------------$*$*
ENHANCEMENT 3 MGV_GENERATED_SAPBAPITESTDE000. "active version
START-OF-SELECTION.
ENDENHANCEMENT.
*$*$-End: SAPBAPITESTDELETING1_G6-------------------------------------------------------------$*$*
ENHANCEMENT-POINT SAPBAPITESTDELETING1_G7 SPOTS ES_SAPBAPITESTDELETING1.
*$*$-Start: SAPBAPITESTDELETING1_G7-------------------------------------------------------------$*$*
ENHANCEMENT 4 MGV_GENERATED_SAPBAPITESTDE000. "active version
LOOP AT mgv_matnr_selopt_tab.
CONCATENATE mgv_matnr_selopt_tab-name'[]' INTO
mgv_matnr_selopt_tab-name.
ASSIGN (mgv_matnr_selopt_tab-name) TO <mgv_matnr_selopt_conv>.
IF sy-subrc IS INITIAL.
CALL FUNCTION 'MGV_SELOP_AFTER_START_OF_SEL'
EXPORTING
SELOPT_NAME = mgv_matnr_selopt_tab-name
TABLES
RANGE = <mgv_matnr_selopt_conv>.
ENDIF.
ENDLOOP.
ENDENHANCEMENT.
*$*$-End: SAPBAPITESTDELETING1_G7-------------------------------------------------------------$*$*
DATA: TAB TYPE STANDARD TABLE OF RSMPE-FUNC WITH HEADER LINE,
T_COST_ESTIMATE_LIST TYPE STANDARD TABLE OF BAPICOLIST WITH HEADER LINE,
F_RETURN TYPE BAPIRETURN,
F_RETURN2 TYPE BAPIRET2.
* Formroutinen für die Fehlersteuerung...
INCLUDE BAPITESTDELETING1F01.
*INCLUDE BAPITESTDELETINGF01.
*INCLUDE RCK23F01.
TYPE-POOLS: COST.
TABLES: KEKO, CKKALKDATU, T001K.
* Drucktaste 'Protokoll'...
SELECTION-SCREEN FUNCTION KEY 1.
SELECTION-SCREEN BEGIN OF BLOCK REORG WITH FRAME TITLE TEXT-001.
* Eingrenzung: zu reorganisierende Kalkulationen
* Eingabe: Buchungskreis / Werk
SELECT-OPTIONS P_BUKRS FOR T001K-BUKRS.
* Eingrenzung: zu reorganisierende Werke. Es wird später die Schnitt-
* menge zwischen diesen Werken (Intervalle) und den in P_BUKRS vor-
* handenen Werken gebildet...
SELECT-OPTIONS P_WERKS FOR KEKO-WERKS.
* Eingrenzung: Materialien (zu reorganisierende Kalkulationen)
SELECT-OPTIONS P_MATNR FOR KEKO-MATNR MATCHCODE OBJECT MAT1.
SELECT-OPTIONS P_BWTAR FOR KEKO-BWTAR.
* Eingrenzung: Dispositionsstufen
SELECT-OPTIONS P_FEH_ST FOR KEKO-FEH_STA.
* Eingrenzung: Kalkulationsvarianten, Kalkulationsversionen
SELECT-OPTIONS P_KLVAR FOR KEKO-KLVAR.
SELECT-OPTIONS P_TVERS FOR KEKO-TVERS.
* Eingrenzung: Korridor für das Gültigkeit_ab-Datum der Kalkulationen
SELECT-OPTIONS P_KADAT FOR CKKALKDATU-ABDAT.
* DEFAULT '19000101' TO '19000101'.
* Eingrenzung: Korridor für das Gültigkeit_bis-Datum der Kalkulationen
* SELECT-OPTIONS P_BIDAT FOR CKKALKDATU-BIDAT.
* DEFAULT '19000101' TO '19000101'.
* Leerzeile...
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS KALAID FOR KEKO-KALAID MEMORY ID KKF.
SELECT-OPTIONS KALADAT FOR KEKO-KALADAT MEMORY ID KK1.
SELECTION-SCREEN SKIP 1.
* Auswahl: Maschinelle Kalkulationen
* Manuelle Kalkulationen
* Maschinelle und Manuelle Kalkulationen
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS MASCHIN DEFAULT 'X' LIKE CKSTEUERUN-MASCHIN.
SELECTION-SCREEN COMMENT 3(25) TEXT-012 FOR FIELD MASCHIN.
SELECTION-SCREEN POSITION 54.
PARAMETERS MIMEGER DEFAULT 'X' LIKE CKSTEUERUN-MIMEGER.
SELECTION-SCREEN COMMENT 56(20) TEXT-013 FOR FIELD MIMEGER.
SELECTION-SCREEN END OF LINE.
* Auswahl: Kalkulationen mit Mengengerüst
* Kalkulationen ohne Mengengerüst
* Kalkulationen mit und ohne Mengergerüst
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS MANUELL DEFAULT 'X' LIKE CKSTEUERUN-MANUELL.
SELECTION-SCREEN COMMENT 3(25) TEXT-015 FOR FIELD MANUELL.
SELECTION-SCREEN POSITION 54.
PARAMETERS OHMEGER DEFAULT 'X' LIKE CKSTEUERUN-OHMEGER.
SELECTION-SCREEN COMMENT 56(20) TEXT-014 FOR FIELD OHMEGER.
SELECTION-SCREEN END OF LINE.
* Leerzeile...
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK STEU WITH FRAME TITLE TEXT-016.
* Auswahl: Kalkulationen ohne Materialstammbezug
* zukuenftige Plankalkulationen
* laufende Plankalkulationen
* vergangene Plankalkulationen
PARAMETERS: KAOHREF RADIOBUTTON GROUP CK03 DEFAULT 'X'
LIKE CKSTEUERUN-KAOHREF,
ZUKA RADIOBUTTON GROUP CK03 LIKE CKSTEUERUN-ZUKA,
LAKA RADIOBUTTON GROUP CK03 LIKE CKSTEUERUN-LAKA,
VEKA RADIOBUTTON GROUP CK03 LIKE CKSTEUERUN-VEKA.
SELECTION-SCREEN END OF BLOCK STEU.
SELECTION-SCREEN END OF BLOCK REORG.
SELECTION-SCREEN BEGIN OF BLOCK MODUS WITH FRAME TITLE TEXT-005.
* Ablaufsteuerung...
PARAMETERS: TEST AS CHECKBOX LIKE CKSTEUERUN-TEST DEFAULT 'X',
P_LISTAU DEFAULT 'X' LIKE CKSTEUERUN-PROTOCOL.
SELECTION-SCREEN END OF BLOCK MODUS.
* Initialisierung des Selektionsbildes und AT SELECTION-SCREEN...
INITIALIZATION.
* Beachte: Obere Grenze der Datums-Defaultwerte werden überschrieben
* Vorschlagswert: Kalkulationsdatum ab: 3 Jahre zurück...
P_KADAT-HIGH = SY-DATLO - 3 * 365.
MODIFY P_KADAT INDEX 1.
START-OF-SELECTION.
DATA: OUTPUTLIST TYPE STANDARD TABLE OF BAPIDELETEMULTI WITH HEADER LINE,
T_RETURN TYPE STANDARD TABLE OF BAPIRET2 WITH HEADER LINE,
F_COSTINGCATEGORY1 TYPE BAPICOSTINGCATEGORY1,
F_COSTINGCATEGORY2 TYPE BAPICOSTINGCATEGORY2.
F_COSTINGCATEGORY1-COSTESTIMATE = MASCHIN.
F_COSTINGCATEGORY1-ADDITIVE_COSTESTIMATE = MANUELL.
F_COSTINGCATEGORY1-WITH_QTY_STRUCTURE = MIMEGER.
F_COSTINGCATEGORY1-WITHOUT_QTY_STRUCTURE = OHMEGER.
F_COSTINGCATEGORY2-WITHOUTREFERENCE = KAOHREF.
F_COSTINGCATEGORY2-FUTURE_COSTESTIM = ZUKA.
F_COSTINGCATEGORY2-CURRENT_COSTESTIM = LAKA.
F_COSTINGCATEGORY2-PREV_COSTESTIM = VEKA.
* checkman problems ...
DATA: F_MATNR TYPE BAPIMATERIAL,
T_MATNR TYPE TABLE OF BAPIMATERIAL.
LOOP AT P_MATNR.
CLEAR F_MATNR.
MOVE-CORRESPONDING P_MATNR TO F_MATNR.
APPEND F_MATNR TO T_MATNR.
ENDLOOP.
CALL FUNCTION 'BAPI_COSTESTIMATE_DELETE_MULTI'
EXPORTING
TESTRUN = TEST
COSTINGCATEGORY1 = F_COSTINGCATEGORY1
COSTINGCATEGORY2 = F_COSTINGCATEGORY2
TABLES
RETURN = T_RETURN
OUT_LIST = OUTPUTLIST
IN_MATERIAL = T_MATNR
IN_VALUATIONTYPE = P_BWTAR
IN_PLANT = P_WERKS
IN_COMP_CODE = P_BUKRS
IN_VALID_FROM = P_KADAT
IN_COSTINGVARIANT = P_KLVAR
IN_COSTING_STATUS = P_FEH_ST
IN_COSTING_VERSION = P_TVERS
IN_COSTINGRUN = KALAID
IN_COSTINGRUNDATE = KALADAT.
IF TEST EQ 'X'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
* IMPORTING
* RETURN =
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
* IMPORTING
* RETURN =
.
ENDIF.
.
CKR1 标准sample se38 输入程序名:SAPBAPITESTDELETING1
最新推荐文章于 2023-02-28 17:07:50 发布