Skip to Content
-3

Cannot access object inside include.

Aug 16, 2017 at 11:52 AM

65

avatar image
Former Member

"Here is my code...

*&---------------------------------------------------------------------*
*& Report ZMS_TEST14
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

INCLUDE ZMS_TEST14_TOP . " global Data

* INCLUDE ZMS_TEST14_F01 . " FORM-Routines

INITIALIZATION.

AT SELECTION-SCREEN.


INCLUDE ZMS_TEST14_CI01. " Definition and implementation of lcl_po class..

START-OF-SELECTION.
data: po type ref to lcl_po.
create object po.

CALL METHOD po->get_sflight.


INCLUDE ZMS_TEST14_O01 . " PBO-Modules
INCLUDE ZMS_TEST14_I01 . " PAI-Modules

-----------------------------------------------------------------------------------------------------

"My problem is I cannot access object po in my PBO-Modules..

"Here is my PBO-Module code..

*&---------------------------------------------------------------------*
*& Include ZMS_TEST14_O01
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module STATUS_9003 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*

MODULE STATUS_9003 OUTPUT.
SET PF-STATUS 'SELECT PO'.
SET TITLEBAR 'SELECT PO'.

CREATE OBJECT OB_CONT
EXPORTING
* PARENT =
CONTAINER_NAME = 'CONTAINER'.


CREATE OBJECT OB_GRID
EXPORTING
* I_SHELLSTYLE = 0
* I_LIFETIME =
I_PARENT = ob_cont.


set HANDLER po->add_toolbar_but for ob_grid.

set HANDLER po->add_double_click for ob_grid.
set HANDLER po->add_menu_but for ob_grid.
set HANDLER po->add_user_command_insert for ob_grid.

CALL METHOD OB_GRID->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING
IT_OUTTAB = it_sflight
IT_FIELDCATALOG = it_fld.

ENDMODULE. " STATUS_9003 OUTPUT

"_________________________________________________________

And I keep getting error Field PO is unknown ....

10 |10000 characters needed characters left characters exceeded

Please post code using code formatting

0

Is it a syntax error?

Or is it a short dump?

Please post the exact message, and indicate at which line of the source code and include it corresponds.

0
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Bertrand DELVALLEE Aug 17, 2017 at 09:46 AM
1

Hello,

Your mistake is to consider screen 9003, container ob_cont and grid OB_GRID as one "big display object".

Screen 9003 only have to deal with status GUI, title GUI and GUI exit functions.

MODULE status_9003 OUTPUT.
 SET PF-STATUS 'SELECT PO'.
 SET TITLEBAR 'SELECT PO'.
ENDMODULE.    

MODULE user_command_0100 INPUT.
CASE sy-ucomm.
      WHEN 'BACK'.
        SET SCREEN 0.
        LEAVE SCREEN.
      WHEN 'EXIT'.
        SET SCREEN 0.
        LEAVE SCREEN.
      WHEN 'CANCEL'.
        SET SCREEN 0.
        LEAVE SCREEN.
    ENDCASE.
ENDMODULE.

And, in upper level (in your main program as you posted it) :

CREATE OBJECT OB_CONT
EXPORTING
* PARENT =
CONTAINER_NAME = 'CONTAINER'.

CREATE OBJECT OB_GRID
EXPORTING
I_PARENT = ob_cont.

set HANDLER po->add_toolbar_but for ob_grid.
set HANDLER po->add_double_click for ob_grid.
set HANDLER po->add_menu_but for ob_grid.
set HANDLER po->add_user_command_insert for ob_grid.

CALL METHOD OB_GRID->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING
IT_OUTTAB = it_sflight
IT_FIELDCATALOG = it_fld.

CALL SCREEN 9003.

Best regards

Bertrand

Share
10 |10000 characters needed characters left characters exceeded
Horst Keller
Aug 17, 2017 at 05:41 AM
1

Activate it all despite the errors and check then if the error is still there.

If that doesn't help, show it to an experienced colleague of yours. It is difficult to solve such include problems without looking directly at them - although they are mostly trivial.

Share
10 |10000 characters needed characters left characters exceeded
Sandra Rossi Aug 16, 2017 at 08:17 PM
0

Make sure "INCLUDE ZMS_TEST14_O01" is not entered in the ZMS_TEST14_TOP include too.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

I have called screen in my INCLUDE ZMS_TEST14_CI01. " Definition and implementation of lcl_po class..

Is that making it not reachable??

what should i do? its working fine if i use whole code in the same program. I mean if i use whole code inside my PBO module outside in the same report at the same place it will work fine.please help..

0