Application Development and Automation 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: 
Read only

Field Catalog

Former Member
0 Likes
797

Hi ,

I have created a FM in which I have defind a internal table in the table interface of FM with associated type STANDARD TABLE now I want to create a field catalog based on this internal table.

can anybody tell help me how to do this?

Thanx

Hi ,

I have created a FM in which I have defind a internal table in the table interface of FM with associated type STANDARD TABLE now I want to create a field catalog based on this internal table.

can anybody tell help me how to do this?

Thanx

5 REPLIES 5
Read only

Former Member
0 Likes
749

use Fm to create fieldcatalog -

here repid contains sy-repid..

repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = repid

I_INTERNAL_TABNAME = 'ITAB' "internal table name

I_STRUCTURE_NAME = 'ZGILL_MAIN' "sp[ecify database table name otherwise comment this line

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_INCLNAME =

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

ct_fieldcat = d_fcat[]

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3.

reward points

Message was edited by:

Amit Tyagi

Read only

0 Likes
749

It's not working because I have defind the internal table in the table interface of a function module with type STANDARD TABLE.

Read only

Former Member
Read only

Former Member
0 Likes
749

hi vinita,

i have given u the sample coding here,from that u can understand how to carry fieldcatalog and how to call that . understand this program and apply it in ur code.

PROGRAM ZMG_ALV5 .

tables : spfli,sflight.

data : ref1 type ref to cl_gui_custom_container,

ref2 type ref to cl_gui_alv_grid.

data : FCAT TYPE LVC_T_FCAT,

WA TYPE LVC_S_FCAT,

WA_LAYO TYPE LVC_S_LAYO.

types : BEGIN OF T_TABLE,

CARRID TYPE SFLIGHT-CARRID,

CONNID TYPE SFLIGHT-CONNID,

CITYFROM TYPE SPFLI-CITYFROM,

CITYTO TYPE SPFLI-CITYTO,

FLTIME TYPE SPFLI-FLTIME,

END OF T_TABLE.

DATA ITAB TYPE TABLE OF T_TABLE.

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

case sy-ucomm.

when'DISP'.

SELECT SFLIGHTCARRID SFLIGHTCONNID SPFLICITYFROM SPFLICITYTO

SPFLI~FLTIME

INTO CORRESPONDING FIELDS OF TABLE ITAB FROM SFLIGHT

INNER JOIN SPFLI

ON SFLIGHTCARRID = SPFLICARRID

AND SFLIGHTCONNID = SPFLICONNID

WHERE SFLIGHT~CARRID = SFLIGHT-CARRID

AND SFLIGHT~CONNID = SFLIGHT-CONNID.

call screen 200.

WHEN 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module STATUS_0200 OUTPUT

&----


  • text

----


MODULE STATUS_0200 OUTPUT.

SET PF-STATUS 'GUI'.

SET TITLEBAR 'TITLE'.

IF SY-UCOMM = 'BACK'.

CALL SCREEN 100.

ENDIF.

PERFORM FORM_FCAT.

PERFORM FORM_LAYO.

IF REF1 IS initial.

CREATE OBJECT REF1

EXPORTING

  • PARENT = ref1

CONTAINER_NAME = 'CUST_CON'

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

ENDIF.

if ref2 is initial.

CREATE OBJECT REF2

EXPORTING

  • I_SHELLSTYLE = 0

  • I_LIFETIME =

I_PARENT = ref1

  • I_APPL_EVENTS = space

  • I_PARENTDBG =

  • I_APPLOGPARENT =

  • I_GRAPHICSPARENT =

  • I_NAME =

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.

ENDIF.

CALL METHOD REF2->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 = WA_LAYO

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

IT_OUTTAB = ITAB

IT_FIELDCATALOG = FCAT

  • IT_SORT =

  • IT_FILTER =

  • EXCEPTIONS

  • INVALID_PARAMETER_COMBINATION = 1

  • PROGRAM_ERROR = 2

  • TOO_MANY_LINES = 3

  • others = 4

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDMODULE. " STATUS_0200 OUTPUT

&----


*& Form FORM_FCAT

&----


  • text

----


FORM FORM_FCAT.

CLEAR FCAT.

CLEAR WA.

WA-FIELDNAME = 'CARRID'.

WA-COL_POS = 1.

WA-SCRTEXT_L = ' CARRIER ID'.

APPEND WA TO FCAT.

CLEAR WA.

WA-FIELDNAME = 'CONNID'.

WA-COL_POS = 2.

WA-SCRTEXT_L = ' CONNECTION ID'.

APPEND WA TO FCAT.

CLEAR WA.

WA-FIELDNAME = 'CITYFROM'.

WA-COL_POS = 3.

WA-SCRTEXT_L = ' CITY FROM'.

APPEND WA TO FCAT.

CLEAR WA.

WA-FIELDNAME = 'CITYTO'.

WA-COL_POS = 4.

WA-SCRTEXT_L = ' CITY TO'.

APPEND WA TO FCAT.

CLEAR WA.

WA-FIELDNAME = 'FLTIME'.

WA-COL_POS = 5.

WA-SCRTEXT_L = ' FLYING TIME'.

APPEND WA TO FCAT.

ENDFORM. " FORM_FCAT

&----


*& Module USER_COMMAND_0200 INPUT

&----


  • text

----


MODULE USER_COMMAND_0200 INPUT.

CASE SY-UCOMM.

WHEN 'BACK'.

LEAVE TO SCREEN 100.

WHEN 'CANCEL'.

LEAVE PROGRAM.

WHEN 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_0200 INPUT

FORM FORM_LAYO .

CLEAR WA_LAYO.

WA_LAYO-ZEBRA = 'X'.

WA_LAYO-GRID_TITLE = 'GRID TITLE'.

WA_LAYO-NO_TOOLBAR = 'X'.

ENDFORM. " FORM_LAYO

*CALL FUNCTION 'K_KKB_OUTTAB_SORT_CRITERIA'

  • EXPORTING

  • it_fieldcat = FCAT

  • is_layout = WA_LAYO

    • I_LISTTYPE = 'S'

    • changing

    • ct_sort =

.

with regards,

magesh.

Read only

0 Likes
749

Hi magesh,

it will not work as we get the structure of internal table at run time.