Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

SAP ALV OO

$
0
0

Hi again guys, I ran into another problem, when i use the Class, I get an error message " type CL_SALV_LAYOUT_GRID is unkown  ". I though that was a standard class....I'am referring link: http://help.sap.com/saphelp_nw70ehp3/helpdata/en/4e/c11c9634f62b90e10000000a42189d/content.htm?frameset=/en/4e/c1b012087c2b91e10000000a42189d/frameset.htm My program is as follows:

 

 

SAP ALV OO

REPORT ZHELLOWORLD.

TABLES: ZDBTABLE.

 

DATA: itab_ZDBTABLE TYPE STANDARD TABLE OF ZDBTABLE.

DATA: ref_CL_SALV_TABLE TYPE REF TO CL_SALV_TABLE.

 

START-OF-SELECTION.

  SELECT ZDBTABLE~code qty

    FROM  ZDBTABLE

    INTO  CORRESPONDING FIELDS OF TABLE itab_ZDBTABLE.

 

  " Create Instance

  CALL METHOD CL_SALV_TABLE=>FACTORY

    IMPORTING   R_SALV_TABLE = ref_CL_SALV_TABLE

    CHANGING    T_TABLE = itab_ZDBTABLE.

 

  " Text After ALV Output

  DATA: ref_CL_SALV_FORM_TEXT TYPE REF TO CL_SALV_FORM_TEXT.

  DATA: ref_CL_SALV_FORM_LABEL TYPE REF TO CL_SALV_FORM_LABEL.

  DATA: ref_CL_SALV_LAYOUT_GRID TYPE REF TO CL_SALV_LAYOUT_GRID.

 

  CREATE OBJECT ref_CL_SALV_LAYOUT_GRID.

  ref_CL_SALV_FORM_LABEL = ref_CL_SALV_LAYOUT_GRID->CREATE_LABEL(

                                              TEXT   = '1.1 LABEL'

                                              ROW    = 1

                                              COLUMN = 2 ).

 

  ref_CL_SALV_FORM_TEXT = ref_CL_SALV_LAYOUT_GRID->CREATE_TEXT(

                                              TEXT   = '1.2 TEXT'

                                              ROW    = 1

                                              COLUMN = 2 ).

 

  ref_CL_SALV_FORM_LABEL->SET_LABEL_FOR( ref_CL_SALV_FORM_TEXT ).                                             

 

  ref_CL_SALV_FORM_TEXT = ref_CL_SALV_LAYOUT_GRID->CREATE_TEXT(

                                              TEXT   = '2.2 TEXT'

                                              ROW    = 2

                                              COLUMN = 2 ).

  ref_CL_SALV_TABLE->SET_TOP_OF_LIST( ref_CL_SALV_LAYOUT_GRID ).

 

  " Display Table

  ref_CL_SALV_TABLE->DISPLAY( ).

 

 

Thanks again guys. (PS: if I change CL_SALV_LAYOUT_GRID to CL_SALV_LAYOUT, I get the message that "CREATE_LABEL" is Private or Protected (Unknown) to CL_SALV_LAYOUT


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>