cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with "Page down" and "Column width optimize" using SET_TABLE_FOR_FIRST_DISPLAY

dubbaka
Participant
0 Kudos
263

Hello Team,
I am displaying internal table data using "Custom Container" in which we have also added "Sub screen" and some input fields.
However, we are unable to perform Page down and Column width optimize is not working.
Is it because we are using "Sunscreen and Input fields" in the same screen?

dubbaka_0-1716895107605.png

  IF CL_SALV_TABLE=>IS_OFFLINEEQ IF_SALV_C_BOOL_SAP=>FALSE.
    CREATE OBJECT GR_CONTAINER_ASN
      EXPORTING
        CONTAINER_NAME 'CUST_ASN'"CONTAINER NAME OF ASN
*         LINK ALV GRID WITH CUSTOM CONTAINER OBJECT
    CREATE OBJECT O_GRID_ASN
      EXPORTING
        I_PARENT GR_CONTAINER_ASN.
  ENDIF.

  PERFORM FLDCATVBAK_ASN .
  FREE IS_LAYOUT  .
  CLEAR IS_LAYOUT .
  IS_LAYOUT-STYLEFNAME 'CELLTAB'.
  IS_LAYOUT-CWIDTH_OPT 'X'.
  IS_LAYOUT-INFO_FNAME 'COLOR'.

 CALL METHOD O_GRID_ASN->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      IS_LAYOUT       = IS_LAYOUT
      I_SAVE          = 'A'
    CHANGING
      IT_OUTTAB       = GT_ASN_FINAL
      IT_FIELDCATALOG = GT_FCAT[].

  CALL METHOD O_GRID_ASN->SET_READY_FOR_INPUT
    EXPORTING
      I_READY_FOR_INPUT = 1.

 

Sandra_Rossi
Active Contributor
0 Kudos
What exactly means "is not working"?
View Entire Topic
Sandra_Rossi
Active Contributor
0 Kudos

Create a tiny executable program to see if the code in your big program is the culprit.

As you can see here, there is no problem (NB: the problem is not about the container where you display the ALV grid):

REPORT ztest.
PARAMETERS dummy.

DATA gt_asn_final TYPE TABLE OF T100.
DATA o_grid_asn TYPE REF TO cl_gui_alv_grid.

AT SELECTION-SCREEN OUTPUT.
  IF o_grid_asn IS NOT BOUND.
    SELECT * FROM T100 UP TO 100 ROWS INTO TABLE @GT_asn_final.
    DATA(gt_fcat) = VALUE lvc_t_fcat( ).
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
      EXPORTING
        i_structure_name       = 'T100'
      CHANGING
        ct_fieldcat            = gt_fcat
      EXCEPTIONS
        inconsistent_interface = 1
        program_error          = 2
        OTHERS                 = 3.
    IF sy-subrc <> 0.
    ENDIF.
    o_grid_asn = NEW cl_gui_alv_grid( i_parent = cl_gui_container=>screen0 ).
    o_grid_asn->set_table_for_first_display(
        EXPORTING
          is_layout       = VALUE #( cwidth_opt = 'X'
                                     edit       = 'X' )
          i_save          = 'A'
        CHANGING
          it_outtab       = gt_asn_final
          it_fieldcatalog = gt_fcat[] ).
  ENDIF.

Sandra_Rossi_0-1716907416650.png