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: 

error in screen output

former_member574106
Participant
0 Kudos

Hi friends,

I am Saurav Lahiry. I am designing my first OO ALV application. In my screen 100 layout, i am unable to paste custom control inside the screen. How to correct the layout ? Secondly, when i am placing the debugger on set_table_for_first_display method, it is not getting executed. What is the issue ?

Regards,

Saurav Lahiry

1 ACCEPTED SOLUTION

Chintu6august
Contributor
0 Kudos

Hi,

you need to create instance of Custom Container and Grid and call the method set_Table_for_first_display in PBO of the screen.

PBO of the screen.

create object of custom container.

create object of Grid.

call method object_grid->set_table_for_first_display.

thanks!!

9 REPLIES 9

former_member185613
Contributor
0 Kudos

Hi Saurav,

You have written logic for fetching and display of data in class methods but from the attachment you have provided, it looks like you have only created instance of the local class but haven't called the methods to fetch and display data. This possibly is the reason for getting an empty screen as the output.

Regards,

~Athreya

0 Kudos

Hi Athreya,

Thanks a lot for the input. Since, i am a beginner i did not understand the explanation clearly. Could u send a sample code for better understanding.

Regards,

Saurav Lahiry

0 Kudos

Hi Saurav,

In PBO of screen 100, you can write the below statements to fetch and display the data in ALV.

w_obj->fetch_data().

w_obj->fieldcatalog().

w_obj->display_data().

Hope it helps,

~Athreya

0 Kudos

Hi Athreya,

Thanks for the help. That issue got solved. Now on executing , an error fieldcatalog not found is coming. What is the reason ? Please check the code below.

TYPES : BEGIN OF ty_vbap,

        vbeln TYPE vbeln,

        posnr TYPE posnr_va,

        END OF ty_vbap.

DATA : it_vbap TYPE TABLE OF ty_vbap,

       wa_vbap TYPE ty_vbap.

DATA : t_output_table TYPE TABLE OF ty_vbap.

DATA : w_container TYPE REF TO cl_gui_custom_container,

       w_grid TYPE REF TO cl_gui_alv_grid.

DATA : wa_fieldcat TYPE lvc_s_fcat,

       it_fieldcat TYPE lvc_t_fcat.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE  text-001.

PARAMETERS : p_vbeln TYPE vbak-vbeln.

SELECTION-SCREEN END OF BLOCK b1.

CLASS lcl_saurav DEFINITION.

PUBLIC SECTION.

METHODs : fetch_data ,

           display_data.

* ENDMETHOD.

METHODs fieldcatalog.

ENDCLASS.

CLASS lcl_saurav IMPLEMENTATION.

METHOD fetch_data.

SELECT vbeln

        posnr

        FROM vbap

        INTO TABLE it_vbap

        WHERE vbeln = p_vbeln.

* ENDMETHOD.

CREATE OBJECT W_CONTAINER

EXPORTING

*     PARENT                      =

     CONTAINER_NAME              = 'CUSTOM'

*     STYLE                       =

*     LIFETIME                    = lifetime_default

*     REPID                       =

*     DYNNR                       =

*     NO_AUTODEF_PROGID_DYNNR     =

*   EXCEPTIONS

*     CNTL_ERROR                  = 1

*     CNTL_SYSTEM_ERROR           = 2

*     CREATE_ERROR                = 3

*     LIFETIME_ERROR              = 4

*     LIFETIME_DYNPRO_DYNPRO_LINK = 5

*     others                      = 6

     .

IF SY-SUBRC <> 0.

*  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CREATE OBJECT W_GRID

EXPORTING

*     I_SHELLSTYLE      = 0

*     I_LIFETIME        =

     I_PARENT          = w_container

*     I_APPL_EVENTS     = space

*     I_PARENTDBG       =

*     I_APPLOGPARENT    =

*     I_GRAPHICSPARENT  =

*     I_NAME            =

*     I_FCAT_COMPLETE   = SPACE

*   EXCEPTIONS

*     ERROR_CNTL_CREATE = 1

*     ERROR_CNTL_INIT   = 2

*     ERROR_CNTL_LINK   = 3

*     ERROR_DP_CREATE   = 4

*     others            = 5

     .

IF SY-SUBRC <> 0.

*  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDMETHOD.

* CALL METHOD fieldcatalog.

METHOD display_data.

CALL METHOD w_grid->SET_TABLE_FOR_FIRST_DISPLAY

*   EXPORTING

*     I_BUFFER_ACTIVE               =

*     I_BYPASSING_BUFFER            =

*     I_CONSISTENCY_CHECK           =

*     I_STRUCTURE_NAME              =

*     IS_VARIANT                    =

*     I_SAVE                        =

*     I_DEFAULT                     = 'X'

