Skip to Content
avatar image
Former Member

problem in alv grid(very Urgent)

Hi all,

i got the output in sorted order but when i take the print out it is not giving the same output as it was showing on the list...

what could be the problem....plz help me out its urgent i neeed to delever it

Thanks in advance...

regards

Ravi V Ganji

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    May 10, 2006 at 09:07 AM

    Unless you have created your field catalog and have missed out giving some data in there, it will print in the same order.

    Post the code of how you are building the field catalog.

    Regards,

    Ravi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 10, 2006 at 09:05 AM

    Hai Ravi

    Check the following Code

    &----


    *& Report ZALV_GRID *

    *& *

    &----


    *& *

    *& *

    &----


    REPORT ZALV_GRID.

    TABLES: MARA.

    TYPE-POOLS : SLIS.

    *----


    • Data declaration

    *----


    DATA: BEGIN OF I_MARA OCCURS 0.

    INCLUDE STRUCTURE MARA.

    DATA: END OF I_MARA.

    DATA: V_REPID LIKE SY-REPID.

    *----


    • selection-screen

    *----


    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

    SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.

    PARAMETERS: P_MTART LIKE MARA-MTART DEFAULT 'ROH'.

    SELECTION-SCREEN END OF BLOCK B1.

    *----


    • initialisation

    *----


    INITIALIZATION.

    S_MATNR-LOW = '1400'.

    S_MATNR-HIGH = '1500'.

    APPEND S_MATNR.

    V_REPID = SY-REPID.

    *----


    • start-of-selection

    *----


    START-OF-SELECTION.

    SELECT * FROM MARA

    INTO TABLE I_MARA

    WHERE MATNR IN S_MATNR AND

    MTART = P_MTART.

    if sy-subrc = 0.

    sort i_mara by Matnr.

    endif.

    CHECK SY-SUBRC = 0.

    *----


    • end of selection

    *----


    END-OF-SELECTION.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE = ' '

    • I_CALLBACK_PROGRAM = ' '

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = ' '

    I_STRUCTURE_NAME = 'MARA'

    • IS_LAYOUT =

    • IT_FIELDCAT =

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT = 'X'

    • I_SAVE = ' '

    • IS_VARIANT =

    • IT_EVENTS =

    • IT_EVENT_EXIT =

    • IS_PRINT =

    • IS_REPREP_ID =

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    T_OUTTAB = I_MARA

    • EXCEPTIONS

    • PROGRAM_ERROR = 1

    • OTHERS = 2

    .

    IF SY-SUBRC <> 0.

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

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

    ENDIF.

    Thanks & regards

    Sreenivasulu P

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 10, 2006 at 09:13 AM

    Hello Ravi,

    What is it not shown in print preview? What is the problem ?

    Can you post the code? I will check it out .

    <i><b>Best regards,

    Venkat.O</b></i>

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 10, 2006 at 09:13 AM

    do this and then u will have no probs with display too

    FORM SORT_FUNC.
    
      WA_SORT-SPOS = '1'.
      WA_SORT-FIELDNAME = 'MTART'.
      WA_SORT-TABNAME = 'IT_MARA'.
      WA_SORT-UP = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
    
      WA_SORT-SPOS = '2'.
      WA_SORT-FIELDNAME = 'MATKL'.
      WA_SORT-TABNAME = 'IT_MARA'.
      WA_SORT-UP = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
    
      WA_SORT-SPOS = '3'.
      WA_SORT-FIELDNAME = 'MATKL'.
      WA_SORT-TABNAME = 'IT_MARA'.
      WA_SORT-UP = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
    
      WA_SORT-SPOS = '4'.
      WA_SORT-FIELDNAME = 'NTGEW'.
      WA_SORT-TABNAME = 'IT_MARA'.
      WA_SORT-UP = 'X'.
      WA_SORT-SUBTOT = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
    
      WA_SORT-SPOS = '5'.
      WA_SORT-FIELDNAME = 'MATNR'.
      WA_SORT-TABNAME = 'IT_MARA'.
      WA_SORT-UP = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
    
    
    ENDFORM.                    "SORT_FUNC
    
    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 10, 2006 at 09:16 AM

    When an ALV GRID is printed, it is converted into an ALV List. In the list, you have additional events (i.e. TOP_OF_PAGE,...) processed. Also, special table fields for colors or icons may cause trouble if not properly defined.

    You can check the behavior using the print-preview icon in the grid top row.

    Add comment
    10|10000 characters needed characters exceeded