To split the records of the internal table and send in Packets to XI

Hi All,
I am executing the program in SAP. Program will send the material numbers to Oracle through XI and in turn we will get the corresponding data back to SAP. and this all data is written into the file.
if records are more than 700 then XI will not able to get the data fully.
So, solution for this is to send the data in packets.
I want to write the logic like whenever the recods are more than 700, the first 700 records  will got to XI and rest of the records will go to XI after that. we are sending the material numbers to xi through proxy.
Problem is : how to write the logic for this.
suppose we have  executed the report for 1000 records, then it should generate 2 excel file in which first file shud contain 700 records, AND 2nd will contain rest of the 300 records.
Regards,
Mamta

Hi Mamta,
Please try this code. This is to split records as 255 length and u can change it as ur requirement by simply changing l_offset value as 700.
DATA: l_length TYPE i,                               
      l_lines TYPE i,                                
      l_pos TYPE i VALUE 0,                          
      l_offset TYPE i VALUE 255,                     
      l_part TYPE i,                                 
      l_lastpart TYPE i.                             
CLEAR i_etabfinal.                                   
REFRESH i_etabfinal.                                 
*Split etab line as multiple 255 char length of lines
LOOP AT i_etab INTO x_etab.                          
l_length = STRLEN( x_etab-result ).                  
l_lines = l_length DIV l_offset.                     
l_lines = l_lines + 1.                               
l_part = l_offset.                                   
DO l_lines TIMES.
*To avoid spaces                                    
IF l_part LT l_length.                               
x_etabfinal-line = x_etab-result+l_pos(l_offset).    
APPEND x_etabfinal TO i_etabfinal.                   
l_pos = l_pos + l_offset.                            
l_part = l_pos + l_part.                             
ELSE.                                                
l_lastpart = l_length - l_pos.                       
x_etabfinal-line = x_etab-result+l_pos(l_lastpart).  
APPEND x_etabfinal TO i_etabfinal.                   
ENDIF.                                               
endloop.
Regards,
Subbu