*     IS_LAYOUT                     =

*     IS_PRINT                      =

*     IT_SPECIAL_GROUPS             =

*     IT_TOOLBAR_EXCLUDING          =

*     IT_HYPERLINK                  =

*     IT_ALV_GRAPHICS               =

*     IT_EXCEPT_QINFO               =

*     IR_SALV_ADAPTER               =

CHANGING

     IT_OUTTAB                     = t_output_table

     IT_FIELDCATALOG               = it_fieldcat

*     IT_SORT                       =

*     IT_FILTER                     =

*   EXCEPTIONS

*     INVALID_PARAMETER_COMBINATION = 1

*     PROGRAM_ERROR                 = 2

*     TOO_MANY_LINES                = 3

*     others                        = 4

         .

IF SY-SUBRC <> 0.

*  Implement suitable error handling here

ENDIF.

ENDMETHOD.

METHOD fieldcatalog.

wa_fieldcat-fieldname = 'VBELN'.

wa_fieldcat-tabname = 'T_OUTPUT_TABLE'.

wa_fieldcat-col_pos   = 1.

APPEND wa_fieldcat TO it_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'POSNR'.

wa_fieldcat-tabname = 'T_OUTPUT_TABLE'.

wa_fieldcat-col_pos   = 1.

APPEND wa_fieldcat TO it_fieldcat.

CLEAR wa_fieldcat.

  1. ENDMETHOD.
  2. ENDCLASS.

DATA : w_obj TYPE REF TO lcl_saurav.

START-OF-SELECTION.

CREATE OBJECT w_obj.

*START-OF-SELECTION.

CALL SCREEN 100.

*&---------------------------------------------------------------------*

*&      Module STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE STATUS_0100 OUTPUT.

*  SET PF-STATUS 'xxxxxxxx'.

SET TITLEBAR 'SAURAV'.

w_obj->fetch_data( ).

w_obj->display_data( ).

w_obj->fieldcatalog( ).

  1. ENDMODULE.                 " STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*

*&      Module USER_COMMAND_0100  INPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE USER_COMMAND_0100 INPUT.

data : ok_code TYPE sy-ucomm.

CASE ok_code.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE.                 " USER_COMMAND_0100  INPUT


Regards,

Saurav Lahiry

0 Kudos

Hi Saurav,

w_obj->fieldcatalog() should appear before w_obj->display_data() call.

Regards,

~Athreya

former_member243716
Active Participant
0 Kudos

.... end-of-selection.         call screen 1001.               "    |               "    V *PROCESS BEFORE OUTPUT. *  MODULE PBO_1001. ** *PROCESS AFTER INPUT. *  MODULE PAI_1001.         FORM display_grid1.   if not l_alv1 is initial.     call method l_alv1->refresh_table_display.     exit.   endif. * Settare ridimensionamento nel container (layout dynpro)   create object container1     exporting       container_name = 'CONTAINER1'.  "container disegnato in layout dynpro       "lifetime      = 1.   CREATE OBJECT l_alv1 EXPORTING i_parent = container1.   PERFORM fill_catalog1.   perform gest_layout1.   CALL METHOD l_alv1->set_table_for_first_display       EXPORTING         "I_BUFFER_ACTIVE         "I_BYPASSING_BUFFER         "I_CONSISTENCY_CHECK         "I_STRUCTURE_NAME = gf_STRUCTURE_NAME1         "IS_VARIANT = gs_VARIANT         "I_SAVE = gf_save         "I_DEFAULT         IS_LAYOUT  = gs_layout1         "IS_PRINT         "IT_SPECIAL_GROUPS         "IT_TOOLBAR_EXCLUDING = gt_TOOLBAR_EXCLUDING         "IT_HYPERLINK         "IT_ALV_GRAPHICS         "IT_EXCEPT_QINFO         "IR_SALV_ADAPTER       CHANGING         it_outtab        = tableint[]         "IT_SORT          = gt_sort         "IT_FILTER         it_fieldcatalog = gt_FIELDCATALOG. ENDFORM.                    " display_grid MODULE PBO_1001 OUTPUT.   SET PF-STATUS '1001'.   sET TITLEBAR '1000'.   perform display_grid1. ENDMODULE.                " PBO  OUTPUT

Message was edited by: Cristiano Ventura

Chintu6august
Contributor
0 Kudos

Hi,

you need to create instance of Custom Container and Grid and call the method set_Table_for_first_display in PBO of the screen.

PBO of the screen.

create object of custom container.

create object of Grid.

call method object_grid->set_table_for_first_display.

thanks!!

0 Kudos

Hi Chintu,

Thanks for the tips.It came correctly.

Regards,

Saurav Lahiry

former_member241258
Active Participant
0 Kudos

hi

for debug the standard methods. u have to set following settings.