Skip to Content
0
Former Member
Nov 07, 2012 at 01:36 AM

ALV Field Catalog

64 Views

Hi there guys

I am fairly new to SAP. Only been using it six months. My employer is exposing me to ABAP slowly and I will be going on a course soon. However in the mean time I was after some help with a little problem I am having.

Our AP team wants a report to show vendor numbers, vendor names, and payment terms. This information is stored in tables LFA1 and LFB1. There needs to be select options of Payment terms, vendor number and company code. Preferably using an ALV grid.

Well I have had a bit of a hack and slash attempt at it...

Basically I have made my selection options and trying to insert them into my t_vendor table (originally i did this as TYPE not DATA but i ran into a field catalog error - which i am still getting - and this was supposed to help lol).

So yea in short, i activate and test the program. After my selection screen i get the error "Field catalog not found". If anybody had any insight into where I am going wrong and can help I would appreciate it.

*&---------------------------------------------------------------------*

*& Report ZSD_VENDOR_TERMS

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT ZSD_VENDOR_TERMS.

TYPE-POOLS: slis.

TABLES: lfa1, lfb1.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS:

s_ccode FOR lfb1-bukrs,

s_zterm FOR lfb1-zterm,

s_vnum FOR lfb1-lifnr."

SELECTION-SCREEN END OF BLOCK b1.

DATA: BEGIN OF t_vendor occurs 0,

name1 LIKE lfa1-name1,

lifnr LIKE lfb1-lifnr,

zterm LIKE lfb1-zterm,

END OF t_vendor.

START-OF-SELECTION.

SELECT lfa1~name1 lfb1~zterm lfb1~lifnr

FROM lfb1

INNER JOIN lfa1 ON lfb1~lifnr = lfa1~lifnr

INTO TABLE t_vendor

WHERE bukrs in s_ccode

AND zterm in s_zterm

AND lfb1~lifnr in s_vnum.

IF sy-subrc = 0.

ENDIF.

PERFORM run_alv.

*&---------------------------------------------------------------------*

*& Form run_alv

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM run_alv .

DATA:

it_fieldcat TYPE slis_t_fieldcat_alv. " initial size 0.

DATA:

h_progname TYPE sy-repid.

h_progname = sy-repid.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = h_progname

* I_INTERNAL_TABNAME =

i_structure_name = 't_vendor'

i_client_never_display = 'X'

i_inclname = h_progname

i_bypassing_buffer = 'X'

* I_BUFFER_ACTIVE =

CHANGING

ct_fieldcat = it_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_LIST_DISPLAY'

EXPORTING

* I_INTERFACE_CHECK = ' '

* I_BYPASSING_BUFFER =

* I_BUFFER_ACTIVE = ' '

i_callback_program = h_progname

* I_CALLBACK_PF_STATUS_SET = ' '

* I_CALLBACK_USER_COMMAND = ' '

* I_STRUCTURE_NAME =

* IS_LAYOUT =

it_fieldcat = 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

* IR_SALV_LIST_ADAPTER =

* IT_EXCEPT_QINFO =

* I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

* IMPORTING

* E_EXIT_CAUSED_BY_CALLER =

* ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = t_vendor

* 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. " run_alv