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

Similar Messages

  • How to refresh after delete the records in ALV report ?

    Hi Friends,
    How to refresh after delete the records in ALV report.
    I am deleting records in ALV report .
    After successful delete the screen should refresh.
    u201C Deleted records should not appear in the screen u201C.
    Please guide me.
    Regards,
    Subash

    Hi subhash,
    FORM user_command USING r_ucomm LIKE sy-ucomm      rs_selfield TYPE slis_selfield.
    WHEN 'BACK'.
    Refresh the internal table from the ALV grid
          PERFORM update_alv_tab.
    ENDFORM.                    "user_command
    FORM update_alv_tab .
      DATA :  e_grid TYPE REF TO cl_gui_alv_grid.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = e_grid.
      CALL METHOD e_grid->check_changed_data.
      "update_alv_tab
      CALL METHOD e_grid->refresh_table_display.
    ENDFORM.                    " UPDATE_ALV_TAB
    Then see in Debug mode is it updating or not..
    Please confirm .
    And please paste the code if you can.
    Regards.

  • Sending email after deleting the records in a table

    Hi
    I am deleting the records in a table. After deleting the records,
    i want to send an email to another person. I am planning to follow this steps.
    1. Create a trigger on the table(AFTER DELETE ON table FOR EACH ROW)
    to copy the deleted records to temporary table.
    2. Read the temporary table and send an email.
    Is there any other way we can do with out creating temporary table ?.
    Govind

    I don't know what you plan to use to send the mail but here's a solution that would work.
    -- Create a send mail procedure
    create or replace procedure send_mail (
    sender      IN VARCHAR2,
    recipient   IN VARCHAR2,
    message     IN VARCHAR2)
    IS
      mailhost VARCHAR2(30) := 'localhost';
      mail_conn utl_smtp.connection;
    BEGIN
    mail_conn :=  utl_smtp.open_connection(mailhost, 25);
      utl_smtp.helo(mail_conn, mailhost);
      utl_smtp.mail(mail_conn, sender);
      utl_smtp.rcpt(mail_conn, recipient);
      utl_smtp.data(mail_conn, message);
      utl_smtp.quit(mail_conn);
    END;
    /-- Create the trigger to email deleted rows
    create or replace trigger email_del_rows
    after delete on <table>
    for each row
    declare
    msg varchar2(2000);
    begin
    msg := 'COL1  COL2  COMPANY NAME  DATE'||chr(10);
    msg := msg||:old.col1||'    '||:old.col2||'    '||:old.company_name||'       '||:old_date|| chr(10);
    msg := msg||'END OF FILE';
    send_mail('SENDER','[email protected]',msg);
    end;
    /You can make it look pretty but you get the basic idea.

  • 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

  • DELETING THE RECORDS IN THE FORM

    Dear Friends
    I have a problem for deleting the records in my form
    on the form I have button for deleting the record
    and this button has
    when-button-pressed trigger
    And it has this contains
    Do_Key('DELETE_RECORD');
    COMMIT_FORM;
    The system displayed this message after pressing the delete button
    FRM-40400 : transaction complete: 1 record applied and saved
    But when I inquiry, about this record it is not deleted .
    Can any one tell me why the record is not deleted .
    I am using this version of form
    Forms [32 Bit] Version 6.0.8.11.3 (Production)
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining
    waiting for your valuable replay.
    Best regards
    Jamil

    Dear Pavel
    Yes the ON-DELETE trigger , it is exists in the block ,and because of that, it was not saving the deleted record and this code was in the
    on-delete trigger
    DECLARE
         V_LOC VARCHAR(25);
    BEGIN
    SELECT CAR_NO INTO V_LOC
    FROM CAR_FILE
    WHERE CAR_NO = :J_CAR_NO ;
    IF V_LOC IS NOT NULL THEN
    UPDATE CAR_FILE
    SET CAR_STATUS =2
    WHERE CAR_NO = :J_CAR_NO;
    ELSE
    NULL;
    END IF;
    END ;
    Why it is not working with ON-DELETE TRIGGER
    But it is working with POST-DELETE TRIGGER.
    Best regards
    jamil

  • Problem in deleting the message after reading

    Hi
    I m having some problem to delete the message after reading.
    i read the FAQ, and there is only one question regarding to delete that i have tried but its not working
    As my application required that message should be deleted after the processing.
    Please help me out asap
    Thank in advance.

    now here is the protocol trace from starting to the end point
    with the settings of
    session.setDebug(true);
    and
    folder.close(true);
    POP3: connecting to host "172.xx.xx.xx", port 110
    S: +OK Microsoft Exchange Server 2003 POP3 server version 6.5.6944.0 (xxxxx.xyz.com) ready.
    C: USER test1
    S: +OK
    C: PASS Password
    S: +OK User successfully logged on.
    C: STAT
    S: +OK 1 548
    Total messages = 1
    New messages = 0
    ================================
    C: TOP 1 0
    S: +OK
    Received: from yyyyyy ([172.xx.xx.xx]) by xxxxx.xyz.com with Microsoft SMTPSVC(6.0.3790.3959);
         Thu, 11 Sep 2008 12:21:14 +0530
    Message-ID: <3373112.1221115884647.JavaMail.284528@yyyyyy>
    From: [email protected]
    To: [email protected]
    Subject: testing
    Mime-Version: 1.0
    Content-Type: text/plain
    Content-Transfer-Encoding: 7bit
    Return-Path: [email protected]
    X-OriginalArrivalTime: 11 Sep 2008 06:51:14.0500 (UTC) FILETIME=[C8892840:01C913DA]
    Date: 11 Sep 2008 12:21:14 +0530
    C: LIST 1
    S: +OK 1 548
    ------------STARTING LINE------------
    MESSAGE #1:
    From: [email protected]
    To: [email protected]
    Subject: testing
    SendDate: Thu Sep 11 12:21:14 IST 2008
    CONTENT-TYPE: text/plain
    This is plain text
    ------------TEXT------------
    C: RETR 1
    S: +OK
    Received: from yyyyyy ([172.xx.xx.xx]) by xxxxx.xyz.com with Microsoft SMTPSVC(6.0.3790.3959);
         Thu, 11 Sep 2008 12:21:14 +0530
    Message-ID: <3373112.1221115884647.JavaMail.284528@yyyyyy>
    From: [email protected]
    To: [email protected]
    Subject: testing
    Mime-Version: 1.0
    Content-Type: text/plain
    Content-Transfer-Encoding: 7bit
    Return-Path: [email protected]
    X-OriginalArrivalTime: 11 Sep 2008 06:51:14.0500 (UTC) FILETIME=[C8892840:01C913DA]
    Date: 11 Sep 2008 12:21:14 +0530
    ------------TEXT------------
    ******************MESSAGE ENDING LINE*****************
    C: QUIT
    S: +OK Microsoft Exchange Server 2003 POP3 server version 6.5.6944.0 signing off.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • After deletion of record the dialog page is coming back to source page

    Dear all
    Good Morning
    i have creation page user will enter it will call to view mode,in that user will click on edit button again it will call to creation page with editable mode.
    in that creation page editable mode user click on delete button it willl call to dialog page buttons "Yes" AND "NO"
    user will click on yes the record is deleted but again after deletion of record again it is calling to creation page and creating blank record
    but my requirement is after click on yes button it will delete the record and navigate to search page
    how is it?
    in my case again it is coming to creation page.
    /*in edit page user click on delete button it will call to dialog page*/
    if ("Delete".equals(pageContext.getParameter(EVENT_PARAM)))
    String oid = pageContext.getParameter("oid");
    OAException msg = new OAException("PO", "XX_DELETE_SUPPSITE_CONFIRM");
    OADialogPage dpage =
    new OADialogPage(OAException.WARNING, msg, null, "", "");
    dpage.setOkButtonToPost(true);
    dpage.setOkButtonLabel("Yes");
    dpage.setOkButtonItemName("DeleteYes");
    dpage.setPostToCallingPage(true);
    dpage.setNoButtonToPost(true);
    dpage.setNoButtonItemName("DeleteNo");
    Hashtable ht = new Hashtable(1);
    ht.put("d1", oid);
    dpage.setFormParameters(ht);
    pageContext.redirectToDialogPage(dpage);
    /*If user click on No button it will call to editable mode*/(previuos page)
    if(pageContext.getParameter("DeleteNo")!=null)
    System.out.println("User will click on this button....");
    String oppoid = (String)pageContext.getSessionValue("xxoppoid");
    HashMap hp=new HashMap();
    hp.put("Purpose","Edit");
    hp.put("oppoid",oppoid);
    pageContext.setForceForwardURL("OA.jsp?page=/crm/oracle/apps/xxcrm/crmmgmt/quotationmgmt/webui/xxcrmquotationcreationPG",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null, hp, false, null,
    OAWebBeanConstants.IGNORE_MESSAGES);
    /*if user will click on delete yes button*/ after delete i want to call search page but it is going to search page internally it is coming to creation page and blank record is created.*/
    if (pageContext.getParameter("DeleteYes") != null)
    String s1 = pageContext.getParameter("d1");
    am.xxDeleteQuotation(s1);
    pageContext.setForceForwardURL("OA.jsp?page=/crm/oracle/apps/xxcrm/crmmgmt/quotationmgmt/webui/xxcrmquotationsearchPG",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null, null, true, null,
    OAWebBeanConstants.IGNORE_MESSAGES);
    I hope u understand my question
    Regards
    Sreekanth

    Hi Gaurav,
    Already i am using what u saying that way.
    That way also,am getting the error
    My Co Code is,
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    xxcrmItemMgmtAMImpl am = (xxcrmItemMgmtAMImpl)pageContext.getApplicationModule(webBean);
    String valid = pageContext.getParameter("Dialog");
    System.out.println("the value of valid is"+valid);
    if(valid!=null)
    pageContext.setForwardURL("OA.jsp?page=/crm/oracle/apps/xxcrm/crmmgmt/quotationmgmt/webui/xxcrmItemsAddPG",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,null,false,OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
    OAWebBeanConstants.IGNORE_MESSAGES);
    String itemid=pageContext.getParameter("itemid");
    pageContext.putSessionValue("itemid",itemid);
    System.out.println("the item id in additem viewco is"+itemid);
    am.xxeditAddItem(itemid);
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    xxcrmItemMgmtAMImpl am = (xxcrmItemMgmtAMImpl)pageContext.getApplicationModule(webBean);
    if("Delete".equals(pageContext.getParameter(EVENT_PARAM))) {
    String itemid=pageContext.getSessionValue("itemid").toString();
    OAException msg=new OAException("PO","XX_DELETE_SUPPSITE_CONFIRM");
    OADialogPage dpage=new OADialogPage(OAException.WARNING,
    msg,null,"","");
    System.out.println("this is delete block1");
    dpage.setOkButtonToPost(true);
    dpage.setOkButtonLabel("Yes");
    dpage.setOkButtonItemName("DeleteYes");
    dpage.setPostToCallingPage(true);
    dpage.setNoButtonToPost(true);
    Hashtable ht=new Hashtable();
    ht.put("d1",itemid);
    dpage.setFormParameters(ht);
    pageContext.redirectToDialogPage(dpage);
    System.out.println("this is delete block2");
    if(pageContext.getParameter("DeleteYes")!=null) {
    String itemid=pageContext.getParameter("d1");
    Serializable[] d1={itemid};
    am.invokeMethod("xxDeleteItem",d1);
    HashMap hm=new HashMap();
    hm.put("Dialog","Yes");
    String test=hm.get("Dialog").toString();
    System.out.println("the dialog page value is"+test);
    pageContext.forwardImmediatelyToCurrentPage(hm,false,null);
    }

  • SERIOUS PROBLEM! I need to reinstall quicktime after deleting the .app

    I am trying to reinstall quicktime that came with my macbook pro, after deleting the quicktime.app file and the folders in the library.
    You might ask why I did this? I have quicktime pro to install, but it's version 7.1.1, and would NOT install over 7.1.2; I messed up though, I know that now.
    How do I fix it? Trying to reinstall quicktime 7.1.2 that I downloaded just crashes the installer.
    Thanks!

    No, I have not deleted the Quicktime712.pkg from Library/Receipts. Should I do this, or put the OSX disk back in the drive and then run the package that is in my Receipts folder?
    I run software update religiously, so I know that is not an issue.
    Thanks for the info, hopefully what I told you helps narrow the problem a bit.

  • Regarding how to delete the record in internal table

    Hi experts ,
    how to delete the record in intarnal table after validating the data,
    if record contains invalid fields?
    i am giving my code see this and give me the answer?
    loop at it_data into wa_data .
    Validate  Cost Center
        READ TABLE it_kostl INTO wa_kostl WITH KEY kostl = wa_data-kostl BINARY SEARCH.
        IF sy-subrc NE 0.
          PERFORM update_error_log USING wa_data
                                         text-004.
        ENDIF.
    Validate source file material ( material number )
    loop at it_mara into wa_mara .
      read table it_ausp into wa_ausp with key atwrt = wa_data-i_matnr .
               if sy-subrc NE 0 .
       PERFORM update_error_log USING wa_data
                                           text-002.
    delete it_data-objek .
         else.
      read table it_mara into wa_mara with key  matnr = wa_ausp-objek .
           if sy-subrc EQ 0 .
           wa_data-objek = wa_mara-matnr.
           wa_data-matkl = wa_mara-matkl.
         ENDIF.
         Modify it_data from wa_data  .
      endif.
    *endloop.
    Validate unit of measure (unit)
        READ TABLE it_t006 INTO wa_t006 WITH KEY msehi = wa_data-unit .
        IF sy-subrc NE 0.
          PERFORM update_error_log USING wa_data
                                         text-003.
        endif.
    Validate delivery location ( storage location )
        READ TABLE it_lgort INTO wa_lgort WITH KEY del_loc = wa_data-del_loc.
        IF sy-subrc NE 0.
          PERFORM update_error_log USING wa_data
                                         text-001.
             if wa_data-flag ='x' .
          delete it_data from  wa_data .
        endif.
        ENDIF.
    endloop.

    Hi Naren,
    First get the index number of the IT_data table and store it in one variable whose declaration like this.
    data: tabix type sy-tabix.
    while reading the internal table it_data set the tabix variable.
    tabix = sy-tabix.
    Instead of  the above use below one.
    Delete it_data-objek
    Use the Below statement it will delete  the row from the internal table.
    Delete it_data-objek index tabix
    Thanks,
    Chidanand

  • The Creative Cloud application becomes inoperable continually on both my Windows 7 and 8.1 operating systems. I'm tired of re installing the application after deleting the OOBE file to get updates and syn settings between computers for Photoshop. Is this

    The Creative Cloud application becomes inoperable continually on both my Windows 7 and 8.1 operating systems. I'm tired of re installing the application after deleting the OOBE file to get updates and syn settings between computers for Photoshop. Is this an endemic problem with others? I'm using Google Chrome as my browser. Is this an issue with the problem?

    Similar problem just happened to me with the Creative Cloud Update 1.7.1.418—slightly different so I thought I'd share. I have multiple Adobe Creative Cloud programs installed on my computer, all working just fine. I updated the Cloud App to the latest version and then it shows me that I have only one program installed! All my previously installed programs (Photoshop and the like) still work but show as "install" instead of "Up to date". Initially I thought I'd have to re-install the Cloud app or recreate the OPM data base but then I noticed that some of the Cloud app preferences (Apps > Settings > App Language) were different to what I had set previously. I use English (International) language, the update had reverted the app back to English (North American). I flicked back to my previous language and bam, all my apps now show as being installed correctly.

  • Problem in deleting the orders under Custom category.

    Hi friends,
            I am facing some problem in deleting the Orders which were created under custom category. In fact we are creating Intransits under Standard category "EI" as well as Custom Category "ZP". I am able to modify the intransits created under "EI" but when I tried to change or delete the orders created under Category "ZP", I am getting a messag triggered by BAPI as " Order can not be changed". atleast I need to delete the order if change is not possible. I am using the BAPI "BAPI_SLSRVAPS_CREATEINTRANS" to create intransits under "EI" and i am using the same BAPI with BADI implementation to "SAPAPO_DM_PO_CHANGE" to create intransits under "ZP". Based on the condition I am changing the am changing the category from EI  to ZP in the BADI.
           I am able to change or delete the orders created under the EI but when I tried to change or delete the orders under ZP its giving me a message as Order can not be changed.
           One more thing is If I go to Tcode /SAPAPO/RLCDEL trying to delete all the orders based on category. I am able to see all the orders under created under EI. If  I tried to delete the orders based on Custom category ZI it is giving me the message  as "No Orders exists in Live cache". But I am able to see the orders in tcode "SAPAPO/RRP3".
           Can any one help me out in making this done. Please help me out in this.
    Thanks & Regards,
    Ramana.

    Hi Visu,
               I really appreciate your gr8 help. Hope you can understand my problem that I am not a SCM person. Still you are responding to my questions with great patience.
               Here what I found is I found the record in OM19 transaction in the object "/SAPAPO/OM_ORDER_EXT_STR". But the interesting is its giving me the GUID as blank . there is empty value in that field. where as the program "/SAPAPO/OM_DELETE_INCON_ORDERS" is asking for the "order GUID".
             can you help me out in finding the order guid and deleting this order.
    Regards,
    Ramana.

  • HT4897 I created an alias precisely because I wanted to make it the new default name and then quickly realized it wasn't possible. How long after deleting the alias will it become available again so that I can create a new account with it?

    I created an alias precisely because I wanted to make it the new default name and then quickly realized it wasn't possible. How long after deleting the alias will it become available again so that I can create a new account with it?
    I'm trying to make iCloud mail my primary email but I'm concerned that I may have lost the perfect email address forever.

    I have the same problem. After our wedding I've created an alias ([email protected]) to my actual AppleID Account ([email protected]). Now I'd the idea to delete the alias and my actual AppleID to create a new AppleID with ([email protected]).
    Is there really no possibilty to do this?
    Thanks in advance for quick and positive feedback.

  • Issue while playing the content of Azure Media Services after deleting the channel.

    Hi,
    We are having the issue while playing the content of Azure Media Services after deleting the channel.
    Please find detail scenarios below:
    We have done live streaming of an event using Azure Media Services, event was around 5-6 hrs. After completion of event channel was deleted, when we checked content data
    it was only 1hr. Content has only last 1 hr. recording, we are unable to get full recoding.
    We divided event into two parts to avoid above issue. After completion of 1st part which was of 2 hrs., we stopped the streaming and deleted the channel. New channel was
    created and streaming was started for 2<sup>nd</sup> part, after completion of event channel was deleted. Now we are unable to play the content data for 1st part but able to play the 2nd part of event through content publish URL.
    We have done streaming of 3 hrs. event on 18th April with same process and full recoding was available. 
    Can you let me know what might be the issue?

    Hi,
    Please refer to Justin’s blog and see if it helps:
    http://www.justinkobel.com/post/2012/04/30/SharePoint-2010-Claims%E2%80%93Operation-is-not-valid-due-to-the-current-state-of-the-object.aspx
    As suggested by Alex, please provide more information about your process of changing password.
    Here is an article for updating passwords on SharePoint 2010:
    http://blogs.technet.com/b/seanearp/archive/2011/01/25/updating-passwords-on-sharepoint-2010.aspx
    Regards,
    Rebecca Tu
    TechNet Community Support

  • DataScroller problem while delete the recoreds using checkbox

    Hi all
    I am new for jsf. I am using datascroller working with Tomahawk.My requirement like .
    I need to display 15 records in a page.And every row having checkbox which is used for delete the record.
    These are all working fine.Problem is if i delete all records in last page .The page is not going to previous page.
    The following is my xhtml code
    <h:panelGrid columns="2" style="width: 100% ">
              <h:outputText value="" style="width: 100%"/>
                   <t:dataScroller id="scroll_1"
              for="detailData"
                   styleClass="scroller"
                   style="align=right"
                   paginator="true"
                   paginatorActiveColumnStyle="font-weight:bold;"
                   displayedRowsCountVar="displayedRowsCount"
                   fastStep="10"
                   pageCountVar="pageCount"
                   pageIndexVar="pageIndex"
                   immediate="true"
                   paginatorMaxPages="9">
         </t:dataScroller>     
    </h:panelGrid>

    For Tomahawk specific questions, I would recommend posting to the myfaces user mailing list.
    Edited by: rlubke on Aug 7, 2008 1:19 PM

  • Delete the record

    Hi folks,
    I am trying to delete a record from pa0019. Of course I am not deleting the record directly but copying the existing record into the workarea and deletingit.
    However, query of selecting the record from table is not working.
    tables: pa0019.
    data: wa_pa0019 like pa0019 occurs 0 with header line.
    select single * from pa0019 into wa_pa0019 where pernr = 'v_pernr'
    and tmart = 'Z9' and termn = '07/07/2005'.
    delete pa0019 from wa_pa0019.
    I see a record for this employeeid in the table pa0019. why is not retrieving any record?  Am I missing something here?
    I know this is simple, and have done this before too, but not able to recall what is the problem here?
    Any thoughts,
    Thanks,
    SK

    Global variables inthe program
    DATA : RETURN LIKE BAPIRETURN1.
    DATA : KEY LIKE BAPIPAKEY.
    DATA : RETURNE LIKE BAPIRETURN1.
    data: begin of itab1 occurs 0,
                employee(8),
                reason_type(2),
                reason_code(2),
                return_date like sy-datum,
    end of itab1.
    I read the data into the internal table from an external text file, then I upload the record(RLOA) into actions infotype using BDC session, then I need to delete the record for the same employee in 0019.
    I think I am missing the RECORD parameter, hwo can i get that?
    loop at itab1.
    *** check to see whether there is a RLOA record for the employee
      select single * from pa0000 where pernr = itab1-employee and
           massn = 'z7' and begda = itab1-return_date.
    if sy-subrc = 0.
          error-employee = itab1-employee.
          error-reason = 'RLOA exists for the employee'.
          append error.
          continue.
        else.
        clear bdcdata.
        refresh bdcdata.
        perform load_data.
    If the RLOA record is created in Actions infotype delete
    the record in monitoring of tasks record in IT0019
         if g_monitoringflag = 'X'.
    format the date to mm/dd/yyyy
            v_returndate = itab1-return_date.
            concatenate v_returndate0(2) '/' v_returndate2(2) '/'
            v_returndate+4(4) into v_formatdate.
        CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
           EXPORTING
            NUMBER = itab1-employee
           IMPORTING
            RETURN = RETURNE.
        CALL FUNCTION 'HR_INFOTYPE_OPERATION'
           EXPORTING
             INFTY = '0019'
             NUMBER = itab1-employee
             SUBTYPE = 'Z9'
             VALIDITYEND = itab1-return_date
             VALIDITYBEGIN = itab1-return_date
             TMART ='Z9'
             TERMN = itab1-return_date
             OPERATION = 'DEL'
            TCLAS = 'A'
             DIALOG_MODE = '0'
         IMPORTING
            RETURN = RETURN
            KEY = KEY.
         IF RETURN IS NOT INITIAL.
           WRITE :/ 'Error Occurred'.
         ENDIF.
         CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
           EXPORTING
           NUMBER = itab1-employee.
          if sy-subrc = 0.
               clear:g_monitoringflag, v_formatdate.
               else.
              error-employee = itab1-employee.
              error-reason = 'No record created for RLOA'.
              clear:v_formatdate.
           endif.
         endif.
      endif.
    endloop.
    Thanks in advance for your help.
    SK

Maybe you are looking for