Similar Messages

  • Count the Records in  an internal table without a loop.

    How do i count the number of records in an internal table without using the loop  statement.
    The Describe statement give the total no. of records in the internal table.But i want the count of the key fields in the internal table
    For eg
    Row Field
    1       A
    2       A
    3       A
    4       B
    5       B
    6       C
    Count of A = 3
    Count of B = 2
    Count of C = 1

    Dilip,
      I think isn't posible. Only 3 ideas:
    1ª, make other table "table2", similar to your actual table.
         table2[] = yourtable[].
         delete table2 where key <> 'A'.
         describe table table2 lines contA.
        But depending the amount of data, you may have problems in performance or memory consumption...
    2ª, make other table, only with the keys fields and a count field,
        data begin table2
           key_field1,
           cont type i.
        end data.
       when you append lines to yourdata, make a collect to this table:
        table2-keys = yourtable-keys.
        table2-cont = 1.
       collect table2.
       But only works if you can modify the program where data is appended, and you may be carefull when data is deleted :-(...
    3ª if your data if filled in a select, you may fill the table2 of point 2ª, making a similar select but:
       select keyfields count( * ) into table table2
      from ...
      where (the same you have to fill your original table...)
       group by keys.
    But you have the same problem is data is deleted later...
    I hope that any of the three is useful for you...
    Edited by: Diego Alvarez on Jan 5, 2010 5:09 PM

  • How to add the records of 2 internal table records into one file

    hello experts,
    My scenario is...
    I am retrieving the data for the for the credit, debit and trailer records of the customer into 3 different internal tables and finally i have to append all those records into one file first debit records then credit records finally the trailer record.... how to do that can anyone give some idea plzzzzzzzzz..
    Plz its bit urgent..
    Thanks a lot for your anticipation
    SRI

    Hello,
    Do like this.
    " Assume u have three itab.
    "Itab1 - debit
    "Itab2 - credit
    "Itab3 - Credit.
    REPORT ZV_TEST_SERVER .
    *PARAMETERS: P_FILE TYPE STRING."RLGRAP-FILENAME.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        FILENAME                      = P_FILE
    *   FILETYPE                      = 'ASC'
       APPEND                        = 'X'  " Check here
    *   WRITE_FIELD_SEPARATOR         = ' '
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = ITAB1
    * EXCEPTIONS
    *   FILE_WRITE_ERROR              = 1
    *   NO_BATCH                      = 2
    *   GUI_REFUSE_FILETRANSFER       = 3
    *   INVALID_TYPE                  = 4
    *   NO_AUTHORITY                  = 5
    *   UNKNOWN_ERROR                 = 6
    *   HEADER_NOT_ALLOWED            = 7
    *   SEPARATOR_NOT_ALLOWED         = 8
    *   FILESIZE_NOT_ALLOWED          = 9
    *   HEADER_TOO_LONG               = 10
    *   DP_ERROR_CREATE               = 11
    *   DP_ERROR_SEND                 = 12
    *   DP_ERROR_WRITE                = 13
    *   UNKNOWN_DP_ERROR              = 14
    *   ACCESS_DENIED                 = 15
    *   DP_OUT_OF_MEMORY              = 16
    *   DISK_FULL                     = 17
    *   DP_TIMEOUT                    = 18
    *   FILE_NOT_FOUND                = 19
    *   DATAPROVIDER_EXCEPTION        = 20
    *   CONTROL_FLUSH_ERROR           = 21
    *   OTHERS                        = 22
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        FILENAME                      = P_FILE
    *   FILETYPE                      = 'ASC'
       APPEND                        = 'X'  " Check here
    *   WRITE_FIELD_SEPARATOR         = ' '
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = ITAB2  " Check here
    * EXCEPTIONS
    *   FILE_WRITE_ERROR              = 1
    *   NO_BATCH                      = 2
    *   GUI_REFUSE_FILETRANSFER       = 3
    *   INVALID_TYPE                  = 4
    *   NO_AUTHORITY                  = 5
    *   UNKNOWN_ERROR                 = 6
    *   HEADER_NOT_ALLOWED            = 7
    *   SEPARATOR_NOT_ALLOWED         = 8
    *   FILESIZE_NOT_ALLOWED          = 9
    *   HEADER_TOO_LONG               = 10
    *   DP_ERROR_CREATE               = 11
    *   DP_ERROR_SEND                 = 12
    *   DP_ERROR_WRITE                = 13
    *   UNKNOWN_DP_ERROR              = 14
    *   ACCESS_DENIED                 = 15
    *   DP_OUT_OF_MEMORY              = 16
    *   DISK_FULL                     = 17
    *   DP_TIMEOUT                    = 18
    *   FILE_NOT_FOUND                = 19
    *   DATAPROVIDER_EXCEPTION        = 20
    *   CONTROL_FLUSH_ERROR           = 21
    *   OTHERS                        = 22
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        FILENAME                      = P_FILE
    *   FILETYPE                      = 'ASC'
       APPEND                        = 'X'  " Check here
    *   WRITE_FIELD_SEPARATOR         = ' '
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = ITAB3 " Check here
    * EXCEPTIONS
    *   FILE_WRITE_ERROR              = 1
    *   NO_BATCH                      = 2
    *   GUI_REFUSE_FILETRANSFER       = 3
    *   INVALID_TYPE                  = 4
    *   NO_AUTHORITY                  = 5
    *   UNKNOWN_ERROR                 = 6
    *   HEADER_NOT_ALLOWED            = 7
    *   SEPARATOR_NOT_ALLOWED         = 8
    *   FILESIZE_NOT_ALLOWED          = 9
    *   HEADER_TOO_LONG               = 10
    *   DP_ERROR_CREATE               = 11
    *   DP_ERROR_SEND                 = 12
    *   DP_ERROR_WRITE                = 13
    *   UNKNOWN_DP_ERROR              = 14
    *   ACCESS_DENIED                 = 15
    *   DP_OUT_OF_MEMORY              = 16
    *   DISK_FULL                     = 17
    *   DP_TIMEOUT                    = 18
    *   FILE_NOT_FOUND                = 19
    *   DATAPROVIDER_EXCEPTION        = 20
    *   CONTROL_FLUSH_ERROR           = 21
    *   OTHERS                        = 22
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    If useful reward.
    Vasanth

  • Moving the record to another internal table.

    dear all,
    i am having two internal tables . itab & itab1.
    itab contains matnr   plant   quantity     date
                        100      500      1000       yyyy/mm/10
                        100      500      2000       yyyy/mm/20.
              i have to move the records to itab1 if dd less than 15 quantity should be moved to  q1 if gt 15 then the quantity should be moved to same q2 in a same line.
    i want itab1 to be
               matnr   plant     q1        q2
              100       500      1000       2000.
    regards ,
    balaji

    hi Balaji,
    Please use the following logic:
    data:
         v_dd(2).
    loop at itab.
          itab1-matnr = itab-matnr.
          itab1-plant = itab-plant.
          v_dd = itab-date+8(2).
          read table itab1 with key matnr = itab1-matnr
                                             plant   = itab1-plant.
          if v_dd < 15.
                itab1-q1 = itab1-q1 + itab-quantity.
          else.
                itab1-q2 = itab1-q2 + itab-quantity.
          endif.
          if sy-subrc = 0.
                 modify itab1 index sy-tabix.
          else.
                append itab1.
          endif.
          clear itab1.
    endloop.
    Hope this helps,
    Sajan Joseph.

  • Get the records number from internal table with conditon.

    Internal table itab got more than 1000 records,now i need to get the number of records with condition that itab-field1 = 'XXXX'.
    actully, i got an inefficient logic to count the number in a loop statement. is there better way to implement it?

    Hi,
    One alternative solution, which may be useful for other parts of your program, is to have an aditional itab1 with a single column/field (field1), which acts like a index or shadow table, and which is filled simultaneously with itab. Then you can use DESCRIBE TABLE itab1 LINES lv_lines.
    Atb

  • Store the vital info from the absence quota record in an internal table

    Hi experts,
    I want to detrmine if the Absence record’s (PA2001 rec) deduction from date (PA2001-BEGDA) and absence to date (PA2001-ENDDA) are permissible for the validity period of the Absence Quota record (the PA2006 rec).  If the quota’s deduction from date, PA2006-DESTA, is greater than the PA2001-BEGDA, we then need to identify this absence quota record for change and change the deduction from date, PA2006-DESTA, to be the same as PA2001-BEGDA.  Store the vital info from the absence quota record in an internal table and record the new date that the deduction from date that needs to be changed to.  The changes will be made via a BDC session.
    Please help me out...
    Thanks,
    Vicky

    This looks possible if we code it in 'dynamic action' table, but the BDC may not read it during run time.
    Do you still have this issue?
    Thanks
    Narasimha

  • How to log the messages in an internal table n display

    Hello guys,
    This is my first post in SDN.
    I am uploading some data from application server. I am doing lot of varifications, based on that I have to display the messages.
    So I asked not to use the write statements to display the messages but asked me to create an internal table and display the messages afterwards..
    like I am using some BAPI to upload after the bapi call i have to log the result for each record into an internal table and show...
    can anyone guide me how to do it?

    Thanks for your info Azad,
    here I am posting my code... can u go through it once and lemme me whether i am in right track or not?
    FORM FORM_POST_DATA.
      IF X_POST = 'X'.
        CALL FUNCTION 'BAPI_ACC_BILLING_POST'
          EXPORTING
            DOCUMENTHEADER          = WA_DOCUMENTHEADER
           CUSTOMERCPD             = WA_CUSTOMERCPD
    IMPORTING
      OBJ_TYPE                =
      OBJ_KEY                 =
      OBJ_SYS                 =
          TABLES
            ACCOUNTRECEIVABLE       = IT_ACCOUNTRECEIVABLE
            ACCOUNTGL               = IT_ACCOUNTGL
            ACCOUNTTAX              = IT_ACCOUNTTAX
      CRITERIA                =
      VALUEFIELD              =
            CURRENCYAMOUNT          = IT_CURRENCYAMOUNT
            RETURN                  = IT_RETURN
      SALESORDER              =
      SALESAMOUNT             =
           EXTENSION1              = IT_EXTENSION1
        LOOP AT IT_RETURN.
          MOVE-CORRESPONDING IT_RETURN TO IT_MESSAGES.
        ENDLOOP.
      ENDIF.
    WRITE: / 'Result of Post:'.
      WRITE : / REF_TYPE,REF_KEY,REF_SYS.
      PERFORM FORM_SHOW_MESSAGES.
    ENDFORM.              "FORM_POST_DATA
    FORM FORM_SHOW_MESSAGES.
      IF IT_RETURN[] IS INITIAL.
        WRITE: / 'no messages'.
      ELSE.
        SKIP 1.
        LOOP AT IT_RETURN.
          WRITE: /    IT_RETURN-TYPE,
                 (2)  IT_RETURN-ID,
                      IT_RETURN-NUMBER,
                 (80) IT_RETURN-MESSAGE,
                    IT_RETURN-LOG_NO
                    IT_RETURN-LOG_MSG_NO
                    IT_RETURN-MESSAGE_V1
                    IT_RETURN-MESSAGE_V2
                    IT_RETURN-MESSAGE_V3
                    IT_RETURN-MESSAGE_V4
                 (20) IT_RETURN-PARAMETER,
                 (3)  IT_RETURN-ROW,
                      IT_RETURN-FIELD.
                    IT_RETURN-SYSTEM
        ENDLOOP.
      ENDIF.
      ULINE.
    ENDFORM.                               " Show_messages
    Nisha...

  • Problem in moving the data into final internal table

    Hello all,
    I am stuck in apeculair situation.
    I have a internal table having header record and a internal table having its line items.
    Header record ::    90006103  A   20080110   ALBERTA    3456
    Detail   record ::    90006103  D2  2219CR1710441
                               90006103  D2  2219M11710443
                               90006103  D2  2219M21710442
                               90006103  A    20080115   ALBERTA    3456
                               90006103  D2  2219CR1710441
                               90006103  D2  2219M11710443
                               90006103  D2  2219M21710442
    I collected the header record in one internal table and another internal table having all the line items.But the problem is when i am moving the values to the final inernal table i am getting the same payment date
    20080110 (Date field in first record of header internal table) for all the line items .
    But my requirement is that date should be 20080110 for the first 3 line items of first header record and similarly date should be 20080115 for all the line items of the next header record.
    Kindly suggest.
    Regards,
    Arun

    assumption: some mistake in ur posting that, How belnr and date r same for both header records, so i guess, either one is different.
    try with AT NEW - ENDAT.
    AT NEW belnr.
    here use looping, READing of ur itabs.---> so, u need to build couple of itabs to move forth and back.
    ENDAT.
    pls. note that, when u use this AT NEW all the CHAR fileds of itab wuld show as STARS **.....so, this is the necessity behind building new itabs.
    thanq
    Edited by: SAP ABAPer on Dec 30, 2008 6:24 PM

  • Record count in internal table

    i want to know record count for the records stored in
    internal table.
    do we have any system field to display record count?

    Hi,
    Try this:
    Data: count_lines type i.
    describe table my_table lines count_lines.
    Regards,
    Arjan

  • Records in an internal table

    Hi,
    How to check if all the records in an internal table are identical.
    could you help soon

    Hi,
    use the code,
    data : begin of itab occurs 0,
              matnr like mara-matnr,
              maktx like makt-maktx.
              end of itab.
    parameters : p_matnr like mara-matnr.
    start-of-selection.
    select * from makt into corresponding fields of table itab
                                where  matnr = p_matnr.
    delete adjacent duplicates from itab comparing matnr.
    if sy-subrc eq 0.
    write : /1 'Entries are identical.' .
    endif.
    Regards,
    Sankar.

  • Missing records while downloading internal table to excel because of ' " '

    Friends...
    I am trying to download the contents of an internal table to an excel file.
    Now i tried to download the contents in debugging mode. I noticed there is this character " in one of the fields of my internal table, and i came to know, that presence of such special characters results in the internal table not getting exaclty downloaded to excel format.
    Is there any way to solve this problem. I thought of removing the field itself from the internal table but, thats not possible. Its mandatory to have that field in the table.
    Regards.

    Well.. by doing so.. the number of records etc is comin correctly, but the field in which the special character " is present, will be shown without " right.... so.. infact... the output is incorrect ....
    I am sorry, i cant share the file because of security reasons..

  • Report output into internal table and going ahead

    Hi Folks,
    We have a report MB51.It is showing some details.Now along with these details I wanna fetch some more detail and show it in the same report.
    One way is I can copy this into Z and then go ahead with the changes.But I would like to know can we SUBMIT MB51  program in my ZPROGRAM and then get the output into an internal table and then again populate this internal table with the rest of the data and again display it as final output.
    To be precise,is it possible to get the final output of MB51 into an internal table by using submit.
    K.Kiran.

    dear kian
    pls check the below code for example:
    DATA LIST_TAB TYPE TABLE OF ABAPLIST.
    DATA: BEGIN OF olist OCCURS 0,
            filler1(1500)   TYPE c,
          END OF olist.
    SUBMIT YTEST04 WITH MATNR EQ 't000001'
                     EXPORTING LIST TO MEMORY
                     AND RETURN.
    BREAK-POINT.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        LISTOBJECT = LIST_TAB
      EXCEPTIONS
        NOT_FOUND  = 1
        OTHERS     = 2.
    IF SY-SUBRC = 0.
      CALL FUNCTION 'LIST_TO_ASCI'
        EXPORTING
          LIST_INDEX         = -1
        TABLES
          LISTASCI           = oLIST
          LISTOBJECT         = LIST_TAB
        EXCEPTIONS
          EMPTY_LIST         = 1
          LIST_INDEX_INVALID = 2
          OTHERS             = 3.
      BREAK-POINT.
    ENDIF.

  • Spilt the number of records in a internal table

    Hi all,
            I have a requirement where i must spilt the number of records in my internal table itab .Say if i have 2000 records , i must spilt it taking the first 990 records and doing some posting using Bapi and again take the next 990 records and do the posting .Can some one help me out.
    Good answers will be rewarded with points.

    Hi,
    You can use these instructions using two internal tables, but please be aware to not forget any line.
    REFRESH my_table2.
    APPEND LINES OF my_table FROM 1 TO 990 TO my_table2.
    CALL FUNCTION 'BAPI'....
                 (with my_table2)
    REFRESH my_table2.
    APPEND LINES OF my_table FROM 991 TO my_table2.
    CALL FUNCTION 'BAPI'....
                 (with my_table2)
    Regards,
    Mathieu

  • Pickup only the newest record in an Internal Table.

    Hi all:
    I have and internal table that i am accesing in a transformation.
    Which is the best approach to read from the internal table only the
    record with the newest date. Data look like this:
    Date_________MAT___ Qty
    12.08.2009___4050___70
    10.05.2009___4050___30
    18.11.2009___4050___42
    20.07.2009___4050___28
    In this case, for Material 4050 i need only the third record (18.11.2009),
    any code example or guideline..?
    Regards,

    Hi,
    You can sort the internal table by date and material in descending order and then perform read on the internal table with key as material. this would bring the latest date for that material.
    Regards,
    Rk.

  • How to record the records deleted in a table

    Hi Experts
    I want to run a report as a batch which should deleted the records
    which are sysdate - 60 and The report should log the number of records deleted
    from each table at End Of Run.
    Criteria for selecting records to be deleted are as follows:
    1.     ZINT_DATA
    u2022     ZINT_DATA.CREATED_ON <= (Today u2013 60 Days)
                   and ZINT_DATA.STATUS = u2018OKu2019
    So I want to create a table for log history recorded as
    Delete Date         Log description
    01.01.2008        1500 rows deleted
    30.03.2008        2000 rows deleted.
    30.04.2008        300  rows deleted.
    Eg The table are ZINT_DATA.
    The report starts like this
    REPORT z_eslp_command.
    DATA:
      fs_zint_data TYPE zint_data.
    DATA:
      t_zint_data TYPE
              TABLE OF
                      ZINT_DATA.
    START-OF-SELECTION.
    SELECT *
       FROM ZINT_DATA
       INTO TABLE t_ZINT_DATA PACKAGE SIZE 10000.
    ENDSELECT.
    LOOP AT t_zint_data INTO fs_zint_data.
    INSERT INTO ZINT_DATA_DEL
          VALUES fs_zint_data.
    select count(*) from zint_data_del.
    ENDLOOP.
    IF sy-subrc EQ 0.
      WRITE:
        'DATA INSERTED FROM ZINT_DATA into ZINT_DATA_DEL'.
    ENDIF.
    But Instead of creating another table , I want only log to be recorded as described.
    Thanks
    Regards
    Piroz

    Hi Kiran
    See the final modification of the report but I am getting an error as
    Field " Corresponding_fields" is unknown, it is neithere in one of the specified tables nor defined by a
    DATA statement, but I have already created an internal table itab1 , could you check and revert with the correction.
    REPORT  ZSD1DELETION                .
    TYPE-POOLS:SLIS.
    *Used in ZSDI_INTERFACE1 Program.
    TABLES:ZINT_DATA_DEL  . 
    *DATA: BEGIN OF ITAB1 OCCURS 0.
    *DATA: SL_NO TYPE SY-TABIX.
         INCLUDE STRUCTURE zint_data_del.
    *DATA:END OF ITAB1.
    DATA: BEGIN OF ITAB1 occurs 0 ,
          MANDT type zint_data_del-mandt,
          ZINT_ID type zint_data_del-zint_id,
          ZINT_TY type zint_data_del-zint_ty,
          CREATED_ON type zint_data_del-created_on,
          KEY_VAL type zint_data_del-key_val,
          SEQUENCE type zint_data_del-sequence,
          STATUS type zint_data_del-status,                 
          LENGTH type zint_data_del-length,           
          RAW_DATA type zint_data_del-raw_data,       
          end of itab1.
    *DATA: i_data TYPE TABLE OF ITAB1, " internal table
    *wa_data TYPE ITAB1. " work area
    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 ZINT_DATA_DEL-CREATED_ON 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-low6(2) '.' s_DATE-low4(2) '.' s_DATE-low+0(4)
    INTO date1.
    CONCATENATE  s_DATE-high6(2) '.' s_DATE-high4(2) '.' s_DATE-high+0(4)
    INTO date2.
    PERFORM GETDATA.
    *&      Form  DOWNLOAD
          text
    -->  p1        text
    <--  p2        text
    form GETDATA.
    SELECT * FROM ZINT_DATA_DEL
             INTO CORRESPONDING_FIELDS OF TABLE ITAB1
             WHERE CREATED_ON 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 ZINT_DATA_DEL WHERE CREATED_ON 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 'MANDT'     '' 'Client' '' 03 ''.
      m_fieldcat 'ZINT_ID' ''   'Id' '' 10 ''.
      m_fieldcat 'ZINT_TY'   '' 'Type.'  '' 05 ''.
      m_fieldcat 'CREATED_ON' '' 'Date Created on' '' 25 ''.
      m_fieldcat 'KEY_VAL'       '' 'key value'  '' 04  ''.
      m_fieldcat 'SEQUENCE' '' 'sequence' '' 06 ''  .
      m_fieldcat 'STATUS'   '' 'status.' '' 10 ''.
      m_fieldcat 'LENGTH'    '' 'Length.' '' 18 ''.
      m_fieldcat 'RAW_DATA'    '' 'Raw Data' '' 15 '' .
      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
    Regrds
    Piroz

Maybe you are looking for

  • Saving xml files in oracle database

    hi all anyone who could tell me how can i save xml files in the database?

  • Need to change my parked invoice status to"Free for payment"

    I want to set the status to "Free for payment" for parked invoice documents after posting(using MIR4 or else),so that help me how .Is there any function module available for that to set the ststus or else how??Please let me know very urget. thanks Re

  • Chart Issue,  tooltip separator / on custom XML sustitution not working

    I did not find the way to declaratively change the Tooltip label separator in the chart, I see the XML contains this: <tooltip_settings enabled="true">             <format><![CDATA[{%Name}{enabled:False} - {%Value}The problem is the "-" minus sign as

  • Roaming issues

    Hi, I bought my iPhone 3G in Boston, but am spending a month in Dublin, Ireland. Ever since I have been here I have had the usual issues with 3G and signals getting dropped, battery draining etc... However, the biggest problem I have is that I cannot

  • Palm Pre on AT&T

    My wife has a plan through her work that I am under and it is with AT&T, in the near future I would like to upgrade to the Palm Pre.  When will the cool phone be available for AT&T?  Thanks Post relates to: Centro (AT&T)