DATA: BEGIN OF TINFO OCCURS 0,
INFOTYPE(4) TYPE C,
RECORD(6) TYPE N,
END OF TINFO.
DATA: RISP(1) TYPE N,
TESTO(80),
CONT(6) TYPE N.
DATA : BEGIN OF TDOC_OCC OCCURS 0,
NUMERO(6) TYPE N,
INFO(6),
PERNR LIKE PA0000-PERNR,
BEGDA LIKE PA0000-BEGDA,
ENDDA LIKE PA0000-ENDDA,
UNAME LIKE PA0000-UNAME,
SUBTY LIKE PA0000-SUBTY,
END OF TDOC_OCC.
DATA: BEGIN OF TDOC_APPO OCCURS 0,
FILL(03).
INCLUDE STRUCTURE PAKEY.
INCLUDE STRUCTURE PSHD1.
DATA: FILL2(1000).
DATA: END OF TDOC_APPO.
DATA: NRO_IT(4) TYPE N.
DATA NOME_PA(6).
DATA : TESTATA LIKE HRFIELDNAM OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN: BEGIN OF BLOCK AA WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN: SKIP.
SELECT-OPTIONS: INFO FOR T582A-INFTY OBLIGATORY.
select-options: subty for pa0008-subty.
SELECT-OPTIONS: CID FOR PA0004-PERNR OBLIGATORY.
select-options: TIPODIP for P0001-PERSK. " OBLIGATORY.
*SELECT-OPTIONS: DATA FOR SY-DATUM. " default sy-datum.
*SELECT-OPTIONS: UTENTE FOR SY-UNAME. " default sy-uname.
SELECTION-SCREEN: END OF BLOCK AA.
************************************************************************
SELECTION-SCREEN: ULINE.
************************************************************************
SELECTION-SCREEN: BEGIN OF BLOCK AB WITH FRAME TITLE TEXT-002.
SELECTION-SCREEN: SKIP.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(15) TEXT-003 FOR FIELD P_TEST.
SELECTION-SCREEN POSITION 20.
PARAMETERS: P_TEST RADIOBUTTON GROUP 01.
SELECTION-SCREEN COMMENT 35(15) TEXT-004 FOR FIELD P_UPDT.
SELECTION-SCREEN POSITION 55.
PARAMETERS: P_UPDT RADIOBUTTON GROUP 01.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK AB.
************************************************************************
*flow
INITIALIZATION.
START-OF-SELECTION.
if p_updt eq 'X'.
PERFORM POPUP_UPDATE.
endif.
perform update_infotype.
END-OF-SELECTION.
*routines
*&---------------------------------------------------------------------*
*& Form cancella_infotype
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM update_infotype.
FIELD-SYMBOLS <table> TYPE table.
nro_it = info-low.
WHILE nro_it IN info.
CONCATENATE 'PA' nro_it INTO nome_pa.
SELECT * FROM (nome_pa) INTO tdoc_appo
WHERE pernr IN cid AND
subty IN subty.
SELECT SINGLE * FROM pa0001 INTO pa0001
WHERE pernr EQ tdoc_appo-pernr
AND begda LE tdoc_appo-endda
AND endda GE tdoc_appo-endda.
IF sy-subrc <> 0.
IF nro_it = '0156'.
SELECT * FROM pa0001 INTO pa0001
WHERE pernr EQ tdoc_appo-pernr
ORDER BY begda ASCENDING.
EXIT.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE e000(db) WITH tdoc_appo-pernr.
ENDIF.
ELSE.
MESSAGE e000(db) WITH tdoc_appo-pernr.
ENDIF.
ENDIF.
CHECK pa0001-persk IN tipodip.
CONCATENATE 'IT' nro_it INTO tdoc_occ-info.
MOVE tdoc_appo-pernr TO tdoc_occ-pernr.
MOVE tdoc_appo-begda TO tdoc_occ-begda.
MOVE tdoc_appo-endda TO tdoc_occ-endda.
MOVE tdoc_appo-uname TO tdoc_occ-uname.
MOVE tdoc_appo-subty TO tdoc_occ-subty.
IF ( '0000' IN info
OR '0001' IN info
OR '0002' IN info
OR '0003' IN info
OR '0007' IN info
OR '0016' IN info )
OR risp NE '2'
OR p_updt NE 'X'.
PERFORM display_occ.
ELSE.
if '0008' in info.
message s000(db).
check not subty is initial.
check not '0' in subty.
endif.
PERFORM update_occ.
ENDIF.
ENDFORM. " cancella_infotype
*&---------------------------------------------------------------------*
*& Form gestione
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM popup_update.
CONCATENATE 'Cancelli DEFINITIVAMENTE' 'i record inseriti?' INTO
testo SEPARATED BY space.
CLEAR testata.
ENDFORM. " testata
*&---------------------------------------------------------------------*
*& Form display_occ
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_occ.
CALL FUNCTION 'DISPLAY_BASIC_LIST'
EXPORTING
basic_list_title = 'Occorrenze secondo le selezioni date'
file_name = 'ITKILLER'
lay_out = 0
TABLES
data_tab = tdoc_occ
fieldname_tab = testata
EXCEPTIONS
no_data_tab_entries = 2
OTHERS = 5
.
ENDFORM. " display_occ
*---------------------------------------------------------------------*
* FORM DISPLAY_OCC *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM update_occ.
CALL FUNCTION 'DISPLAY_BASIC_LIST'
EXPORTING
basic_list_title = 'Occorrenze secondo le selezioni date'
file_name = 'ITKILLER'
lay_out = 0
dyn_pushbutton_text1 = 'Annulla Cancellazione'
dyn_pushbutton_text2 = 'Cancella occorrenze'
TABLES
data_tab = tdoc_occ
fieldname_tab = testata
EXCEPTIONS
no_data_tab_entries = 2
OTHERS = 5
.
CASE sy-ucomm.
WHEN 'BUT1'.
EXIT.
WHEN 'BUT2'.
PERFORM update_final.
ENDCASE.
ENDFORM. " update_OCC
*&---------------------------------------------------------------------*
*& Form update_final
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM update_final.
nro_it = info-low.
WHILE nro_it IN info.
CONCATENATE 'PA' nro_it INTO nome_pa.
LOOP AT tdoc_occ.
DELETE FROM (nome_pa) WHERE begda EQ tdoc_occ-begda
AND pernr EQ tdoc_occ-pernr
AND endda EQ tdoc_occ-endda
AND subty EQ tdoc_occ-subty.
nro_it = nro_it + 1.
ENDLOOP.
ENDWHILE.
IF sy-subrc EQ 0.
MESSAGE ID 'RP' TYPE 'I' NUMBER 16 WITH 'Attenzione,'
'cancellazione avvenuta con successo' .
ENDIF.
EXIT.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.