Wednesday, 19 April 2017

Change the Description of Released TR

Once a TR has been Released, it cannot be edited in normal way. The released TR cannot be deleted also. Only the Basis team can delete it from OS level. But there are some ways in which you can change the description of the released TR, although it is not recommend.

>> One way of doing this is by changing the entry of table E07T through debugging technique. Click Here

>> The other way is by using the FM:

1) Got o FM 'TRINT_CHECK_REQUEST_CHANGEABLE'
At the line number 111 IF is_request_header-trstatus CA sctsc_states_released, put the break point.
2) Double click the released request which you want to change the description.
3) your EDIT option will be disabled. Just type '/h' in the tcpode area and press enter, your debugging will switched on.
4) Then Press ENTER again, it will open the debugger screen, in the variable change the SY_UCOMM field to 'WB_DISP_EDIT_TOGGLE' . Then press F8.
5) your control will be in the FM 'TRINT_CHECK_REQUEST_CHANGEABLE' line number 111. Try to skip this IF condition by using debug technique.
6) Now you can change the description.Now you cant save this as Save button is disabled.Just press back button, you will get the message for save the changes.Just save it.

Tuesday, 18 April 2017

Changing The Entry of Standard Table

Although this is not recommended, but by the following way you can change the entry of any standard table.
  1. Open the table in SE16 and select the record that needs to be changed.
  2. Click on the Display icon or press F7.
  3. Type /H in the tcode area to switch on the Debug Mode.
  4. Again press 'Enter' to turn the debugger on.
  5. Press F7. You will see the code something like this:
    if code = 'show'
  6. Change the value of Code to 'EDIT' and press F8.
    and in case of deleting any entry change the value of Code to 'DELE' and press F8.
  7. Press Save after the operation is done.

Monday, 17 April 2017

Excel output with Coloured Cell

The following program has been copied from here. Only a small change has been made for the cell colour so that the background remains transparent and only the heading have a cell colour. The followings are the valid colour indexes:



*&---------------------------------------------------------------------*
*& Report  ZEXCEL
*&
*&---------------------------------------------------------------------*
*&
*& EXCEL OUTPUT WITH CELL COLOURING
*&---------------------------------------------------------------------*

REPORT zexcel.

INCLUDE ole2incl.
FIELD-SYMBOLS: <val> TYPE any.
DATA: row_cnt TYPE i.
TYPES: BEGIN OF t_excel,
  material_info(20),
  sugg_price(20),
  cost(20),
  comments(100),
END OF t_excel.
DATA: r_excel TYPE t_excel.
DATA: i_excel TYPE TABLE OF t_excel WITH HEADER LINE.
CONSTANTS:
  xlcenter TYPE i VALUE '-4108',
  xlbottom TYPE i VALUE '-4107',
  xlleft TYPE i VALUE '-4131',
  xlright TYPE i VALUE '-4152'.
CONSTANTS:
  xlcontinuous TYPE i VALUE '1',
  xlinsidevertical TYPE i VALUE '11',
  xlthin TYPE i VALUE '2',
  xllandscape TYPE i VALUE '2',
  xlportrait TYPE i VALUE '1',
  xlletter TYPE i VALUE '1',
  xllegal TYPE i VALUE '5',
  xlthick TYPE i VALUE '4',
  xlnone TYPE i VALUE '-4142',
  xlautomatic TYPE i VALUE '-4105'.
DATA:
  hexcel TYPE ole2_object, " Excel object
  hworkbooks TYPE ole2_object, " list of workbooks
  hworkbook TYPE ole2_object, " workbook
  hsheet TYPE ole2_object, " worksheet object
  hrange TYPE ole2_object, " range object
  hrange2 TYPE ole2_object, " range object
  hborders TYPE ole2_object, " Border object
  hinterior TYPE ole2_object, " interior object - for coloring
  hcolumn TYPE ole2_object, "column
  hcell TYPE ole2_object, " cell
  hfont TYPE ole2_object, " font
  hselected TYPE ole2_object, " range object
  hpicture TYPE ole2_object, "picture object
  hlogo TYPE ole2_object. "Logo object


SELECTION-SCREEN BEGIN OF BLOCK b1.
SELECTION-SCREEN SKIP 1.
PARAMETER: wraptext AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b1.


