How to delete line item (row) of SAP table ?

How to delete line item (row) of SAP table ?

Answer :

you can use se16n transaction like this:
start tr. se16n
type the table name and press ENTER.
Then type the string "&sap_edit" into the command line and strike Enter
again.
enter your selection criteria.
run.(F8)
now you can easily delete the lines you want (and then save)

All Changes are noted in the tables
SE16N_CD_DATA and
SE16N_CD_KEY.

Nice answer from christina

***************************
There are another way to delete this table, you can create abap program  for delete detail and summary table New GL. This is example ABAP program for that purpose

REPORT  zfi_fagl_del.

TABLES : faglflexa,faglflext.

INCLUDE : zgen_alv,zgen_alv_event.
SELECTION-SCREEN BEGIN OF BLOCK box1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS :
            s_bukrs FOR faglflexa-rbukrs OBLIGATORY.
PARAMETERS:
            p_gjahr LIKE faglflexa-gjahr OBLIGATORY,
            p_rldnr LIKE faglflexa-rldnr OBLIGATORY,
            p_detai RADIOBUTTON GROUP radi,
            p_total RADIOBUTTON GROUP radi,
            p_delet AS CHECKBOX.

SELECTION-SCREEN END OF BLOCK box1.

INITIALIZATION.
  GET PARAMETER ID : 'BUK' FIELD s_bukrs-low,
                     'ZBUKH' FIELD s_bukrs-high,
                     'ZBUKO' FIELD s_bukrs-option,
                     'ZBUKS' FIELD s_bukrs-sign,
                     'GJA' FIELD p_gjahr,
                     'GLN_FLEX' FIELD p_rldnr.

START-OF-SELECTION.
  SET PARAMETER ID : 'BUK' FIELD s_bukrs-low,
                     'ZBUKH' FIELD s_bukrs-high,
                     'ZBUKO' FIELD s_bukrs-option,
                     'ZBUKS' FIELD s_bukrs-sign,
                     'GJA' FIELD p_gjahr,
                     'GLN_FLEX' FIELD p_rldnr.

  IF p_delet = 'X'.
    IF p_detai = 'X'.
      DELETE FROM faglflexa
      WHERE rbukrs IN s_bukrs
        AND gjahr = p_gjahr
        AND rldnr = p_rldnr.
    ENDIF.
    IF p_total = 'X'.
      DELETE FROM faglflext
      WHERE rbukrs IN s_bukrs
        AND ryear = p_gjahr
        AND rldnr = p_rldnr.
    ENDIF.
    COMMIT WORK.
  ELSE.
    g_repid = sy-repid.
    gs_variant-report = g_repid.
    g_save           = 'A'.
    gs_variant-handle = ''.
    IF p_detai = 'X'.
      PERFORM f_alv_list_a.
    ELSE.
      PERFORM f_alv_list_t.
    ENDIF.
  ENDIF.

*&---------------------------------------------------------------------*
*&      Form  f_alv_list_a
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM f_alv_list_a.
  DATA : lt_faglflexa LIKE faglflexa OCCURS 0 WITH HEADER LINE.

  PERFORM f_event_tab_build USING i_events[].
*  PERFORM f_comment_build USING i_top_of_page[].

  SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_faglflexa
  FROM faglflexa
  WHERE rbukrs IN s_bukrs
    AND gjahr = p_gjahr
    AND rldnr = p_rldnr.

  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      i_callback_program       = g_repid
      i_callback_pf_status_set = c_form_name_pf_status_set
      i_callback_user_command  = c_form_name_user_command
      i_structure_name         = 'FAGLFLEXA'
      is_layout                = i_layout
      it_fieldcat              = i_fieldtab[]
      i_save                   = g_save
      is_variant               = gs_variant
      it_events                = i_events[]
    TABLES
      t_outtab                 = lt_faglflexa.
ENDFORM.                    " f_alv_screen
*&---------------------------------------------------------------------*
*&      Form  f_alv_list_t
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM f_alv_list_t.
  DATA : lt_faglflext LIKE faglflext OCCURS 0 WITH HEADER LINE.

  SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_faglflext
  FROM faglflext
  WHERE rbukrs IN s_bukrs
    AND ryear = p_gjahr
    AND rldnr = p_rldnr.

  PERFORM f_event_tab_build USING i_events[].
*  PERFORM f_comment_build USING i_top_of_page[].


  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      i_callback_program       = g_repid
      i_callback_pf_status_set = c_form_name_pf_status_set
      i_callback_user_command  = c_form_name_user_command
      i_structure_name         = 'FAGLFLEXT'
      is_layout                = i_layout
      it_fieldcat              = i_fieldtab[]
      i_save                   = g_save
      is_variant               = gs_variant
      it_events                = i_events[]
    TABLES
      t_outtab                 = lt_faglflext.
ENDFORM.                    " f_alv_screen
*&---------------------------------------------------------------------*
*&      Form  f_pf_status_set
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->FT_EXTAB   text
*----------------------------------------------------------------------*
FORM f_pf_status_set USING ft_extab TYPE slis_t_extab.
  SET PF-STATUS '9001' OF
    PROGRAM 'ZGEN_STATUS' EXCLUDING ft_extab.
ENDFORM.                    "f_pf_status_set
*&---------------------------------------------------------------------*
*&      Form  f_user_command
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->FV_UCOMM     text
*      -->FT_SELFIELD  text
*----------------------------------------------------------------------*
FORM f_user_command USING fv_ucomm LIKE sy-ucomm
  ft_selfield TYPE slis_selfield.
ENDFORM.                    "f_user_command

www.okawirasatha.com

Comments

Popular posts from this blog

Step by step Create SAP LIS Report

New GL Manual Update FAGLFLEXA & FAGLFLEXT

Step by Step SAP Splitting Document