Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

class method oops alv grid display error

pashasapcha
Participant
0 Kudos
508

with regards to oops, I have declared 3 methods inside class definition.

1. getdata

2. display

3. handle_hotspot_click

in get data method the code is as below.

You can see I have called display inside method getdata.

in the method display I have called screen 200. (to display alv grid).The pbo of the screen 200 is to display alv grid.

I have given types and data declaration is protected section of the class.

after the start of selection, I am calling method using object (instance method).

As all the methods are inside the same class, Ideally , I should not face any issue in accessing the data.

But it is showing the internal table as unknown.

can some one suggest me why it is throwing error as I am working in the same class methods ?

4 REPLIES 4

roberto_forti
Contributor
0 Kudos
431

Hi Mohammad Pasha

Think about coding using the class: cl_salv_table=>factory(...)

Robert

Sandra_Rossi
Active Contributor
0 Kudos
431

Based on the code you have posted, nowhere you have defined LT_FINAL hence the error.

Maybe you are using Ctrl+F3 (activate current include) to activate your code instead of Ctrl+F7 (activate all includes).

pashasapcha
Participant
0 Kudos
431

DATA : user_cont TYPE REF TO cl_gui_custom_container,
user_grid TYPE REF TO cl_gui_alv_grid.
Data : gs_layout type LVC_S_LAYO.
data : LT_FCAT type LVC_T_FCAT,
LS_FCAT LIKE LINE OF LT_FCAT.

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME title t1.

SELECT-OPTIONS : so_bname FOR lv_bname.
SELECT-OPTIONS : so_date FOR lv_date.
SELECT-OPTIONS : SO_uflag for lv_uflag.
SELECTION-SCREEN : END OF BLOCK b1.

SELECTION-SCREEN : BEGIN OF BLOCK B2 with frame title t2.

PARAMETERS : R1 RADIOBUTTON GROUP RG1 DEFAULT 'X',
R2 RADIOBUTTON GROUP RG1,
R3 RADIOBUTTON GROUP RG1,
R4 RADIOBUTTON GROUP RG1.
SELECTION-SCREEN : END OF BLOCK B2.

SELECTION-SCREEN : BEGIN OF BLOCK B3 WITH FRAME TITLE T3.
PARAMETERS: P_FILE TYPE RLGRAP-FILENAME.
SELECTION-SCREEN : END OF BLOCK B3." WITH FRAME TITLE T3.



CLASS lcl_user DEFINITION.
PUBLIC SECTION.

METHODS :getdata,
display,
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid IMPORTING e_row_id.


PROTECTED SECTION.
DATA : lv_date TYPE usr02-trdat,
lv_bname type usr02-bname,
lv_uflag type usr02-uflag.

TYPES : BEGIN OF ty_final,

bname TYPE usr02-bname,
CLASS TYPE usr02-class,
GLTGV type usr02-gltgv,
GLTGB TYPE USR02-GLTGB,
uflag TYPE usr02-uflag,
uflag_des TYPE CHAR100,
aname TYPE usr02-aname,
erdat TYPE usr02-erdat,
trdat TYPE usr02-trdat,
ltime TYPE usr02-ltime,
name_first TYPE user_addr-name_first,
name_last TYPE user_addr-name_last,
name_textc TYPE user_addr-name_textc,
tel_extens TYPE user_addr-tel_extens,
roomnumber TYPE user_addr-roomnumber,
department TYPE user_addr-department,
END OF ty_final.

DATA : lt_final TYPE TABLE OF ty_final,
ls_final TYPE ty_final.
"***************************************************************

TYPES : BEGIN OF ty_final1,
bname TYPE usr02-bname,
CLASS TYPE usr02-class,
GLTGV type usr02-gltgv,
GLTGB TYPE USR02-GLTGB,
uflag TYPE usr02-uflag,

aname TYPE usr02-aname,
erdat TYPE usr02-erdat,
trdat TYPE usr02-trdat,
ltime TYPE usr02-ltime,
name_first TYPE user_addr-name_first,
name_last TYPE user_addr-name_last,
name_textc TYPE user_addr-name_textc,
tel_extens TYPE user_addr-tel_extens,
roomnumber TYPE user_addr-roomnumber,
department TYPE user_addr-department,
END OF ty_final1.
DATA : lt_final1 TYPE TABLE OF ty_final1,
ls_final1 TYPE ty_final1.




TYPES:
BEGIN OF ty_data,
uflag TYPE xuuflag,
* uflag_descr TYPE c LENGTH 60,
END OF ty_data.

TYPES tt_data TYPE STANDARD TABLE OF ty_data WITH DEFAULT KEY.
ENDCLASS.

Every thing was working fine as long as I kept the above types and data declarations outside the class.As I am using the oops abap, so I was planning to make the method public and its types and data declarations under protected section.

FredericGirod
Active Contributor
0 Kudos
431

You have declare something in the protected section of a class and you expect to be access from a MODULE of a Dynpro ?

First of all, WHY did you try to declare this in the class and why in the protected section ?

Why do you put ":" after statement METHOD ?

Why do you use local class ?

Why do you use old method statement : CREATE OBJECT blabla. ==> blabla = new class( importing_param = 'toto' ).

So.

in a program, the data declared before the local class definition could be accessed by anybody.

The data declare in the public section of a local class, could be accessed by the program through an instance of a class.

The data declare in the protected section of a local class, could be accessed only by a LOCAL FRIEND of the local class (pretty sure you don't want that).


Fred