row_cnt = 1.
PERFORM build_dummy_vals.
PERFORM start_excel.
PERFORM build_header_line USING row_cnt.
PERFORM pass_records USING row_cnt.
PERFORM release_excel.
*&---------------------------------------------------------------------*
*&      Form  Build_Dummy_Vals
*&---------------------------------------------------------------------*
FORM build_dummy_vals .
  DATA: matnum(5) TYPE n.
  DATA: baseprice(3) TYPE n.
  DO 5 TIMES.
    matnum = matnum + 50.
    CLEAR r_excel.
    CONCATENATE 'Material ' matnum INTO r_excel-material_info
    SEPARATED BY space.
    r_excel-sugg_price = baseprice * matnum.
    r_excel-cost = ( baseprice * matnum ) / 2.
    CONCATENATE 'Comments for Material ' matnum INTO r_excel-comments
    SEPARATED BY space.
    APPEND r_excel TO i_excel.
  ENDDO.
ENDFORM. " Build_Dummy_Vals
*&---------------------------------------------------------------------*
*&      Form  Start_Excel
*&---------------------------------------------------------------------*
FORM start_excel.
  CREATE OBJECT hexcel 'EXCEL.APPLICATION'.
  PERFORM err_hdl.

*get list of workbooks, initially empty
  CALL METHOD OF
      hexcel
      'Workbooks' = hworkbooks.
  PERFORM err_hdl.

*add a new workbook
  CALL METHOD OF
      hworkbooks
      'Add'      = hworkbook.
  PERFORM err_hdl.

*Get Worksheet object.
  GET PROPERTY OF hworkbook 'ActiveSheet' = hsheet.
ENDFORM.                    "Start_Excel
*&---------------------------------------------------------------------*
*&      Form  Build_Header_Line
*&---------------------------------------------------------------------*
FORM build_header_line USING p_row_cnt.
  DATA: l_range(30).
  DATA: row_start(10).

  PERFORM fill_the_cell USING p_row_cnt 1 1 'Material'.
  PERFORM fill_the_cell USING p_row_cnt 2 1 'Suggested Price'.
  PERFORM fill_the_cell USING p_row_cnt 3 1 'Cost'.
  PERFORM fill_the_cell USING p_row_cnt 4 1 'Comments'.
  PERFORM format_column USING 1 15 xlcenter ' ' xlcenter 0.
  PERFORM format_column USING 2 10 xlcenter ' ' xlcenter 1.
  PERFORM format_column USING 3 35 xlcenter ' ' xlcenter 0.
  IF wraptext = 'X'.
    PERFORM format_column USING 4 35 xlleft ' ' xlcenter 1.
  ELSE.
    PERFORM format_column USING 4 100 xlleft ' ' xlcenter 0.
  ENDIF.

*Build the range object.
  row_start = p_row_cnt.
  CONCATENATE 'A' row_start ':D' row_start INTO l_range.
  CONDENSE l_range NO-GAPS.

*Set row color to yellow.
  CALL METHOD OF
      hexcel
      'RANGE' = hrange
    EXPORTING
      #1      = l_range.
  CALL METHOD OF
      hrange
      'Interior' = hinterior.
  SET PROPERTY OF hinterior 'ColorIndex' = 15. "6. "yellow
  p_row_cnt = p_row_cnt + 1.
ENDFORM. " Build_Header_Line
*&---------------------------------------------------------------------*
*&      Form  Format_Column
*&---------------------------------------------------------------------*
FORM format_column USING  p_colnum
                          p_colwidth
                          p_colhalign
                          p_colformat
                          p_colvalign
                          p_wraptext.
  CALL METHOD OF
      hexcel
      'COLUMNS' = hcolumn
    EXPORTING
      #1        = p_colnum. "column number
  SET PROPERTY OF hcolumn 'HorizontalAlignment' = p_colhalign.
  SET PROPERTY OF hcolumn 'VerticalAlignment' = p_colvalign.
  SET PROPERTY OF hcolumn 'ColumnWidth' = p_colwidth.
  SET PROPERTY OF hcolumn 'WrapText' = p_wraptext.
ENDFORM. " Format_Column
*&---------------------------------------------------------------------*
*&      Form  Pass_Records
*&---------------------------------------------------------------------*
FORM pass_records USING p_row_cnt.
  DATA: col_cnt TYPE i.
  DATA: l_range(30).
  DATA: row_start(10).
  col_cnt = 1.
