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: 

ALV HELP1

Former Member
0 Kudos

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

8 REPLIES 8

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Your program is actually working perfectly fine in my 46c system. I did move the changeing of the MATNR field to a non-key field logic before the actual call to the REUSE_ALV_GRID_DISPLAY function module.

Regards,

Rich Heilman

0 Kudos

Hi rich i m working in 5.0 i m getting error.

can u plzz clarify.

Regards,

Kavita

0 Kudos

Hello Frnds,

Can anyone give me some clues why this program is having problem.

and whst the difference between field catalog merge and manual building fieldcatalog like given in above post.

Thanking u all.

Regards,

kavita

0 Kudos

Hi Kavita,

I think inthis program in the function module <b>REUSE_ALV_FIELDCATALOG_MERGE</b>

in exporting parameter you are using -->

<b>I_INTERNAL_TABNAME = 'GIT_RAMS'</b>

this GIT_RAMS is not like any physical structure .So make a structure through SE11 like GIT_RAMS.

Otherwise <b>manually build the fieldcatalog</b>.

find the following code as an example.

DATA : l_pos TYPE i VALUE 1.


  ist_fieldcat-fieldname = 'POSID'.
  ist_fieldcat-tabname   = 'IT_FINAL'.
  ist_fieldcat-outputlen = 24.
  ist_fieldcat-col_pos   = l_pos.
*  ist_fieldcat-ddictxt = 'L'.
  ist_fieldcat-key = 'X'.
  ist_fieldcat-seltext_l = 'Appropriation Request Number'.

  APPEND ist_fieldcat.
  CLEAR ist_fieldcat.


  l_pos = l_pos + 1.
  ist_fieldcat-fieldname = 'TXT04'.
  ist_fieldcat-tabname   = 'IT_FINAL'.
  ist_fieldcat-outputlen = 4.
  ist_fieldcat-col_pos   = l_pos.
  ist_fieldcat-ddictxt = 'L'.
*  ist_fieldcat-key = 'X'.
  ist_fieldcat-seltext_l = 'Status'.
  ist_fieldcat-EMPHASIZE = 'C400'.
  APPEND ist_fieldcat.
  CLEAR ist_fieldcat.

  l_pos = l_pos + 1.
  ist_fieldcat-fieldname = 'UDATE'.
  ist_fieldcat-tabname   = 'IT_FINAL'.
  ist_fieldcat-outputlen = 8.
  ist_fieldcat-col_pos   = l_pos.
  ist_fieldcat-ddictxt = 'L'.
  ist_fieldcat-key = 'X'.
  ist_fieldcat-seltext_l = 'Status Date'.
*  IST_FIELDCAT-EMPHASIZE = 'C600'.
  APPEND ist_fieldcat.
  CLEAR ist_fieldcat.



<b><i>Reward point if find helpful

Debjani</i></b>

0 Kudos

Hi Debjani,

Thnks for ur reply. But i have already delcared GIT_RAMS as an internal table then why again creating structure. Ur correct here its not a physical structure. But i want to know is there any other way which can be done and error wont be there in reuse_merge.

Plz help , i m confused in that.

Thnks

kavita

Former Member
0 Kudos

Its very vital frnds.

Thanks,

kavita

0 Kudos

Any help frnds.

Thanks,

kavita

0 Kudos

Hello Kavitha,

u have to create a structure in SE11 with the fields, and then pass that structure into the REUSE_ALV_FIELDCATALOG_MERGE , in the parameter

I_internal_tabname = ' structure name '.

even though u create a structure, u need to pass it to the table parameter.

then it will work.