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.

Similar Messages

  • 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.

  • To add/delete the rows in ALV report outpout

    Hi,
    Is there any way by which we can  add/delete the rows in ALV report output.
    Thanks
    Ankul

    Hi,
    Try out this way:
    data: i_modified TYPE STANDARD TABLE OF mara,"For getting modified rows
            w_modified TYPE mara.
    CASE e_ucomm.
          WHEN 'EDIT'.
          perform save_database.
          CALL METHOD ref_GRID->REFRESH_TABLE_DISPLAY.
        ENDCASE.
    FORM SAVE_DATABASE .
    data: i_selected_rows TYPE lvc_t_row,                "Selected Rows
          w_selected_rows TYPE lvc_s_row.
    * Getting the selected rows index
        CALL METHOD ref_grid->get_selected_rows
                    IMPORTING  et_index_rows = i_selected_rows.
    * Through the index capturing the values of selected rows
        LOOP AT i_selected_rows INTO w_selected_rows.
        READ TABLE it_tab INTO wa_it_tab INDEX w_selected_rows-index.
        IF sy-subrc EQ 0.
          MOVE-CORRESPONDING wa_it_tab TO w_modified.
          APPEND w_modified TO i_modified.
        ENDIF.
      ENDLOOP.
      MODIFY mara FROM TABLE i_modified.
    Thanks,
    Krishna

  • 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

  • Deleting the record in AlV grid

    Hi frineds,
    In alv grid am displaying the records with sub total headings but the problem is, finally want display the
    subtotal value under that one blank line and next want display the total .but it is showing the total value in blank line and in total value field.can any if possible give the code..
    Thanks in advance.

    Hi,
    Sort your ALV report by workdate, or do sub total on the workdate,
    hope you will get teh desired out put.
    Cheers
    Manju

  • Delete the data in alv report

    Hi frnds,
    Ouput for alv
    matnr     desc     uom      alternative Uom
    10          scrb       kg           nos
    10          scrb       kg           EA
    But i want to display ths order (delete the duplicates of  second line item Except alternative UOM)
    matnr     desc     uom      alternative Uom
    10          scrb       kg           nos
    xx          xxxx      xx           EA
    Pls any one help me.
    Thanks in advance.

    Hi Kumar,
      Populate the Internal table for sorting as mentioned below and pass it to export structure IT_SORT of FM 'REUSE_ALV_GRID_DISPLAY' and then Just Declare ITAB and WA for grouping ( DATA :it_gr TYPE slis_t_sp_group_alv,   wa_gr LIKE LINE OF it_gr ) and pass it to exporting structure IT_SPECIAL GROUP of FM 'REUSE_ALV_GRID_DISPLAY' as shown below.
    This will display the output as you required but Without XX.
       wa_sort-fieldname = 'MATNR'.
        wa_sort-tabname = 'ITAB_NAME'.
        wa_sort-up = ' '.
        wa_sort-down = ' '.
        wa_sort-group = ' '.
        APPEND wa_sort TO it_sort.
        CLEAR wa_sort.
        wa_sort-fieldname = 'DESC'.
        wa_sort-tabname = 'ITAB_NAME'.
        wa_sort-up = ' '.
        wa_sort-down = ' '.
        wa_sort-group = ''.
        APPEND wa_sort TO it_sort.
        CLEAR wa_sort.
        wa_sort-fieldname = 'UOM'.
        wa_sort-tabname = 'ITAB_NAME'.
        wa_sort-up = ' '.
        wa_sort-down = ' '.
        wa_sort-group = ''.
        APPEND wa_sort TO it_sort.
        CLEAR wa_sort.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = repid
         is_layout                         = g_layout
         it_fieldcat                       = it_fieldcat
       it_special_groups                 = it_gr
       it_sort                           = it_sort
        TABLES
          t_outtab                          = ITAB_NAME
       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.

  • Problem is When  i click the record in alv report it has to go to Va02 tran

    Hi Everyone,
    When i click on sales order number it has to go to transaction code Va02 for that i wrote code as like this....
    *& Report  ZOPEN_SALES_ORDER
    Report  ZOPEN_SALES_ORDER1.
    TYPE-POOLs : slis.
    tables:kna1,mara.
    DATA       : FIELDCAT     TYPE SLIS_T_FIELDCAT_ALV.
    DATA       : IMPORT_VARIANT LIKE DISVARIANT.
    DATA       : XREPID         LIKE SY-REPID.
    DATA       : LAYOUT         TYPE SLIS_LAYOUT_ALV.
    DATA       : P_SORT TYPE STANDARD TABLE OF SLIS_SORTINFO_ALV.
    DATA       : I_EVENTS           TYPE SLIS_T_EVENT,
                 I_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
                 T_REPID LIKE SY-REPID.
    TYPES: BEGIN OF ty_report.
       INCLUDE STRUCTURE BAPIORDERS.
    TYPES: KDMAT TYPE VBAP-KDMAT,
           aedat TYPE sy-datum,
           MENGE TYPE BAPIORDERS-DLV_QTY,
      END OF ty_report.
    DATA: it_report TYPE STANDARD TABLE OF ty_report with HEADER LINE,
          wa_report TYPE ty_report.
    data: cust type BAPI1007-CUSTOMER,
          p_sales type BAPIORDERS-SALES_ORG,
          vbeln type vbap-vbeln.
    selection-screen begin of block bk1 with frame title text-001.
    PARAMETERS :p_cust type BAPI1007-CUSTOMER .
    *PARAMETERS p_sales type BAPIORDERS-SALES_ORG .
    PARAMETERS: p_matnr type mara-matnr.
    parameters: p_sd_doc type  BAPIORDERS-SD_DOC.
    PARAMETERS: p_date type BAPIORDERS-REQ_DATE.
    PARAMETERS: p_plant type vbap-werks.
    *PARAMETERS P_KDMAT TYPE VBAP-KDMAT.
    *PARAMETERS P_WERKS TYPE VBAP-WERKS.
    *PARAMETERS P_PO TYPE EKKO-ebeln.
    selection-screen end of block bk1.
    at SELECTION-SCREEN .
    if P_cust is  INITIAL and p_matnr is  INITIAL and P_sd_doc is  INITIAL
                           and P_date is  INITIAL  and p_plant is INITIAL.                 .
        message e000(0) with 'Please Fill At Least One Field '.
        endif.
      If p_cust is not INITIAL  .
            select single VKORG from vbak  into p_sales where kunnr eq p_cust.
             message 'Execute The Repport' Type 'E'.
        elseif p_matnr is not INITIAL .
         clear p_cust.
         clear p_sales.
          select single VBELN from vbap  into vbeln where matnr eq p_matnr.
            if vbeln is not INITIAL.
              SELECT single kunnr vkorg from vbak into (cust,p_sales) where vbeln eq vbeln.
                p_cust = cust.
                p_sales = p_sales.
           endif.
       elseif P_sd_doc is not INITIAL.
         clear p_cust.
         clear p_sales.
          SELECT single kunnr vkorg from vbak into (cust,p_sales) where vbeln eq P_SD_DOC.
                p_cust = cust.
                p_sales = p_sales.
       elseif p_date is not initial.
         clear vbeln.
         clear p_cust.
         clear p_sales.
          select single VBELN from vbep  into vbeln where EDATU eq p_date and POSNR = '10' and etenr = '0001'.
            if vbeln is not INITIAL.
                  SELECT single kunnr vkorg from vbak into (cust,p_sales) where vbeln eq vbeln.
                p_cust = cust.
                p_sales = p_sales.
                endif.
       elseif p_plant is not INITIAL.
         clear vbeln.
         clear p_cust.
         clear p_sales.
         select single VBELN from vbap  into vbeln where werks eq p_plant.
            if vbeln is not INITIAL.
                 SELECT single kunnr vkorg from vbak into (cust,p_sales) where vbeln eq vbeln.
                    p_cust = cust.
                p_sales = p_sales.
       endif.
       endif.
    INITIALIZATION.
    T_REPID = SY-REPID.
      CONSTANTS:C_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    START-OF-SELECTION.
    CALL FUNCTION 'BAPI_SALESORDER_GETLIST'
      EXPORTING
        CUSTOMER_NUMBER             = p_cust
        SALES_ORGANIZATION          = p_sales
       MATERIAL                    =  p_matnr
       DOCUMENT_DATE               =  p_date
      DOCUMENT_DATE_TO            =
      PURCHASE_ORDER              =
      TRANSACTION_GROUP           = 0
      PURCHASE_ORDER_NUMBER       =
      MATERIAL_EVG                =
    IMPORTING
      RETURN                      =
      TABLES
        SALES_ORDERS                = it_report
    LOOP AT it_report INTO wa_report.
      SELECT SINGLE KDMAT INTO wa_report-KDMAT FROM VBAP
        WHERE VBELN = wa_report-SD_DOC AND POSNR = wa_report-ITM_NUMBER.
        SELECT SINGLE aedat FROM ekko Into wa_report-aedat
          where ebeln = wa_report-PURCH_NO.
        wa_report-menge = wa_report-REQ_QTY - wa_report-dlv_qty.
    select single edatu from vbep into wa_
      MODIFY it_report FROM wa_report INDEX SY-TABIX.
    ENDLOOP.
    PERFORM DISPLAY.
    FORM DISPLAY .
      PERFORM FIELDCAT_INIT USING FIELDCAT[].
      PERFORM LAYOUT_BUILD USING LAYOUT.
      PERFORM EVENTTAB_BUILD USING I_EVENTS.
      PERFORM COMMENT_BUILD USING I_LIST_TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = T_REPID
         I_CALLBACK_TOP_OF_PAGE   = 'TOP-OF-PAGE'
          I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
          IT_FIELDCAT        = FIELDCAT
          IS_LAYOUT          = LAYOUT
          IT_EVENTS          = I_EVENTS[]
          I_DEFAULT          = 'X'
          I_SAVE             = 'A'
        TABLES
          T_OUTTAB           = it_report
        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.                    " DISPLAY
    FORM FIELDCAT_INIT  USING  RT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
      DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
      DATA : CNTR TYPE I.
      CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'SD_DOC'.
      LS_FIELDCAT-SELTEXT_L = 'Sales Order'.
      LS_FIELDCAT-HOTSPOT = 'X'. " HAND APPEARS.
      LS_FIELDCAT-KEY = 'X'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
      CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'ITM_NUMBER'.
      LS_FIELDCAT-SELTEXT_L = 'Item Number'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
    CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'SOLD_TO'.
      LS_FIELDCAT-SELTEXT_L = 'Customer Number'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
    CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'NAME'.
      LS_FIELDCAT-SELTEXT_L = 'Customer NAME'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
      CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'MATERIAL'.
      LS_FIELDCAT-SELTEXT_L = 'Material'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
    CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'SHORT_TEXT'.
      LS_FIELDCAT-SELTEXT_L = 'Material Short Text'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
    CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'KDMAT'.
      LS_FIELDCAT-SELTEXT_L = 'Customer Material'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
      CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'PLANT'.
      LS_FIELDCAT-SELTEXT_L = 'Plant'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
      CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'PURCH_NO'.
      LS_FIELDCAT-SELTEXT_L = 'Purchase Order Nuber'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
      CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'AEDAT'.
      LS_FIELDCAT-SELTEXT_L = 'PO Date'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
      CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'REQ_QTY'.
      LS_FIELDCAT-SELTEXT_L = 'Sales Order Quantity'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
      CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'REQ_DATE'.
      LS_FIELDCAT-SELTEXT_L = 'Required Date'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
      CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'DLV_QTY'.
      LS_FIELDCAT-SELTEXT_L = 'Delivered Quantity'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
      CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'MENGE'.
      LS_FIELDCAT-SELTEXT_L = 'Open Quantity'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
    CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'CREATION_DATE'.
      LS_FIELDCAT-SELTEXT_L = 'Creation Date'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
      CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'DOC_STATUS'.
      LS_FIELDCAT-SELTEXT_L = 'Sales Document Status'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
        CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'NET_PRICE'.
      LS_FIELDCAT-SELTEXT_L = 'Net Price'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
        CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'COND_P_UNT'.
      LS_FIELDCAT-SELTEXT_L = 'Condition Pricing Unit'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
          CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'COND_UNIT'.
      LS_FIELDCAT-SELTEXT_L = 'Condition Unit'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
        CLEAR LS_FIELDCAT.
      CNTR = CNTR + 1.
      LS_FIELDCAT-COL_POS = CNTR.
      LS_FIELDCAT-FIELDNAME = 'NET_VALUE'.
      LS_FIELDCAT-SELTEXT_L = 'Net Value in Document Currency'.
      LS_FIELDCAT-OUTPUTLEN = 15.
      APPEND LS_FIELDCAT TO FIELDCAT.
      endform.
    FORM LAYOUT_BUILD USING LAYOUT TYPE SLIS_LAYOUT_ALV.
      LAYOUT-ZEBRA               = 'X'.
      LAYOUT-COLWIDTH_OPTIMIZE   = 'X'.
    LAYOUT-INFO_FIELDNAME      = 'LINE_COLOR'.
    LAYOUT-BOX_TABNAME         = 'ITAB'.
    LAYOUT-COLWIDTH_OPTIMIZE   = 'X'.
    ENDFORM.                    " layout_build
    *&      Form  eventtab_build
            Initialize events
         -->L_EVENTS   Table used to store the events
    FORM EVENTTAB_BUILD USING L_EVENTS TYPE SLIS_T_EVENT.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = L_EVENTS.
      READ TABLE L_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE C_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO L_EVENTS.
      ENDIF.
    ENDFORM.                    "eventtab_build
    *&      Form  comment_build
         -->L_LIST_TOP_OF_PAGE Table used to store the list header
    FORM COMMENT_BUILD USING L_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
      DATA: LS_LINE TYPE SLIS_LISTHEADER.
      DATA: DATE1(200) TYPE C.
      DATA: DATE2(4) TYPE C.
      DATA: DATE3(12) TYPE C.
      DATA: DATE4(12) TYPE C.
      DATA: TIME1(200) TYPE C.
      DATA: TIME2(4) TYPE C.
      DATA: VALUE1(100).
      DATA: VALUE2(50).
      CONCATENATE  SY-UZEIT+0(2) ':'
                 SY-UZEIT+2(2) ':'
                 SY-UZEIT+4(2)  INTO TIME1.
      DATE2 = SY-DATUM+6(2).
      CONCATENATE  DATE2 '/' INTO DATE1." separated by space.
      DATE2 = SY-DATUM+4(2).
      CONCATENATE DATE1 DATE2 '/' INTO DATE1.
      DATE2 = SY-DATUM+0(4).
      CONCATENATE DATE1 DATE2 INTO  DATE1.
      LS_LINE-TYP  = 'H'.
      LS_LINE-INFO = 'Open Sales Report'.
      APPEND LS_LINE TO L_LIST_TOP_OF_PAGE.
      LS_LINE-TYP  = 'S'.
      LS_LINE-KEY  = 'User Name :'.
      LS_LINE-INFO = SY-UNAME.
      APPEND LS_LINE TO L_LIST_TOP_OF_PAGE.
      LS_LINE-TYP  = 'S'.
      LS_LINE-KEY  = 'Execution Date :'.
      LS_LINE-INFO = DATE1.
      APPEND LS_LINE TO L_LIST_TOP_OF_PAGE.
      LS_LINE-TYP  = 'S'.
      LS_LINE-KEY  = 'Execution Time :'.
      LS_LINE-INFO = TIME1.
      APPEND LS_LINE TO L_LIST_TOP_OF_PAGE.
    ENDFORM.                    "comment_build
    *&      Form  top_of_page
          SAP Logo on top of page
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = I_LIST_TOP_OF_PAGE.
    ENDFORM.                    "top_of_page
    *FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM
    *RS_SELFIELD TYPE SLIS_SELFIELD.
    FORM USER_COMMAND USING r_ucomm like sy-ucomm
                           ls_selfield TYPE slis_selfield.
    READ TABLE it_report ."into it_report INDEX RS_SELFIELD-TABINDEX.
    IF SY-SUBRC = 0.
        CASE r_UCOMM.
          WHEN 'SD_DOC'.
            SET PARAMETER ID 'AUN' FIELD IT_REPORT-SD_DOC.
             CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
             clear IT_report-SD_DOC.
             endcase.
           ENDIF.
            endform.
    Pls correct me .....

    HI,
    FORM USER_COMMAND USING r_ucomm like sy-ucomm
    ls_selfield TYPE slis_selfield.
    if ls_selfield-FIELDNAME =  'SD_DOC'.                        " Change
    SET PARAMETER ID 'AUN' FIELD ls_selfield-Value.           " Change
    CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
    clear IT_report-SD_DOC.
    endif.                                                   " Change
    endform.
    Edited by: Avinash Kodarapu on Jan 29, 2009 12:24 AM

  • 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

  • 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);
    }

  • How to delete the record in Table

    Hi Guru's,
    i have Table which contain no.of Records.
    i want to deleted one record. if i go to Table maint.Generator....from table itself..
    how to do that... when we deleting the record. can we create new TR for that?
    can anybody tell me.
    Thanks in Advance,
    venkat

    Hi,
    it is answered, here for my table there is no Table Maint.Generator.
    i just explained how i have done it.
    i just simply gone into Debug mode. there
    code = Dele.
    i have given. then i came out from debug mode to Table. there i just got Delete button on application tool bar.
    i selected the record then icliked on Delete button.
    it is got deleted.
    But it is not asking for any new Transport Request.
    Regards,
    Venkat

  • How to delete the record in the file present in the application server?

    Hi,
      I have two questions.
      i) How can I delete a record based on some condition in the recordx in the file that is present in the application server?
      ii) How can I lock the users whiel one user is accessing the file on the application server?
    Thanks in advance.
    Suvan

    Hi,
    If u want a frequent deletion this approach to delete a record from a file will havee unnecesary copy of records from one file to another and deletion of one file and renaming activities.
    Instead what u can do is Add and field del_flag to ur record structure.
    If u want to delete the record from a file just mark this del_flag as 'X'.
    While processing u can have a loop like
    loop at it_XXX where del_flag <> 'X'.
    endloop.
    This will logically delete the record.
    When u r to finish the application at that time only perform this copying / deleting / and renaing activity
    Hope this helps.
    Cheers,
    Nitin

  • HOW to delete the records in CO1P?

    Hi all:
    When i close the PO,i find the PO have CO1P records.However ,the PO has been settled. Then how can i  delete the records in CO1P for this PO.

    Dear,
    CO1P:
    Normally the Goods Movement errors are updated in Table AFFW - Goods Movements with Errors from Confirmations and in transaction COGI.
    If the table is locked during background using update control for the confirmation then the errors are recorded in CO1P.
    COFC:
    Used for Reprocessing of errors in confirmation related to actual cost calculations.
    Please run CORUPROC Program.
    Please check this link also for further help
    http://help.sap.com/saphelp_46c/helpdata/en/e3/7cd32396f611d1b5a60000e8359890/frameset.htm
    Regards,
    R.Brahmankar

  • How to delete  the record  of saved HRA Details...

    Hi Experts,
    I have put the details of HRA Correctly.But while updating HRA In 0008 Infotype i wrongly updated the wagetype,How should i change the Wagetype.
    When i m trying to delete it is showing  RECORD CAN NOT BE DELETED (TIME CONSTRAINT 1).
    How can delete the record.
    Thanking u .
    Sai

    Hi
         Hope doing well ........ No need to delete any infotype but u can go to PA30 and in change mode their u can delete the wagetype which is wrongly entered
    Rajeshk

  • 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.

  • How to delete the records with routine Z_AFRP4_DELETE as note [418584|

    Hello Gurus,
    I don't want to transfer data into HR and want to delete the records in table AFRP4 to business complete the Maintenance Orders
    Component version- EHP7 for SAP ERP 6.0
    Component-EA-APPL
    Release-617
    how can I delete these records
    Thanks fro Help
    AM

    Hello All,
    I found the solution, I copied the code in correction instruction number 0000282352 and create the report as programme  Z_AFRP4_DELETEand the executed
    *$*$----------------------------------------------------------------$*$*
    *$ Correction Inst.         0120061532 0000282352                     $*
    *$--------------------------------------------------------------------$*
    *$ Valid for       :                                                  $*
    *$ Software Component   SAP_APPL   SAP Application                    $*
    *$  Release 40B          All Support Package Levels                   $*
    *$  Release 45B          All Support Package Levels                   $*
    *$  Release 46B          All Support Package Levels                   $*
    *$  Release 46C          All Support Package Levels                   $*
    *$  Release 470          All Support Package Levels                   $*
    *$  Release 500          All Support Package Levels                   $*
    *$  Release 600          All Support Package Levels                   $*
    *$  Release 602          All Support Package Levels                   $*
    *$  Release 603          All Support Package Levels                   $*
    *$  Release 604          All Support Package Levels                   $*
    *$  Release 605          All Support Package Levels                   $*
    *$  Release 606          All Support Package Levels                   $*
    *$--------------------------------------------------------------------$*
    *$ Changes/Objects Not Contained in Standard SAP System               $*
    *$*$----------------------------------------------------------------$*$*
    *& Object          REPS Z_AFRP4_DELETE
    *& Object Header   PROG Z_AFRP4_DELETE
    *& REPORT Z_AFRP4_DELETE
    REPORT  Z_AFRP4_DELETE .
    * This report deletes confirmation records from table AFRP4 that are
    * not longer needed. Run it without update flag first !!
       tables: afrp4.
       data: lt_afrp4 like afrp4 occurs 0,
             ls_afrp4 like afrp4.
       selection-screen begin of block order with frame.
       select-options: zorders for afrp4-aufnr.   "order number
       selection-screen end   of block order.
       parameters: update as checkbox.
       select * from afrp4 into table lt_afrp4
                    where aufnr in zorders.
       if lt_afrp4[] is initial.
         format color col_normal.
         write: 'No HR confirmation background records read.'.
         exit.
       endif.
       format color col_heading.
       write: /5 'Order', 25 'Confirmation', 45 'Counter'.
       skip.  uline.  skip.
    * show corrections
       loop at lt_afrp4 into ls_afrp4.
         format color col_normal.
         write: /5 ls_afrp4-aufnr, 25 ls_afrp4-rueck, 45 ls_afrp4-rmzhl.
       endloop.
    * update on data base table
       if not update is initial.
         skip.  uline.  skip.
         delete afrp4 from table lt_afrp4.
         if sy-subrc is initial.
           format color col_positive.
           write: 'HR-records deleted successfull'.
         else.
           format color col_negative.
           write: 'Error when trying to update data base table AFRP4.'.
         endif.
       endif.

Maybe you are looking for