*Pass the internal table values to the spreadsheet.
  LOOP AT i_excel INTO r_excel.
    DO 4 TIMES.
      ASSIGN COMPONENT sy-index OF STRUCTURE r_excel TO <val>.
      PERFORM fill_the_cell USING p_row_cnt col_cnt 0 <val>.
      col_cnt = col_cnt + 1. "increment column
    ENDDO.

*Build the range object.
    row_start = p_row_cnt.
    CONCATENATE 'A' row_start ':D' row_start INTO l_range.
    CONDENSE l_range NO-GAPS.

*Set row color to yellow.
    CALL METHOD OF
        hexcel
        'RANGE' = hrange
      EXPORTING
        #1      = l_range.
    CALL METHOD OF
        hrange
        'Interior' = hinterior.
*    SET PROPERTY OF hinterior 'ColorIndex' = 2. "7. "yellow
    p_row_cnt = p_row_cnt + 1. "increment row
    col_cnt = 1. "reset column to A (ie. col 1)
  ENDLOOP.
ENDFORM.                    "Pass_Records
*&---------------------------------------------------------------------*
*&      Form  Release_Excel
*&---------------------------------------------------------------------*
FORM release_excel .
  SET PROPERTY OF hexcel 'Visible' = 1.
  FREE OBJECT hexcel.
  PERFORM err_hdl.
ENDFORM. " Release_Excel
*---------------------------------------------------------------------
*FORM Fill_The_Cell
*---------------------------------------------------------------------
*
*Sets cell at coordinates i,j to value val boldtype bold *
*
*BOLD --> 1 = true, set bold ON 0 = false, set bold OFF
*---------------------------------------------------------------------
FORM fill_the_cell USING i j bold thevalue.
  CALL METHOD OF
      hexcel
      'Cells' = hcell
    EXPORTING
      #1      = i
      #2      = j.
  PERFORM err_hdl.
  SET PROPERTY OF hcell 'Value' = thevalue.
  PERFORM err_hdl.
  GET PROPERTY OF hcell 'Font' = hfont.
  PERFORM err_hdl.
  SET PROPERTY OF hfont 'Bold' = bold.
  PERFORM err_hdl.
ENDFORM.                    "Fill_The_Cell
*&---------------------------------------------------------------------*
*&      Form  ERR_HDL
*&---------------------------------------------------------------------*
FORM err_hdl.
  IF sy-subrc <> 0.
    MESSAGE i000(zz) WITH 'OLE Automation error: ' sy-subrc.
    EXIT.
  ENDIF.
ENDFORM. " ERR_HDL

Using Memory ID To Transfer Value

With the help of MEMORY ID we can transfer the value from one report to another. Following is a simple example to show how this works:

Source System:
*&---------------------------------------------------------------------*
*& Report  ZSOURCE
*&
*&---------------------------------------------------------------------*
*&
*& SOURCE SYSTEM: LISTING THE PLANT AGAINST A PARTICULAR EBELN
*&---------------------------------------------------------------------*

REPORT zsource.
TABLES: ekko, ekpo.

SELECT-OPTIONS: s_ebeln FOR ekko-ebeln.

START-OF-SELECTION.
  DATA: lt_ekko TYPE TABLE OF ekko,
        lt_res TYPE TABLE OF ekpo,
        ls_res TYPE ekpo
        .
  CLEAR: ls_res.
  REFRESH: lt_ekko, lt_res.
  FREE MEMORY ID 'TEMP'.

  SUBMIT zdest WITH s_ebeln IN s_ebeln AND RETURN.

  IMPORT lt_ekpo TO lt_res FROM MEMORY ID 'TEMP'.

  LOOP AT lt_res INTO ls_res.
    AT NEW ebeln.
      FORMAT INTENSIFIED ON.
      WRITE: / 'Plant: ',ls_res-ebeln.
      FORMAT INTENSIFIED OFF.
    ENDAT.

    WRITE: / ls_res-werks.
  ENDLOOP.

Destination System:
*&---------------------------------------------------------------------*
*& Report  ZDEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT zdest.
TABLES: ekko, ekpo.

SELECTION-SCREEN: BEGIN OF BLOCK b1.
SELECT-OPTIONS: s_ebeln FOR ekko-ebeln.
SELECTION-SCREEN: END OF BLOCK b1.

