ALV 变式 删除

原文出自: http://blog.chinaunix.net/uid-8527621-id-2951940.html

FUNCTION zalv_variant_delete.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     VALUE(I_REPORT) TYPE  LTDX-REPORT
*"     VALUE(I_VARIANT) TYPE  LTDX-VARIANT
*"  EXCEPTIONS
*"      NO_DELETION
*"      NO_ENTRY
*"----------------------------------------------------------------------

  DATA: ld_mandt TYPE sy-mandt,
        ld_count TYPE i.

  ld_mandt = sy-mandt.

  SELECT COUNT( * ) FROM v_ltdx CLIENT SPECIFIED
      INTO ld_count
         WHERE mandt = ld_mandt  AND
              report = i_report  AND
              variant = i_variant .

  IF sy-subrc <> 0.
    RAISE no_entry.
  ELSE.
    IF ld_count > 0.
      DELETE FROM ltdx WHERE report = i_report AND variant = i_variant.
      IF sy-subrc <> 0.
        RAISE no_deletion.
      ENDIF.
    ENDIF.
  ENDIF.

ENDFUNCTION.


你可能感兴趣的:(alv,变式)