Skip to Content
avatar image
-3
Former Member

Cannot access object inside include.

"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 ....

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Aug 17, 2017 at 09:46 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 17, 2017 at 05:41 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 16, 2017 at 08:17 PM

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

    Add comment
    10|10000 characters needed 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..