START-OF-SELECTION.

  DATA: lt_ekpo TYPE TABLE OF ekpo.

  SELECT *
  FROM ekpo
  INTO TABLE lt_ekpo
  WHERE ebeln IN s_ebeln.

  EXPORT lt_ekpo TO MEMORY ID 'TEMP'.

Thursday, 13 April 2017

Background Job Processing

Following is a simple example to show how to perform background job processing:

*&---------------------------------------------------------------------*
*& Report  ZTEST
*&
*&---------------------------------------------------------------------*
*& Background Job Processing
*&---------------------------------------------------------------------*

REPORT ztest.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: p_for RADIOBUTTON GROUP gr1 DEFAULT 'X' USER-COMMAND f1,
            p_back RADIOBUTTON GROUP gr1.
PARAMETERS: p_name TYPE char10.
SELECTION-SCREEN: END OF BLOCK b1.

START-OF-SELECTION.
  IF p_for = 'X'.
    PERFORM disp USING p_name.
  ELSE.
    PERFORM batch_job USING p_name.
  ENDIF.

*&---------------------------------------------------------------------*
*&      Form  batch_job
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM batch_job USING p_name TYPE char10.
  DATA: lv_jobcount TYPE tbtcjob-jobcount,
        lv_jobname  TYPE tbtcjob-jobname VALUE 'ZTEST',
        lv_text     TYPE char200.

  DATA: lv_timestamp TYPE timestampl ##needed,
        lv_time      TYPE char50.

  CONSTANTS: lc_jobclass TYPE tbtcjob-jobclass VALUE 'A',
             lc_sep2     TYPE char3            VALUE  '_'.


  GET TIME STAMP FIELD lv_timestamp.
  lv_time = sy-uzeit.

  CONCATENATE lv_jobname lc_sep2 sy-datum lc_sep2 lv_time
         INTO lv_jobname .


* JOB OPEN
  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      jobname          = lv_jobname
      jobclass         = lc_jobclass
    IMPORTING
      jobcount         = lv_jobcount
    EXCEPTIONS
      cant_create_job  = 1
      invalid_job_data = 2
      jobname_missing  = 3
      OTHERS           = 4.
  IF sy-subrc <> 0.
    MESSAGE 'Error' TYPE 'S' DISPLAY LIKE 'E'.
    RETURN.
  ELSE.
*    CALLING THE SAME PROGRAM BY PASSING THE INPUT PARAMTERS
    SUBMIT ztest
    WITH p_name EQ p_name
    VIA JOB lv_jobname
    NUMBER lv_jobcount
    AND RETURN.

    IF sy-subrc = 0.
* JOB CLOSE
      CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
          jobcount             = lv_jobcount
          jobname              = lv_jobname
          strtimmed            = 'X'
        EXCEPTIONS
          cant_start_immediate = 1
          invalid_startdate    = 2
          jobname_missing      = 3
          job_close_failed     = 4
          job_nosteps          = 5
          job_notex            = 6
          lock_failed          = 7
          invalid_target       = 8
          OTHERS               = 9.
      IF sy-subrc = 0.
        MESSAGE 'Success' TYPE 'S'.
      ELSE.
        MESSAGE 'Error' TYPE 'S' DISPLAY LIKE 'E'.
        RETURN.
      ENDIF.
    ENDIF.
  ENDIF.
ENDFORM.                    "batch_job

*&---------------------------------------------------------------------*
*&      Form  DISP
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM disp USING p_name TYPE char10.
  WRITE: 'Hello', p_name.
ENDFORM.                    " DISP

NOTE: You can view the background job in SM37. Click on execute and then you can view the spool.

Friday, 7 April 2017

Field Symbols

Field Symbols when used as Work area for the Internal Table:
*&---------------------------------------------------------------------*
*& Report  ZDEMO
*&
*&---------------------------------------------------------------------*
*& Field Symbols Example
*&
*&---------------------------------------------------------------------*
REPORT zdemo.

INITIALIZATION.
  TYPES: BEGIN OF line,
           col1 TYPE c,
           col2 TYPE c,
         END OF line.

  DATA: gt_tab      TYPE TABLE OF line,
        gv_key      TYPE char4 VALUE 'COL1',
        gv_data_ref TYPE REF TO data
        .

  FIELD-SYMBOLS: <fs_gt_tab> TYPE ANY TABLE,
                 <fs_gs_tab> LIKE LINE OF gt_tab
                 .

