Getting Problem after Deleting a record from Record Store

I am trying to create a simple application for mobile device. This application storing some records. I used RMS for this. These records i show in a list. But i tried to show list of records after deleting any record then list shows only prior records of deleted records n then shows exception as
Recordsjavax.microedition.rms.InvalidRecordIDException
The code i written as follows
For storing data
public void storeExercise(String EName, String Etime)
try
//System.out.println("AAAA");
recordstore = RecordStore.openRecordStore("Test3",true);
catch (Exception error)
//System.out.println("EEEE");
System.out.println("Exception"+error);
try
byte[] outputRecord;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
DataOutputStream outputdataStream = new DataOutputStream(outputStream);
outputdataStream.writeUTF(EName);
outputdataStream.writeUTF(Etime);
outputdataStream.flush();
outputRecord = outputStream.toByteArray();
recordstore.addRecord(outputRecord, 0, outputRecord.length);
outputStream.reset();
outputStream.close();
outputdataStream.close();
zlist.append(EName+Etime, null);
display.setCurrent(zlist);
catch (Exception error)
System.out.println("Exception in writing Records"+error);
for getting records
public void getExercise(ZimList zlist)
this.zlist = zlist;
try
//System.out.println("AAAA");
recordstore = RecordStore.openRecordStore("Test3",true);
//recordstore.closeRecordStore();
catch (Exception error)
//System.out.println("EEEE");
System.out.println("Exception"+error);
try
//System.out.println("Hello");
String Ename = null;
String Etime = null;
byte[] byteInputData = new byte[100];
ByteArrayInputStream inputStream = new ByteArrayInputStream(byteInputData);
DataInputStream inputDataStream = new DataInputStream(inputStream);
for (int x=1; x<= recordstore.getNumRecords() ; x++ )
System.out.println("Record Id ="+x);
//if (x != InvalidRecordID)
recordstore.getRecord(x, byteInputData, 0);
Ename = inputDataStream.readUTF();
Etime = inputDataStream.readUTF();
inputStream.reset();
Final = Ename + Etime;
System.out.println("Insert" + Final);
zlist.insert(x-1,Final,null);
inputStream.close();
inputDataStream.close();
//recordstore.closeRecordStore();
catch (Exception error)
System.out.println("Exception in Reading Records"+error);
/*if (recordstore.listRecordStores() != null)
try
recordstore.deleteRecordStore("My Record Store");
catch (Exception error)
System.out.println("Exception"+error);
And for deleting records I write
public void deleteExercise(int index)
try
//System.out.println("AAAA");
recordstore = RecordStore.openRecordStore("Test3",true);
//recordstore.closeRecordStore();
catch (Exception error)
//System.out.println("EEEE");
System.out.println("Exception"+error);
if (recordstore.listRecordStores() != null)
try
byte[] byteInputData = new byte[100];
ByteArrayInputStream inputStream = new ByteArrayInputStream(byteInputData);
DataInputStream inputDataStream = new DataInputStream(inputStream);
for (int x=1; x<= recordstore.getNumRecords() ; x++ )
recordstore.getRecord(x, byteInputData, 0);
if (x == index)
recordstore.deleteRecord(index);
//x--;
inputStream.reset();
break;
inputStream.close();
inputDataStream.close();
catch (Exception error)
System.out.println("Exception in Deleting Records"+error);
Please Help me bcz i am new in j2me development n having no experience

Ok ...
When you add records in you store, the J2ME implementation create an ID.
In the database, there is a list like that with ID <--> ]byte[ ]
You can get back a record with a this ID.
When you delete a record, it deletes the row. Lets say you have stored 3 records and that the ID are 1, 2, 3 ... if you delete the second one, then you have still in the database IDs 1 and 3.
That's why you have this exception : you are iterating with an ID 1, 2, 3, 4, 5 ... if one is delete there is no reorganization. (If you add an other record, it could be stored with ID 2).
To read all the records, you should get a list of existing IDs. Take a look at the API. Here is a piece of code, that you work but I have not tested :
RecordStore rs;
RecordEnumeration re = rs.enumerateRecords(null, null, false);
while (re.hasNextElement()) {
  String str = new String(re.nextRecord());
  System.out.println("Record: " + str);         
} Hope it will help you.
Regards

Similar Messages

  • Does preview catalog will get smaller after deleting movies/pictures from Lightroom 4.0 assuming ...

    Does preview catalog will get smaller after deleting movies/pictures from Lightroom 4.0 assuming the option 'Automatically discard 1:1 previews' is marked 'Never'?

    Yes, but it may not be apparent immediately. The previews are "held" for a time to save rebuilding if the associted file is reimported or the removal undone.

  • Subversion -- Problem After Deleting a File from Repository

    I am using Dreamweaver CS6 and am using Subversion as a Repository server.
    In doing a massive check-in, Subversion reported an error with one file:
    SVN: #160024, Commit failed (details to follow):
    File or directory ‘aff.php’ is out of date; try updating
                Resource out of date; try updating
    I tried reverting that file and then tried the update, all to no avail.  In the end, I deleted that file, figuring that I could then simply add it.
    When I tried to add it, I got the following error:
    SVN: #155011, Commit failed (details to follow):
    File ‘aff.php’ is out of date
    File not found: transaction ‘150-4w’, path ‘/whmcs/aff.php’
    The reference to '150-4w' was to the "successful' transaction in which I deleted the file, 'aff.php'.
    Can anyone please help me to check this file in?

    Hi UndeniablyRexer,
    I've learned that deleted files stay on Adobe's server for 30 days. Section 3.3 of  General-terms governs access rights to your content.  It reads:
    3.3 Our Access. We will not access, view, or listen to any of your content, except as reasonably necessary to perform the Services. Actions reasonably necessary to perform the Services may include (but are not limited to) (a) responding to support requests; (b) detecting, preventing, or otherwise addressing fraud, security, unlawful, or technical issues; and (c) enforcing these terms.
    Best,
    Sara

  • After deleting a song from my iPhone, it still playing. How can i stop that? How can i get rid of the song once for all?

    After deleting a song from my iPhone, it still playing. How can i stop that? How can i get rid of the song once for all?

    I'm pretty sure that the solution is in the settings of her email

  • I have problems with activation, after delete mi Iphone from Icloud.

    I have problems with activation, after delete mi Iphone from Icloud.

    Hello Sikiz 21,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    iPhone: Troubleshooting activation issues
    http://support.apple.com/kb/TS3424
    iOS: Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    Best of luck,
    Mario

  • The Subsequent Requirm not getting deleted after deleting the Item from P.O

    Hi all
    The Subsequent Requirment for the Material is not getting  cancelled even after deleting the Item from the Purchase Order  and we have even deleted the Requirment for the Top level material . If we click on the Pegging requirment for the Subsequent requirment the system is telling that no Pegging Requirment exists but it is not getting deleted. Waiting for the feed backs

    Kumar,
    Run MRP for the Materials involed and let us know if there are any exception messages.
    Regards,
    Prasobh

  • What cause searching network problem after updating iphone 6 from iOS 8.1.2 TO iOS 8.1.3?

    what cause searching network problem after updating iphone 6 from iOS 8.1.2 TO iOS 8.1.3?

    SSince Apple does not support downgrading the iOS I suggest you start a new question that gives a good title to a specific problem. Then in the body of the thread describe the problem in detail, tell us what steps you have tried so far to correct the problem, what happened, and what error messages you received.

  • Hi, I' ll be San Antonio from 8-10th of Oct and want to buy an iphone 5. According to forums there is no unlucked yet. Thus, can i get simlocked but not contracted phone from any store? and is that possible to use that phone in Turkey without any prob.

    Hi, I' ll be San Antonio from 8-10th of Oct and want to buy an iphone 5. According to forums there is no unlucked yet. Thus, can i get simlocked but not contracted phone from any store? and is that possible to use that phone in Turkey without any prob.

    If you purchase the phone at the full contract price and have no term left on your carrier contract, the carrier will unlock it for you. That's what I am doing with AT&T. I'll pay the full purchase price for the phone and since I don't have a contract with them, they will unlock it for you. It can be difficult to get it done since most of their customer service is very ill informed but I have had many discussions with them on their chat that I have records of them stating they will unlock any phone if you do not have an existing contract. It's the law.

  • Problem with ID and download from app store:computer or device could not be verified

    Hello.I have mac and i had one game from app store,but one day i couldnt open it,it ased me to ented my App ID and password,,,i did but it wrote to meYour device or computer could not be verified. Contact support for assistance. I allready chande my password and mad ned ID but nothing works.....the same problem.how can i download from app store again.thanks

    Try a forum more suited:
    https://discussions.apple.com/community/mac_app_store/using_mac_apple_store?view =discussions

  • How I can delete my account from Itunes Store? [I am not using it anymore and will not]]

    How I can delete my account from Itunes Store? [I am not using it anymore and will not]

    Just stop using it and remove your payment info.
    There is no need to do more.

  • I have a problem with downloading app (Twitter) from App Store.

    I have a problem with downloading app (Twitter) from App Store. I don't want this app. It is not downloaded yet, the download is still in progress.  I have limited data plan and I don't have a chance to finish the download via PC. The size of the app - 33 mb. Could you please cancel the download process so I will be able to remove the icon.

    Most of the people on these forums, including myself, are fellow users - you're not talking to iTunes Support here.
    Are you able to connect to a wifi network - tapping the app should pause the download of the app and change it to 'waiting', so you should be able to pause the download until you have access to a wifi network.

  • Problem after deleting the records........

    Hi Folks,
    Kindly help me with this report.
    At one point I am deleting the itfinal internal table w.r.t
    to HKONT.Before deleting I am having all the values for
    LIFNR and AWKey,but once deleting(as mentioned earlier) I
    am not getting these two values.The same Awkey is getting repeated
    again and again.
    Where I am going wrong.
    REPORT  zf14 no standard page heading line-size 134.                                    .
    TABLES: bkpf,bseg,lfa1,t001.
    type-pools:slis.
    TYPES : BEGIN OF x_bkpf,
             bukrs TYPE bkpf-bukrs,           " Company Code
             belnr TYPE bkpf-belnr,           " Document Number
             gjahr TYPE bkpf-gjahr,           " Fiscal year
             awkey TYPE bkpf-awkey,           " Object Key
             bldat TYPE bkpf-bldat,
             budat TYPE bkpf-budat,
             END OF x_bkpf.
    TYPES : BEGIN OF x_bseg,
             bukrs TYPE bseg-bukrs,           " Company Code
             belnr TYPE bseg-belnr,           " Document Number
             gjahr TYPE bseg-gjahr,           " Fiscal Year
             koart TYPE bseg-koart,
             hkont TYPE bseg-hkont,           " G/L Account
             ebeln TYPE bseg-ebeln,           " Purchasing Document
             lifnr TYPE bseg-lifnr,           " Vendor Code
             name1 type lfa1-name1,
             ort01 type lfa1-ort01,
            END OF x_bseg.
    TYPES : BEGIN OF x_bseg1,
             bukrs TYPE bseg-bukrs,           " Company Code
             belnr TYPE bsak-belnr,           " Document Number
             gjahr TYPE bsak-gjahr,           " Fiscal Year
             hkont TYPE bseg-hkont,           " G/L Account
             ebeln TYPE bseg-ebeln,           " Purchasing Document
             lifnr TYPE bseg-lifnr,           " Vendor Code
             wrbtr TYPE bseg-wrbtr,           " Amt.in Doc.Curr
            END OF x_bseg1.
    types:begin of x_ven,
          name1 type lfa1-name1,
          ort01 type lfa1-ort01,
          end of x_ven.
    TYPES : BEGIN OF x_final,
             bukrs TYPE bkpf-bukrs,           " Company Code
             belnr TYPE bkpf-belnr,           " Document Number
             gjahr TYPE bkpf-gjahr,           " Fiscal year
             blart TYPE bkpf-blart,           " Document Type
             awkey TYPE bkpf-awkey,           " Object Key
             bldat TYPE bkpf-bldat,
             budat TYPE bkpf-budat,
             mwskz TYPE bseg-mwskz,
             qsskz TYPE bseg-qsskz,
             wrbtr TYPE bseg-wrbtr,           " Amount in Doc Curr
             werks TYPE bseg-werks,           " Recv Facility Code
             hkont TYPE bseg-hkont,           " G/L Account
             ebeln TYPE bseg-ebeln,           " Purchasing Document
             ebeln1 type bseg-ebeln,
             lifnr TYPE bseg-lifnr,           " Vendor Code
             lifnr1 type bseg-lifnr,
             dmbtr TYPE bseg-dmbtr,
             wrtbr type bseg-wrbtr,
             vbill type bseg-wrbtr,
             tdsamt type c,
             tdsrate(4),
             shkzg TYPE bseg-shkzg,
             name1 TYPE lfa1-name1,           "vendor Name
             ort01 TYPE lfa1-ort01,           "City
             j_1icstno TYPE  j_1imovend-j_1icstno, "CST
             j_1ilstno  TYPE  j_1imovend-j_1ilstno ,"LST
          END OF x_final.
    DATA : it_bkpf   TYPE TABLE OF x_bkpf WITH HEADER LINE .
    DATA : it_bseg   TYPE TABLE OF x_bseg WITH HEADER LINE .
    DATA : it_bseg1   TYPE TABLE OF x_bseg1 WITH HEADER LINE .
    DATA : itfinal TYPE TABLE OF x_final WITH HEADER LINE.
    DATA : month_names LIKE t247 OCCURS 0 WITH HEADER LINE.
    DATA :i(2),             "month
          y TYPE int4,      "year
          c(4),
          v_bill LIKE bseg-dmbtr. " bill value
    DATA :  pos TYPE sy-tabix,
            month(99),
            month1(99).
    data:sl_no(3) value 0.
    *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.
    DATA:itprintparams TYPE slis_print_alv.
    DATA:itvariant TYPE disvariant.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS     : p_bukrs LIKE t001-bukrs OBLIGATORY. "Company code
    SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr, "Vendor name
                     s_budat for sy-datum  obligatory,            "bkpf-budat OBLIGATORY,     "Date
                     s_gjahr FOR bseg-gjahr NO-DISPLAY.
    SELECTION-SCREEN END  OF BLOCK b1.
    AT SELECTION-SCREEN.
      SELECT SINGLE bukrs
                   INTO t001-bukrs
                   FROM t001
                   WHERE bukrs = p_bukrs.
      IF sy-subrc <> 0.
        MESSAGE e000(z_ma) WITH 'Invalid Company Code'.
      ENDIF.
      IF NOT s_lifnr[] IS INITIAL.
        SELECT SINGLE lifnr
                      INTO lfa1-lifnr
                      FROM lfa1
                      WHERE lifnr IN s_lifnr.
        IF  sy-subrc <> 0.
          MESSAGE e000(z_ma) WITH 'Invalid Vendor'.
        ENDIF.
      ENDIF.
    START-OF-SELECTION.
    *13
    if s_budat is not initial.
      if s_budat-high is not initial.
          while s_budat-low le s_budat-high.
                i = s_budat+7(2).
                if i > 3.
                    s_gjahr = s_budat+3(4).
                    append s_gjahr.
                else.
                    c = s_budat+3(4).
                    S_GJAHR = C - 1.
                    append  s_gjahr.
                endif.
                s_budat-low = s_budat-low + 1.
          endwhile.
       else.
          i = s_budat+7(2).
          if i > 3.
            s_gjahr = s_budat+3(4).
            append s_gjahr.
          else.
            c = s_budat+3(4).
            S_GJAHR = C - 1.
            append  s_gjahr.
         endif.
       endif.
    endif.
    *13
    SELECT bukrs belnr gjahr awkey bldat budat
               INTO TABLE it_bkpf
               FROM bkpf
               WHERE bukrs = p_bukrs
               AND   budat IN s_budat
               and   gjahr = s_gjahr. "13
      IF NOT it_bkpf[] IS INITIAL.
      SELECT bukrs belnr dmbtr wrbtr hkont ebeln lifnr
                   FROM  bseg
                   INTO CORRESPONDING FIELDS OF TABLE it_bseg
                   FOR   ALL ENTRIES IN it_bkpf
                   WHERE bukrs = it_bkpf-bukrs
                   and   belnr = it_bkpf-belnr
                   AND   gjahr = s_gjahr                            "13-it_bkpf-gjahr
                   AND   koart = 'K'.
      ENDIF.
    IF NOT it_bseg[] IS INITIAL.
    SELECT belnr gjahr dmbtr wrbtr hkont ebeln lifnr
                      FROM  bseg
                      INTO CORRESPONDING FIELDS OF TABLE it_bseg1
                      FOR   ALL ENTRIES IN it_bkpf
                      WHERE bukrs = it_bkpf-bukrs                    "13it_bkpf-bukrs
                      AND   belnr = it_bkpf-belnr                    "13it_bkpf-belnr
                      AND   gjahr = s_gjahr.                         "13-it_bkpf-gjahr.
      ENDIF.
    LOOP AT it_bkpf.
    MOVE-CORRESPONDING it_bkpf TO itfinal.
    APPEND itfinal.
    ENDLOOP.
    LOOP AT it_bseg.
    MOVE-CORRESPONDING it_bseg TO itfinal.
    append itfinal.
    select single name1 ort01 from lfa1 into (itfinal-name1 , itfinal-ort01) where lifnr = it_bseg-lifnr.
    select single  j_1icstno  j_1ilstno into (itfinal-j_1icstno , itfinal-j_1ilstno) from j_1imovend
        where lifnr = it_bseg-lifnr.
    ENDLOOP.
    LOOP AT it_bseg1.
    MOVE-CORRESPONDING it_bseg1 TO itfinal.
    APPEND itfinal.
    ENDLOOP.
    loop at it_bseg1.
    itfinal-ebeln1 = it_bseg1-ebeln.
    append itfinal.
    endloop.
    *Deleting the records from ITFINAL w.r.t HKONT.
    <b>LOOP AT itfinal.
    IF itfinal-hkont  NE   '0020106230' AND
       itfinal-hkont  NE    '0020106330'.
    DELETE itfinal.
    endif.
    clear itfinal.
    ENDLOOP.</b>
    *Caluculating Bill Value
    loop at itfinal.
    if itfinal-hkont =     '0020106230'.
    itfinal-tdsrate = '2%'.
    itfinal-vbill = itfinal-wrbtr * 100 / 2.
    modify itfinal.
    elseif itfinal-hkont = '0020106330'.
    itfinal-tdsrate = '4%'.
    itfinal-vbill = itfinal-wrbtr * 100 / 4.
    modify itfinal.
    endif.
    endloop.
    sort itfinal by belnr.
    delete adjacent duplicates from itfinal comparing belnr.
    format reset.
    format color col_normal.
    LOOP AT itfinal.
    sl_no = sl_no + 1.
    write:/ sy-vline,
             2  sl_no,
             7  sy-vline,
             10 itfinal-ebeln1,
             21 sy-vline,
             23 itfinal-awkey,
             44 sy-vline,
             45 itfinal-bldat,
             57 sy-vline,
             60 itfinal-vbill,
             75 sy-vline,
             76 itfinal-tdsrate,
             85 sy-vline,
             89 itfinal-wrbtr,
             106 sy-vline,
             109 itfinal-belnr,
             121 sy-vline,
             124 itfinal-budat,
             134 sy-vline.
    ENDLOOP.
    write:/ sy-uline.
    top-of-page.
    data : name1(60).
    data : month_text(127),
            string(99).
      call function 'MONTH_NAMES_GET'
       exporting
         language                    = sy-langu
    IMPORTING
      RETURN_CODE                 =
        tables
          month_names                 = month_names[]
       exceptions
         month_names_not_found       = 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.
      format reset.
      format color col_positive.
      if not s_budat-low is initial .
        read table month_names with key mnr =  s_budat-low+4(2).
        if sy-subrc = 0.
          month = month_names-ltx.
          string = 'Details of TDS (2% / 4%) On Works Contract Deducted'.
          concatenate string  'for the  Month of'  month into month_text
          separated by space.
          write :/ month_text.
          skip 1.
        endif.
      endif.
      concatenate itfinal-name1 ',' itfinal-ort01
                       into name1 separated by space.
      write :/ 'Vendor Code           :', itfinal-lifnr.
      write :/ 'Vendor Name and City  :', name1.
      skip 1.
      write :/ 'TNGST Registration No :', itfinal-j_1ilstno,
             / 'CST Registration No   :', itfinal-j_1icstno.
      skip 1.
    Display the coloumn headings
      format reset.
      format color col_heading.
      write :/ sy-uline.
      write:/ sy-vline,
             2  'Sl_no',
             7 sy-vline,
             10 'P.O. No',
             21 sy-vline,
             22 'Invoice No',
             44 sy-vline,
             45 'Inv Date',
             57 sy-vline,
             60 'Bill value',
             75 sy-vline,
             76 'TDS Rate',
             85 sy-vline,
             89 'TDS Amount' ,
             106 sy-vline,
             108 'Doc.No.',
             121 sy-vline,
             125 'Pos Date',
             134 sy-vline,
      sy-uline.
    K.Kiran.

    Kiran,
    I am pasting code here and i am sure that the code should work now
    REPORT zf14 no standard page heading line-size 134. .
    TABLES: bkpf,bseg,lfa1,t001.
    type-pools:slis.
    TYPES : BEGIN OF x_bkpf,
    bukrs TYPE bkpf-bukrs, " Company Code
    belnr TYPE bkpf-belnr, " Document Number
    gjahr TYPE bkpf-gjahr, " Fiscal year
    awkey TYPE bkpf-awkey, " Object Key
    bldat TYPE bkpf-bldat,
    budat TYPE bkpf-budat,
    END OF x_bkpf.
    TYPES : BEGIN OF x_bseg,
    bukrs TYPE bseg-bukrs, " Company Code
    belnr TYPE bseg-belnr, " Document Number
    gjahr TYPE bseg-gjahr, " Fiscal Year
    koart TYPE bseg-koart,
    hkont TYPE bseg-hkont, " G/L Account
    ebeln TYPE bseg-ebeln, " Purchasing Document
    lifnr TYPE bseg-lifnr, " Vendor Code
    name1 type lfa1-name1,
    ort01 type lfa1-ort01,
    END OF x_bseg.
    TYPES : BEGIN OF x_bseg1,
    bukrs TYPE bseg-bukrs, " Company Code
    belnr TYPE bsak-belnr, " Document Number
    gjahr TYPE bsak-gjahr, " Fiscal Year
    hkont TYPE bseg-hkont, " G/L Account
    ebeln TYPE bseg-ebeln, " Purchasing Document
    lifnr TYPE bseg-lifnr, " Vendor Code
    wrbtr TYPE bseg-wrbtr, " Amt.in Doc.Curr
    END OF x_bseg1.
    types:begin of x_ven,
    name1 type lfa1-name1,
    ort01 type lfa1-ort01,
    end of x_ven.
    TYPES : BEGIN OF x_final,
    bukrs TYPE bkpf-bukrs, " Company Code
    belnr TYPE bkpf-belnr, " Document Number
    gjahr TYPE bkpf-gjahr, " Fiscal year
    blart TYPE bkpf-blart, " Document Type
    awkey TYPE bkpf-awkey, " Object Key
    bldat TYPE bkpf-bldat,
    budat TYPE bkpf-budat,
    mwskz TYPE bseg-mwskz,
    qsskz TYPE bseg-qsskz,
    wrbtr TYPE bseg-wrbtr, " Amount in Doc Curr
    werks TYPE bseg-werks, " Recv Facility Code
    hkont TYPE bseg-hkont, " G/L Account
    ebeln TYPE bseg-ebeln, " Purchasing Document
    ebeln1 type bseg-ebeln,
    lifnr TYPE bseg-lifnr, " Vendor Code
    lifnr1 type bseg-lifnr,
    dmbtr TYPE bseg-dmbtr,
    wrtbr type bseg-wrbtr,
    vbill type bseg-wrbtr,
    tdsamt type c,
    tdsrate(4),
    shkzg TYPE bseg-shkzg,
    name1 TYPE lfa1-name1, "vendor Name
    ort01 TYPE lfa1-ort01, "City
    j_1icstno TYPE j_1imovend-j_1icstno, "CST
    j_1ilstno TYPE j_1imovend-j_1ilstno ,"LST
    END OF x_final.
    DATA : it_bkpf TYPE TABLE OF x_bkpf WITH HEADER LINE .
    DATA : it_bseg TYPE TABLE OF x_bseg WITH HEADER LINE .
    DATA : it_bseg1 TYPE TABLE OF x_bseg1 WITH HEADER LINE .
    DATA : itfinal TYPE TABLE OF x_final WITH HEADER LINE.
    DATA : month_names LIKE t247 OCCURS 0 WITH HEADER LINE.
    DATA :i(2), "month
    y TYPE int4, "year
    c(4),
    v_bill LIKE bseg-dmbtr. " bill value
    DATA : pos TYPE sy-tabix,
    month(99),
    month1(99).
    data:sl_no(3) value 0.
    *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.
    DATA:itprintparams TYPE slis_print_alv.
    DATA:itvariant TYPE disvariant.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : p_bukrs LIKE t001-bukrs OBLIGATORY. "Company code
    SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr, "Vendor name
    s_budat for sy-datum obligatory, "bkpf-budat OBLIGATORY, "Date
    s_gjahr FOR bseg-gjahr NO-DISPLAY.
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN.
    SELECT SINGLE bukrs
    INTO t001-bukrs
    FROM t001
    WHERE bukrs = p_bukrs.
    IF sy-subrc <> 0.
    MESSAGE e000(z_ma) WITH 'Invalid Company Code'.
    ENDIF.
    IF NOT s_lifnr[] IS INITIAL.
    SELECT SINGLE lifnr
    INTO lfa1-lifnr
    FROM lfa1
    WHERE lifnr IN s_lifnr.
    IF sy-subrc <> 0.
    MESSAGE e000(z_ma) WITH 'Invalid Vendor'.
    ENDIF.
    ENDIF.
    START-OF-SELECTION.
    *13
    if s_budat is not initial.
    if s_budat-high is not initial.
    while s_budat-low le s_budat-high.
    i = s_budat+7(2).
    if i > 3.
    s_gjahr = s_budat+3(4).
    append s_gjahr.
    else.
    c = s_budat+3(4).
    S_GJAHR = C - 1.
    append s_gjahr.
    endif.
    s_budat-low = s_budat-low + 1.
    endwhile.
    else.
    i = s_budat+7(2).
    if i > 3.
    s_gjahr = s_budat+3(4).
    append s_gjahr.
    else.
    c = s_budat+3(4).
    S_GJAHR = C - 1.
    append s_gjahr.
    endif.
    endif.
    endif.
    *13
    SELECT bukrs belnr gjahr awkey bldat budat
    INTO TABLE it_bkpf
    FROM bkpf
    WHERE bukrs = p_bukrs
    AND budat IN s_budat
    and gjahr = s_gjahr. "13
    IF NOT it_bkpf[] IS INITIAL.
    SELECT bukrs belnr dmbtr wrbtr hkont ebeln lifnr
    FROM bseg
    INTO CORRESPONDING FIELDS OF TABLE it_bseg
    FOR ALL ENTRIES IN it_bkpf
    WHERE bukrs = it_bkpf-bukrs
    and belnr = it_bkpf-belnr
    AND gjahr = s_gjahr "13-it_bkpf-gjahr
    AND koart = 'K'.
    ENDIF.
    IF NOT it_bseg[] IS INITIAL.
    SELECT belnr gjahr dmbtr wrbtr hkont ebeln lifnr
    FROM bseg
    INTO CORRESPONDING FIELDS OF TABLE it_bseg1
    FOR ALL ENTRIES IN it_bkpf
    WHERE bukrs = it_bkpf-bukrs "13it_bkpf-bukrs
    AND belnr = it_bkpf-belnr "13it_bkpf-belnr
    AND gjahr = s_gjahr. "13-it_bkpf-gjahr.
    ENDIF.
    LOOP AT it_bkpf.
    MOVE-CORRESPONDING it_bkpf TO itfinal.
    APPEND itfinal.
    ENDLOOP.
    LOOP AT it_bseg.
    MOVE-CORRESPONDING it_bseg TO itfinal.
    append itfinal.
    select single name1 ort01 from lfa1 into (itfinal-name1 , itfinal-ort01) where lifnr = it_bseg-lifnr.
    select single j_1icstno j_1ilstno into (itfinal-j_1icstno , itfinal-j_1ilstno) from j_1imovend
    where lifnr = it_bseg-lifnr.
    ENDLOOP.
    LOOP AT it_bseg1.
    MOVE-CORRESPONDING it_bseg1 TO itfinal.
    APPEND itfinal.
    ENDLOOP.
    loop at it_bseg1.
    itfinal-ebeln1 = it_bseg1-ebeln.
    append itfinal.
    endloop.
    *Deleting the records from ITFINAL w.r.t HKONT.
    LOOP AT itfinal.
    IF itfinal-hkont NE '0020106230' AND
    itfinal-hkont NE '0020106330'.
    DELETE itfinal.
    clear itfinal.
    continue.
    else.
    clear itfinal.
    endif.
    ENDLOOP.
    *Caluculating Bill Value
    loop at itfinal.
    if itfinal-hkont = '0020106230'.
    itfinal-tdsrate = '2%'.
    itfinal-vbill = itfinal-wrbtr * 100 / 2.
    modify itfinal.
    elseif itfinal-hkont = '0020106330'.
    itfinal-tdsrate = '4%'.
    itfinal-vbill = itfinal-wrbtr * 100 / 4.
    modify itfinal.
    endif.
    endloop.
    sort itfinal by belnr.
    delete adjacent duplicates from itfinal comparing belnr.
    format reset.
    format color col_normal.
    LOOP AT itfinal.
    sl_no = sl_no + 1.
    write:/ sy-vline,
    2 sl_no,
    7 sy-vline,
    10 itfinal-ebeln1,
    21 sy-vline,
    23 itfinal-awkey,
    44 sy-vline,
    45 itfinal-bldat,
    57 sy-vline,
    60 itfinal-vbill,
    75 sy-vline,
    76 itfinal-tdsrate,
    85 sy-vline,
    89 itfinal-wrbtr,
    106 sy-vline,
    109 itfinal-belnr,
    121 sy-vline,
    124 itfinal-budat,
    134 sy-vline.
    ENDLOOP.
    write:/ sy-uline.
    top-of-page.
    data : name1(60).
    data : month_text(127),
    string(99).
    call function 'MONTH_NAMES_GET'
    exporting
    language = sy-langu
    IMPORTING
    RETURN_CODE =
    tables
    month_names = month_names[]
    exceptions
    month_names_not_found = 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.
    format reset.
    format color col_positive.
    if not s_budat-low is initial .
    read table month_names with key mnr = s_budat-low+4(2).
    if sy-subrc = 0.
    month = month_names-ltx.
    string = 'Details of TDS (2% / 4%) On Works Contract Deducted'.
    concatenate string 'for the Month of' month into month_text
    separated by space.
    write :/ month_text.
    skip 1.
    endif.
    endif.
    concatenate itfinal-name1 ',' itfinal-ort01
    into name1 separated by space.
    write :/ 'Vendor Code :', itfinal-lifnr.
    write :/ 'Vendor Name and City :', name1.
    skip 1.
    write :/ 'TNGST Registration No :', itfinal-j_1ilstno,
    / 'CST Registration No :', itfinal-j_1icstno.
    skip 1.
    Display the coloumn headings
    format reset.
    format color col_heading.
    write :/ sy-uline.
    write:/ sy-vline,
    2 'Sl_no',
    7 sy-vline,
    10 'P.O. No',
    21 sy-vline,
    22 'Invoice No',
    44 sy-vline,
    45 'Inv Date',
    57 sy-vline,
    60 'Bill value',
    75 sy-vline,
    76 'TDS Rate',
    85 sy-vline,
    89 'TDS Amount' ,
    106 sy-vline,
    108 'Doc.No.',
    121 sy-vline,
    125 'Pos Date',
    134 sy-vline,
    sy-uline.
    Thanks
    seshu

  • Table activation problem after deleting ariw from table

    Hi,
    I have inserted a new field(xxxx) into custom table and activated it..
    But ,when i tried to enter values for this new field in se16,this  field doesnt exist there.But in se11 i was able to view..
    So i deleted that field from tht table and inserted again,,
    Now iam geting message that
    xxxx field was deleted
    Alter table is not possible..
    Diagnosis shows that
    The structure of the table changed at field level. This change requires a conversion of the table. This situation can occur for example if the data type or field length of the domain upon which the field is based was changed. A conversion is also generally necessary if the key of the table changed.
    Procedure
    Convert the table using the Database Utility (SE14).
    Can you people let me know how i can cahge the table ..
    Regards
    parnith..

    Hi Parnith,
    Suppose you have entered a new field (or deleted a field) in your table in SE11(and table already contains data).
    Now, your next step should be activating that table first.
    For that :
    1. Just click on save.
    2. Goto Utilities -> Database Utility.
        Click on that.
    3. Click on Activate and Adjust database.
    Now you will see your field added to your table.
    Now you can simply Goto contents of the table and modify the records and fill the newly added field for each record.
    Hope it helps.
    Regards
    Hemant Khemani
    Edited by: Hemant Khemani on Apr 25, 2008 10:09 AM

  • Try to shrink datafiles after deleting huge amount of records

    Dear Sir;
    I have deleted more than 50 million records along with table’s partitions for the previous year.
    now I'm trying to shrink datafile with more than 10GB free space but still unable to delete due to
    ORA-03297: file contains used data beyond requested RESIZE value.
    How can we shrink these datafile or otherwise what is the best way to delete huge amount of records and get additional space in HD
    Thanks and best regards
    Ali Labadi

    Hi,
    You could see this article of Jonathan LEWIS:
    http://jonathanlewis.wordpress.com/2010/02/06/shrink-tablespace

  • Recording from Record Player

    I was recording music from Record Player to LP; lost sound, reinstalled Drivers, still nothing, Please Help!

    Hi,
    How do you connect them ? What is "from Record Player" and what is "to LP" ? To help us answer question quicker, please read this:
       http://h30434.www3.hp.com/t5/First-Time-Here-Learn-How-to/Welcome-Get-started-here/td-p/699035
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

Maybe you are looking for

  • WD 400 GB external hard drive doesn't mount after software update.

    I had been using my WD external hard drive with TimeMachine for almost a year. Just recently the WD doesn't show up on desktop, however you can see it under the Apple's "System Profiler". Any suggestions? External HDD: Removable Media: No Detachable

  • The Sims 3 [Island Paradise] - Game Doesn't Even Start (Please HELP)

    I recently re-installed the Sims 3 and 3 expansion packs with it (Pets, Seasons & Island Paradise) on my new computer (MacBook Pro 13' - 2012). I downloaded so many stuff from thesimsresource.com page but the game didn't show up any problem (picture

  • After deleting enhanced view still the bsp application is showing in se80

    Hi, I enhanced one component then after some reason i deleted the enhanced view at that time it's asked do you want to delete bsp application i click on yes then after also still i showing in se 80 under my package it's showing. after deleting enhanc

  • Null character removal in sap using a function module

    Little background : 1) we are using a lot of interfaces with legacy and the data in sap has null characters for example : phone#123 . the prob is not on sap side but on bw side when i extract this data it converts to hex format and the load fails. 2)

  • Firefox hangs and freezes the moment i start it.

    Firefox hangs and freezes the moment i start it (9 out of 10 times it freezes). I have reinstalled it but still it freezes. I removed the antivirus (avira) and firewall (comodo) but no change. Can't even enter safe mode it hangs. os win7 x64, amd fx