Skip to Content
0
Former Member
Jul 18, 2007 at 05:33 PM

ALV HELP1

31 Views

Hi Help me to know whts wrong in this code. When i m executig by providing selection data, i m getting dump error as size of fieldcatalog more than internal table.

<code>tables: mara.

TYPE-POOLS : SLIS.

DATA : begin of GIT_RAMS OCCURS 0,

matnr LIKE mara-matnr,

ersda LIKE mara-ersda,

ernam LIKE mara-ernam,

lvorm like mara-lvorm,

end of GIT_RAMS.

data : REPID TYPE SY-REPID,

FIELD_CAT type SLIS_T_FIELDCAT_ALV,

WA_FLDCAT LIKE LINE OF FIELD_CAT.

selection-screen begin of block b1 with frame title text-001.

select-options : S_ersda for MARA-ersda.

selection-screen end of block b1.

initialization.

REPID = SY-REPID.

at selection-screen.

  • if s_ersda-low is initial.

  • message e000 with 'plz enter some value'.

  • exit.

  • endif.

start-of-selection.

  • perform get_data.

*PERFORM FILED_CATALOG.

*PERFORM DISPLAY_DATA.

select matnr

ersda

ernam

lvorm

from mara

into table git_rams

where ersda in s_ersda.

  • if sy-subrc EQ 0.

  • SORT GIT_RAMS BY MATNR.

*endif.

  • form filed_catalog.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = REPID

I_INTERNAL_TABNAME = 'GIT_RAMS'

  • I_STRUCTURE_NAME = I_STRUCTURE_NAME

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = REPID

I_BYPASSING_BUFFER = 'X'

I_BUFFER_ACTIVE = ' '

CHANGING

ct_fieldcat = FIELD_CAT.

  • EXCEPTIONS

  • INCONSISTENT_INTERFACE = 1

  • PROGRAM_ERROR = 2

  • OTHERS = 3

  • .

  • IF sy-subrc <> 0.

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

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

  • ENDIF.

  • endform.

  • end-of-selection.

    *FORM DISPLAY_DATA.

    *LOOP AT GIT_RAMS.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    *I_INTERFACE_CHECK = ' '

    I_BYPASSING_BUFFER = 'X'

    I_BUFFER_ACTIVE = ' '

    I_CALLBACK_PROGRAM = REPID

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = ' '

    • I_STRUCTURE_NAME = I_STRUCTURE_NAME

    • IS_LAYOUT = IS_LAYOUT

    IT_FIELDCAT = FIELD_CAT

    • IT_EXCLUDING = IT_EXCLUDING

    • IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

    • IT_SORT = IT_SORT

    • IT_FILTER = IT_FILTER

    • IS_SEL_HIDE = IS_SEL_HIDE

    • I_DEFAULT = 'X'

    • I_SAVE = ' '

    • IS_VARIANT = IS_VARIANT

    • IT_EVENTS = IT_EVENTS

    • IT_EVENT_EXIT = IT_EVENT_EXIT

    • IS_PRINT = IS_PRINT

    • IS_REPREP_ID = IS_REPREP_ID

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • IR_SALV_LIST_ADAPTER = IR_SALV_LIST_ADAPTER

    • IT_EXCEPT_QINFO = IT_EXCEPT_QINFO

    • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

    • ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER

    TABLES

    t_outtab = GIT_RAMS.

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

    *ENDLOOP.

    *ENDFORM.

    • form get_data.

    • select matnr ersda ernam from mara into table git_rams where ersda in s_ersda .

    • if sy-subrc = 0.

    • sort git_rams by matnr.

    • endif.

    • endform.

    DATA: LV_TABIX TYPE SY-TABIX.

    LOOP AT FIELD_CAT INTO WA_FLDCAT.

    LV_TABIX = SY-TABIX.

    CASE WA_FLDCAT-FIELDNAME.

    WHEN 'MATNR'.

    WA_FLDCAT-KEY = ' '.

    ENDCASE.

    MODIFY FIELD_CAT FROM WA_FLDCAT INDEX LV_TABIX.

    ENDLOOP.</code>

    One more thing i m not getting the difference between manuals building the fildcatalog and using fild catalog merge. <code> *Manualy means : some what in this

    <code> WHEN 'EBELN'.

    WA_FLDCAT_HEAD-COL_POS = '1'.

    WA_FLDCAT_HEAD-JUST = 'C'.

    WA_FLDCAT_HEAD-OUTPUTLEN = '15'.

    WA_FLDCAT_HEAD-SELTEXT_L = 'Purchase Doc'."long key word

    WA_FLDCAT_HEAD-SELTEXT_M = 'Purch Doc'. "middle key word

    WA_FLDCAT_HEAD-SELTEXT_S = 'Purch Doc '. "short text

    WA_FLDCAT_HEAD-HOTSPOT = 'X'.</code>

    Thanks,

    Kavita

    Message was edited by:

    kavita kashyap