START-OF-SELECTION.
  CREATE DATA gv_data_ref LIKE LINE OF gt_tab.
  ASSIGN gv_data_ref->* TO <fs_gs_tab>.
  ASSIGN gt_tab TO <fs_gt_tab>.

  <fs_gs_tab>-col1 = 'A'.
  <fs_gs_tab>-col2 = '1'.
  APPEND <fs_gs_tab> TO gt_tab.

  <fs_gs_tab>-col1 = 'B'.
  <fs_gs_tab>-col2 = '2'.
  APPEND <fs_gs_tab> TO gt_tab.

  READ TABLE <fs_gt_tab> WITH KEY ('COL1') = 'A' ASSIGNING <fs_gs_tab>.

  WRITE: / 'Before: ', <fs_gs_tab>-col2.
  <fs_gs_tab>-col2 = 'I'.
  WRITE: / 'After: ', <fs_gs_tab>-col2.

NOTE: The parenthesis '( )' means that the value will be determined in the run time.


Example 2: Display table data according to the name given by the user
*"DISPLAY TABLE DATA ACCORDING TO THE TABLE NAME GIVEN BY USER
*
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS:  p_tab TYPE tabname OBLIGATORY.
PARAMETERS:  p_no TYPE i.
SELECTION-SCREEN: END OF BLOCK b1.

AT SELECTION-SCREEN.
  SELECT COUNT(*) FROM dd03l WHERE tabname = p_tab.
  IF sy-subrc NE 0.
    MESSAGE 'Invalid Table Name' TYPE 'E'.
  ENDIF.

START-OF-SELECTION.

  DATA: lv_dref TYPE REF TO data.
  FIELD-SYMBOLS: <fs_tab> TYPE STANDARD TABLE,
                 <fs_tmp> TYPE any
                 .

  CREATE DATA lv_dref TYPE TABLE OF (p_tab).
  ASSIGN lv_dref->* TO <fs_tab>.

  SELECT *
    FROM (p_tab)
    INTO TABLE <fs_tab>
    UP TO p_no ROWS.

  DATA: lt_fcat   TYPE slis_t_fieldcat_alv,
        ls_fcat   TYPE slis_fieldcat_alv,
        ls_layout TYPE slis_layout_alv.

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = sy-repid
      i_structure_name       = p_tab
    CHANGING
      ct_fieldcat            = lt_fcat
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.
  IF sy-subrc <> 0.
*   Implement suitable error handling here
  ENDIF.

  ls_layout-colwidth_optimize = 'X'.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = sy-repid
      is_layout          = ls_layout
      it_fieldcat        = lt_fcat
    TABLES
      t_outtab           = <fs_tab>
    EXCEPTIONS
      program_error      = 1
      OTHERS             = 2.
  IF sy-subrc <> 0.
*     Implement suitable error handling here
  ENDIF.

Thursday, 6 April 2017

ALV Using CL_SALV_TABLE

The following program creates and displays ALV using CL_SALV_TABLE class.
*&---------------------------------------------------------------------*
*& Report  ZDEMO11
*&
*&---------------------------------------------------------------------*
*&
*& ALV Using CL_SALV_TABLE
*&---------------------------------------------------------------------*
REPORT zdemo11.

TYPES:BEGIN OF gty_emp,
        id   TYPE char10,
        name TYPE char10,
      END OF gty_emp.

DATA: gt_emp  TYPE TABLE OF gty_emp,
      gv_data TYPE REF TO data
      .
FIELD-SYMBOLS: <fs_emp> LIKE LINE OF gt_emp.

START-OF-SELECTION.
  REFRESH: gt_emp.
  CLEAR: gv_data.

  PERFORM populate_record.
  PERFORM create_display_alv.

*&---------------------------------------------------------------------*
*&      Form  POPULATE_RECORD
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM populate_record .

  CREATE DATA gv_data LIKE LINE OF gt_emp.
  ASSIGN gv_data->* TO <fs_emp>.

  <fs_emp>-id   = '1'.
  <fs_emp>-name = 'A'.
  APPEND <fs_emp> TO gt_emp.

  <fs_emp>-id   = '2'.
  <fs_emp>-name = 'B'.
  APPEND <fs_emp> TO gt_emp.

