Skip to Content
0
Former Member
Jun 13, 2008 at 06:14 AM

*bold* Doubt in alv

18 Views

Hi friends i am new to sap.

I have a querry in alv.In this report i only get 3 columns in the output [fname,dept and age] whereas location ,eid doesn't comes.i

tried to increase the occurs 5 to 10 ,but it did't worked .

Any suggestion please ??

REPORT zalvreport .

TABLES: zemp.

DATA: BEGIN OF t_report OCCURS 5,

name LIKE zemp-fname,

age LIKE zemp-age,

deprt LIKE zemp-dept,

local LIKE zemp-location,

empid like zemp-eid,

END OF t_report.

TYPE-POOLS: slis.

DATA t_fcat TYPE slis_t_fieldcat_alv.

DATA: d_repid LIKE sy-repid.

SELECT-OPTIONS: s_name FOR zemp-fname .

START-OF-SELECTION.

SELECT * FROM zemp WHERE fname IN s_name.

MOVE: zemp-fname TO t_report-name,

zemp-age TO t_report-age,

zemp-location to t_report-local,

zemp-dept TO t_report-deprt,

zemp-eid TO t_report-empid.

APPEND t_report.

ENDSELECT.

IF sy-subrc NE 0.

WRITE 'No data found'.

EXIT.

ENDIF.

d_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = d_repid

i_internal_tabname = 'T_REPORT'

i_inclname = d_repid

CHANGING

ct_fieldcat = t_fcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

IF sy-subrc <> 0.

WRITE: / 'Error:',sy-subrc,

'when Create Field Catalog'.

EXIT.

ENDIF.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = d_repid

it_fieldcat = t_fcat

TABLES

t_outtab = t_report

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

WRITE: / 'Error:',sy-subrc,

'when Call ALV List Display'.

EXIT.

ENDIF.