HOW TO DISPLAY ALV REPORT using SALV WITH Container

Go to SE38 program and create a report program


Create a screen (Ex:screen 100)










Double click on screen 100
                                               




Click on layout button and click on custom control button





Define the custom control area and activate the screen


Write the logic in PBO and PAI





Define the PF status                                                                                                              





Complete code:

REPORT ztest_salv_container.
DATA:ok TYPE sy-ucomm.
DATA:lr_con  TYPE REF TO cl_gui_custom_container,
     lr_salv 
TYPE REF TO cl_salv_table.
DATA:gt_kna1 TYPE TABLE OF kna1.

START-OF-SELECTION.

  
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  
SET PF-STATUS '100'.
  
SELECT * FROM kna1 INTO TABLE gt_kna1 UP TO 10 ROWS.
  
CREATE OBJECT lr_con
    
EXPORTING
      container_name 
= 'CONT'.

  
TRY.
      
CALL METHOD cl_salv_table=>factory
   
EXPORTING
*     list_display   = IF_SALV_C_BOOL_SAP=>FALSE
     r_container    
= lr_con
*       container_name = 'CONT'
        
IMPORTING
          r_salv_table 
= lr_salv
        
CHANGING
          t_table      
= gt_kna1.
    
CATCH cx_salv_msg .
  
ENDTRY.
lr_salv
->display( ).

ENDMODULE.
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  
IF ok = 'BACK' .
    
LEAVE TO SCREEN 0.
  
ENDIF.
ENDMODULE

SALV Output:














1 comment:

  1. Thanks for giving so much of Information. STONE Tech is a manufacturer of HMI display module(Intelligent TFT LCD).

    tft lcd factory
    tft lcd factory

    ReplyDelete