Saltar al contenido

Mostrar vista de CDS usando ALV con IDA

Su código de programación debería verse así:

*&---------------------------------------------------------------------*
*& Report zjp_cds_inv_items_test
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zjp_cds_inv_items_test.

class lcl_main definition create private.

  public section.
    CLASS-METHODS create
      RETURNING
        value(r_result) TYPE REF TO lcl_main.

    methods run.

  protected section.
  private section.

endclass.

class lcl_main implementation.

  method create.
    create object r_result.
  endmethod.

  method run.

cl_salv_gui_table_ida=>create_for_cds_view(`Z_Invoice_Items`)->fullscreen( )->display( ).
  endmethod.
endclass.

start-of-selection.

lcl_main=>create( )->run( ).

Su vista de CDS debería verse así:

@AbapCatalog.sqlViewName: 'ZINVOICEITEMS'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'CDS View for "Use-cds-view" tutorial'
define view Z_Invoice_Items
  as select from sepm_sddl_so_invoice_item
{
  //sepm_sddl_so_invoice_item

  header.buyer.company_name,
  sepm_sddl_so_invoice_item.sales_order_invoice_key,
  sepm_sddl_so_invoice_item.currency_code,
  sepm_sddl_so_invoice_item.gross_amount,

@EndUserText.quickInfo: 'Paid'  

    case header.payment_status
        when 'P' then 'X'
        else ' '
    end

as payment_status,

//* Associations *//
  header
}

Ejecución ZCDS_INVOICE_ITEMS_EURO de nuevo por selección Ejecución (F8).

La información de sugerencias para la columna Pagado ha cambiado:

Hecho

Inicie sesión para responder la pregunta