REPORT ZSD1DELETION .
TYPE-POOLS:SLIS.
*Used in ZSDI_INTERFACE1 Program.
TABLES:ZSD_ERR_HEADER.
DATA: BEGIN OF ITAB1 OCCURS 0.
DATA: SL_NO TYPE SY-TABIX.
INCLUDE STRUCTURE ZSD_ERR_HEADER.
DATA:END OF ITAB1.
DATA:LINE1(10) TYPE C,
LINE2(10) TYPE C,
date1(10) type c,
date2(10) type c,
name1(60),
string1(100),
title1(65),
title2(100) type c,
FNAME TYPE STRING.
*Declarations for ALV
DATA:itfieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA:itrepid TYPE sy-repid.
itrepid = sy-repid.
DATA:itevent TYPE slis_t_event.
DATA:itlistheader TYPE slis_t_listheader.
DATA:walistheader LIKE LINE OF itlistheader.
DATA:itlayout TYPE slis_layout_alv.
DATA:top TYPE slis_formname.
DATA:itsort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
*PARAMETERS:P_WERKS LIKE BSEG-WERKS.
SELECT-OPTIONS: S_DATE FOR ZSD_ERR_HEADER-RUNDATE OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
*Validations w.r.t the Date
AT SELECTION-SCREEN ON S_DATE.
IF S_DATE IS INITIAL.
MESSAGE 'Enter the Date' type 'E'.
*Records from 2007 can't be deleted.
ELSEIF S_DATE-LOW+0(4) >= '2007' AND
S_DATE-HIGH+0(4) >= '2007'.
MESSAGE 'Records from the Year 2007 cannot be Deleted' type 'E'.
ENDIF.
CONCATENATE s_DATE-low+6(2) '.' s_DATE-low+4(2) '.' s_DATE-low+0(4)
INTO date1.
CONCATENATE s_DATE-high+6(2) '.' s_DATE-high+4(2) '.' s_DATE-high+0(4)
INTO date2.
PERFORM GETDATA.
*&---------------------------------------------------------------------*
*& Form DOWNLOAD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* form GETDATA. SELECT * FROM ZSD_ERR_HEADER INTO CORRESPONDING FIELDS OF TABLE ITAB1 WHERE RUNDATE IN S_DATE. IF ITAB1[] IS NOT INITIAL. DESCRIBE TABLE ITAB1 LINES LINE1. PERFORM DELETION. PERFORM ALV. ELSE. MESSAGE 'No Data' type 'S'. ENDIF. endform. " GETDATA *&---------------------------------------------------------------------* *& Form DELETION *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* form DELETION . DELETE from ZSD_ERR_HEADER WHERE RUNDATE IN S_DATE. endform. " DELETION *&--------------------------------------------------------------------* *& Form alv *&--------------------------------------------------------------------* * Fieldcatalog for ALV Report *---------------------------------------------------------------------* FORM alv. LOOP AT ITAB1. ITAB1-SL_NO = SY-TABIX. MODIFY ITAB1. ENDLOOP. DEFINE m_fieldcat. itfieldcat-fieldname = &1. itfieldcat-col_pos = &2. itfieldcat-seltext_l = &3. itfieldcat-do_sum = &4. itfieldcat-outputlen = &5. itfieldcat-edit = &6. append itfieldcat to itfieldcat. clear itfieldcat. END-OF-DEFINITION. m_fieldcat 'SL_NO' '' 'SL. NO' '' 03 ''. m_fieldcat 'HEADER_ID' '' 'Header Id' '' 10 ''. m_fieldcat 'ITEM_ID' '' 'Item Id.' '' 05 ''. m_fieldcat 'CUSTOMER_ORDER' '' 'Customer Order' '' 25 ''. m_fieldcat 'PLANT' '' 'Plant.' '' 04 ''. m_fieldcat 'CUSTOMER_TO' '' 'To Customer' '' 06 '' . m_fieldcat 'SO_NUMBER' '' 'Doc.No.' '' 10 ''. m_fieldcat 'MATERIAL' '' 'Material.' '' 18 ''. m_fieldcat 'QUANTITY' '' 'Quantity' '' 15 '' . m_fieldcat 'RUNDATE' '' 'Run Date' '' 08 ''. m_fieldcat 'RUNTIME' '' 'Time' '' 06 ''. m_fieldcat 'ERROR' '' 'Error' '' 100 '' . itlayout-zebra = 'X'. itlayout-colwidth_optimize = 'X'. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = sy-repid is_layout = itlayout * i_callback_user_command = ' ' i_callback_top_of_page = 'TOP' it_fieldcat = itfieldcat[] i_save = 'A' * is_variant = ITVARIANT it_events = itevent[] * is_print = ITPRINTPARAMS it_sort = itsort[] TABLES t_outtab = itAB1 EXCEPTIONS program_error = 1 OTHERS = 2. IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. "alv
*&--------------------------------------------------------------------*
*& Form TOP
*&--------------------------------------------------------------------*
* Top of page for ALV Report
*---------------------------------------------------------------------*
FORM top.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = itevent
* EXCEPTIONS
* LIST_TYPE_WRONG = 1
* OTHERS = 2
.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
string1 = 'Records from'.
CONCATENATE string1 date1 'to' date2 INTO title1
SEPARATED BY space.
walistheader-typ = 'H'.
walistheader-info = title1.
APPEND walistheader TO itlistheader.
CONCATENATE 'Records Deleted' '-' LINE1 INTO title2.
walistheader-typ = 'H'.
walistheader-info = title2.
APPEND walistheader TO itlistheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = itlistheader
* I_LOGO = ''.
* I_END_OF_LIST_GRID =
.
* ENDIF.
CLEAR itlistheader.
* ENDIF.
ENDFORM. "TOP
No comments:
Post a Comment