Skip to Content
0
Former Member
Aug 13, 2007 at 07:16 AM

REGARDING ALV

11 Views

hi experts,

i stuck in a problem of alv..m sending u the code..it is giving an error that field catalog is not found..plz tell me where i have done mistake.

REPORT ZMM_R_PO .

TABLES: EKKO,EKPO.

TYPE-POOLS SLIS.

TYPES: BEGIN OF T_EKKO,

EBELN TYPE EKKO-EBELN,

BUKRS TYPE EKKO-BUKRS,

BSART TYPE EKKO-BSART,

LIFNR TYPE EKKO-LIFNR,

SPRAS TYPE EKKO-SPRAS,

ZTERM TYPE EKKO-ZTERM,

END OF T_EKKO.

TYPES: BEGIN OF T_EKPO,

TEBELN TYPE EKPO-EBELN,

EBELP TYPE EKPO-EBELP,

WERKS TYPE EKPO-WERKS,

MATNR TYPE EKPO-MATNR,

MATKL TYPE EKPO-MATKL,

END OF T_EKPO.

DATA: I_EKKO TYPE TABLE OF T_EKKO WITH HEADER LINE,

I_EKPO TYPE TABLE OF T_EKPO WITH HEADER LINE.

DATA:I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,

I_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV,

V_REPID LIKE SY-REPID,

I_KEYINFO TYPE SLIS_KEYINFO_ALV.

SELECT-OPTIONS S_EBELN FOR EKKO-EBELN.

INITIALIZATION.

S_EBELN-LOW = '4500006371'.

S_EBELN-HIGH = '4500012164'.

S_EBELN-SIGN = 'I'.

S_EBELN-OPTION = 'EQ'.

APPEND S_EBELN.

START-OF-SELECTION.

PERFORM GET_DATA.

PERFORM BUILD_FIELDCAT.

PERFORM GET_FIELD.

PERFORM GET_KEY.

PERFORM DISPLAY.

END-OF-SELECTION.

&----


*& Form GET_DATA

&----


  • text

----


FORM GET_DATA.

SELECT EBELN BUKRS BSART LIFNR SPRAS ZTERM FROM EKKO INTO CORRESPONDING FIELDS OF TABLE I_EKKO

WHERE EBELN IN S_EBELN.

SELECT EBELN EBELP WERKS MATNR MATKL FROM EKPO INTO CORRESPONDING FIELDS OF TABLE I_EKPO WHERE EBELN IN S_EBELN.

ENDFORM. "GET_DATA

&----


*& Form BUILD_FIELDCAT

&----


  • text

----


FORM BUILD_FIELDCAT.

I_FIELDCAT-FIELDNAME = 'EBELN'.

I_FIELDCAT-SELTEXT_M = 'PURCHASE ORDER'.

I_FIELDCAT-COL_POS = 0.

I_FIELDCAT-OUTPUTLEN = 10.

I_FIELDCAT-EMPHASIZE = 'X'.

I_FIELDCAT-KEY = 'X'.

APPEND I_FIELDCAT TO I_FIELDCAT.

I_FIELDCAT-FIELDNAME = 'BUKRS'.

I_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.

I_FIELDCAT-COL_POS = 1.

I_FIELDCAT-OUTPUTLEN = 10.

*I_FIELDCAT-EMPHASIZE = 'X'.

*I_FIELDCAT-KEY = 'X'.

APPEND I_FIELDCAT TO I_FIELDCAT.

I_FIELDCAT-FIELDNAME = 'BSART'.

I_FIELDCAT-SELTEXT_M = 'PURCHASING DOC TYPE'.

I_FIELDCAT-COL_POS = 2.

I_FIELDCAT-OUTPUTLEN = 20.

APPEND I_FIELDCAT TO I_FIELDCAT.

I_FIELDCAT-FIELDNAME = 'LIFNR'.

I_FIELDCAT-SELTEXT_M = 'VENDOA ACC NO'.

I_FIELDCAT-COL_POS = 3.

I_FIELDCAT-OUTPUTLEN = 20.

APPEND I_FIELDCAT TO I_FIELDCAT.

I_FIELDCAT-FIELDNAME = 'SPRAS'.

I_FIELDCAT-SELTEXT_M = 'LANG.KEY'.

I_FIELDCAT-COL_POS = 4.

I_FIELDCAT-OUTPUTLEN = 10.

APPEND I_FIELDCAT TO I_FIELDCAT.

I_FIELDCAT-FIELDNAME = 'ZTERM'.

I_FIELDCAT-SELTEXT_M = 'TERMS OF PAYMENT'.

I_FIELDCAT-COL_POS = 4.

I_FIELDCAT-OUTPUTLEN = 20.

APPEND I_FIELDCAT TO I_FIELDCAT.

I_FIELDCAT-FIELDNAME = 'EBELP'.

I_FIELDCAT-SELTEXT_M = 'ITEM NO OF P.DOC'.

I_FIELDCAT-COL_POS = 5.

I_FIELDCAT-OUTPUTLEN = 20.

APPEND I_FIELDCAT TO I_FIELDCAT.

I_FIELDCAT-FIELDNAME = 'MATNR'.

I_FIELDCAT-SELTEXT_M = 'MAT.NO.'.

I_FIELDCAT-COL_POS = 6.

I_FIELDCAT-OUTPUTLEN = 10.

APPEND I_FIELDCAT TO I_FIELDCAT.

I_FIELDCAT-FIELDNAME = 'MATKL'.

I_FIELDCAT-SELTEXT_M = 'MAT GROUP'.

I_FIELDCAT-COL_POS = 7.

I_FIELDCAT-OUTPUTLEN = 10.

APPEND I_FIELDCAT TO I_FIELDCAT.

ENDFORM. "BUILD_FIELDCAT

&----


*& Form GET_FIELD

&----


  • text

----


FORM GET_FIELD.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = V_REPID

I_INTERNAL_TABNAME = 'I_EKKO'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = V_REPID

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = I_FIELDCAT[]

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

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = V_REPID

I_INTERNAL_TABNAME = 'I_EKPO'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = V_REPID

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = I_FIELDCAT[]

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

&----


*& Form GET_KEY

&----


  • text

----


FORM GET_KEY.

I_KEYINFO-HEADER01 = 'EBELN'.

I_KEYINFO-ITEM01 = 'TEBELN'.

ENDFORM. "GET_KEY

*

&----


*& Form DISPLAY

&----


  • text

----


FORM DISPLAY.

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

I_CALLBACK_PROGRAM = V_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • IS_LAYOUT =

IT_FIELDCAT = I_FIELDCAT[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

I_TABNAME_HEADER = 'I_EKKO'

I_TABNAME_ITEM = 'I_EKPO'

  • I_STRUCTURE_NAME_HEADER =

  • I_STRUCTURE_NAME_ITEM =

IS_KEYINFO = I_KEYINFO

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB_HEADER = I_EKKO

T_OUTTAB_ITEM = I_EKPO

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

ENDFORM. "DISPLAY

regards,

raman