ENDFORM.

*----------------------------------------------------------------------*
*       CLASS cl_event_handler DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_event_handler DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS on_added_function               " ADDED_FUNCTION FOR USER_COMMAND
      FOR EVENT if_salv_events_functions~added_function
                  OF cl_salv_events_table
      IMPORTING e_salv_function.
ENDCLASS.                    "cl_event_handler DEFINITION

*----------------------------------------------------------------------*
*       CLASS cl_event_handler IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_event_handler IMPLEMENTATION.
  METHOD on_added_function.

*    ADD USER COMMAND HERE: FOR EXAMPLE IF THERE IS AN EXPORT BUTTON FOR XLS
*    YOU CAN WRITE THE CODE LIKE THIS:

*    IF e_salv_function EQ '&XLS'.  "&XLS IS THE BUTTON FUNCTION CODE
*      PERFORM export_xls.          "WRITE ALL THE FUNCTIONALITY IN THE PERFORM
*    ENDIF.

  ENDMETHOD.                    "on_added_function
ENDCLASS.                    "cl_event_handler IMPLEMENTATION

*&---------------------------------------------------------------------*
*&      Form  CREATE_DISPLAY_ALV
*&---------------------------------------------------------------------*
*       CREATING AND DISPLAYING ALV (NON-EDITABLE)
*----------------------------------------------------------------------*
FORM create_display_alv .

  DATA: lv_col_msg TYPE REF TO cx_salv_not_found,
        lv_alv_msg TYPE REF TO cx_salv_msg,
        lo_alv     TYPE REF TO cl_salv_table,
        lo_columns TYPE REF TO cl_salv_columns_table,
        lo_column  TYPE REF TO cl_salv_column,
        lo_events  TYPE REF TO cl_salv_events_table
        .
  TRY .
      CALL METHOD cl_salv_table=>factory
        IMPORTING
          r_salv_table = lo_alv
        CHANGING
          t_table      = gt_emp.

**********************************************************************
      lo_events = lo_alv->get_event( ).
      SET HANDLER cl_event_handler=>on_added_function FOR lo_events.
**********************************************************************


*********************** SETTING THE FIELDCATALOG ***********************
      TRY .
          lo_columns  = lo_alv->get_columns( ).
          lo_columns->set_optimize( ).

          lo_column = lo_columns->get_column( 'ID' ). "COLUMN NAME
          lo_column->set_short_text( 'ID' ).          "SHORT TEXT
          lo_column->set_medium_text( 'EMP. ID' ).    "MEDIUM TEXT
          lo_column->set_long_text( 'Employee ID' ).  "LONG TEXT

          lo_column = lo_columns->get_column( 'NAME' ). "COLUMN NAME
          lo_column->set_short_text( 'Name' ).          "SHORT TEXT
          lo_column->set_medium_text( 'EMP. Name' ).    "MEDIUM TEXT
          lo_column->set_long_text( 'Employee Name' ).  "LONG TEXT

        CATCH cx_salv_not_found INTO lv_col_msg.
*          IMPLEMENT ERROR HANDLING MECHANISM
      ENDTRY.
********************** #SETTING THE FIELDCATALOG ***********************

************************* SETTING PF_STATUS ***************************
      TRY.
          CALL METHOD lo_alv->set_screen_status
            EXPORTING
              report        = sy-repid
              pfstatus      = 'PF_STATUS'
              set_functions = lo_alv->c_functions_all.
      ENDTRY.
************************* #SETTING PF_STATUS **************************

      lo_alv->display( ).

    CATCH cx_salv_msg INTO lv_alv_msg.
*     IMPLEMENT ERROR HANDLING MECHANISM
  ENDTRY.
ENDFORM.                    " DISPLAY_ALV

For a detail understanding, you can visit the following links:

http://www.kerum.pl/infodepot/00007

http://abapmentor.expertise-team.com/post/display-alv-list-easily-in-abap-using-cl-salv-table-part-ii-enable-layout-settings.aspx

http://abapmentor.expertise-team.com/post/display-alv-list-easily-in-abap-using-cl-salv-table-part-v-set-toolbar.aspx




Report to find CDS view of Standard Table

A small change has been made to the original program ( SAP YARD Article ) so that it can also display the common CDS used by multiple table...