Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

PROBLEM IN ALV

HI,

im not able to get the interactive list ..im attaching the code for this..pls have a look.

report demo.

type-pools:slis.

tables: bsid.

data: gv_fcat type slis_t_fieldcat_alv.

----


  • T Y P E D E C L A R A T I O N S *

----


types: begin of ty_s_output,

belnr type bsid-belnr,

buzei type bsid-buzei,

budat type bsid-budat,

wrbtr type bsid-wrbtr,

waers type bsid-waers,

end of ty_s_output,

ty_t_ouput type standard table of ty_s_output with key belnr.

----


  • G L O B A L D A T A D E C L A R A T I O N S *

----


data: gt_fieldcat type slis_t_fieldcat_alv,

gt_output type ty_t_ouput,

gt_repid like sy-repid.

----


  • S E L E C T I O N S C R E E N *

----


selection-screen begin of block b1.

parameters: p_bukrs type bsid-bukrs,

p_kunnr like bsid-kunnr.

select-options: s_budat for bsid-budat,

s_bschl for bsid-bschl.

selection-screen end of block b1.

----


  • A T S E L E C T I O N S C R E E N *

----


----


  • S T A R T O F S E L E C T I O N *

----


PERFORM fill_output_table.

----


  • E N D O F S E L E C T I O N *

----


END-OF-SELECTION.

IF gt_output IS INITIAL.

  • Display 'No records found for the selection criteria'.

MESSAGE E001 WITH 'NO RECORDS FOUND FOR THE SPECIFIED CRITERIA'.

ELSE.

  • Display the ALV Report with the Selected data

PERFORM display_alv_report.

ENDIF.

----


  • S U B R O U T I N E S *

----


&----


*& Form fill_output_table

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fill_output_table .

select belnr

buzei

budat

wrbtr

waers

from bsid into table gt_output

where bukrs eq p_bukrs and

kunnr eq p_kunnr and

budat in s_budat and

bschl in s_bschl.

ENDFORM. " fill_output_table

&----


*& Form display_alv_report

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM display_alv_report .

PERFORM fill_fieldcatalog USING gt_fieldcat[].

perform report_alv_display.

ENDFORM. " display_alv_report

&----


*& Form fill_fieldcatalog

&----


  • text

----


  • -->P_GT_FIELDCAT[] text

----


FORM fill_fieldcatalog USING P_GT_FIELDCAT type slis_t_fieldcat_alv. .

DATA: lv_fieldcat TYPE slis_fieldcat_alv.

CLEAR: lv_fieldcat,p_gt_fieldcat.

lv_fieldcat-col_pos = 1.

lv_fieldcat-tabname = 'gt_output'.

lv_fieldcat-fieldname = 'BELNR'.

lv_fieldcat-seltext_l = 'FI Document Number'.

lv_fieldcat-hotspot = 'x'.

lv_fieldcat-key = 'x'.

APPEND lv_fieldcat TO p_gt_fieldcat.

CLEAR lv_fieldcat.

lv_fieldcat-col_pos = 2.

lv_fieldcat-tabname = 'gt_output'.

lv_fieldcat-fieldname = 'BUZEI'.

lv_fieldcat-seltext_l = 'Line Item'.

APPEND lv_fieldcat TO p_gt_fieldcat.

CLEAR lv_fieldcat.

lv_fieldcat-col_pos = 3.

lv_fieldcat-tabname = 'gt_output'.

lv_fieldcat-fieldname = 'BUDAT'.

lv_fieldcat-seltext_l = 'Posting Date'.

APPEND lv_fieldcat TO p_gt_fieldcat.

CLEAR lv_fieldcat.

lv_fieldcat-col_pos = 4.

lv_fieldcat-tabname = 'gt_output'.

lv_fieldcat-fieldname = 'WRBTR'.

lv_fieldcat-seltext_l = 'AMOUNT'.

lv_fieldcat-do_sum = 'x'.

APPEND lv_fieldcat TO p_gt_fieldcat.

CLEAR lv_fieldcat.

lv_fieldcat-col_pos = 5.

lv_fieldcat-tabname = 'gt_output'.

lv_fieldcat-fieldname = 'WAERS'.

lv_fieldcat-seltext_l = 'CURRENCY'.

APPEND lv_fieldcat TO p_gt_fieldcat.

CLEAR lv_fieldcat.

ENDFORM. " fill_fieldcatalog

&----


*& Form report_alv_display

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM report_alv_display .

gt_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = gt_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = 'CLICK'

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = gt_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

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = gt_output

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

&----


*& Form click

&----


  • text

----


  • -->R_UCOMM text

  • -->RS_SELFIELD text

----


form CLICK using r_ucomm like sy-ucomm

rs_selfield type slis_selfield.

data: l_belnr type bsid-belnr,

l_gt_output like gt_output with header line,

flag TYPE c LENGTH 1,

wa type c length 10.

case r_ucomm.

when '&IC1'.

read table l_gt_output index rs_selfield-tabindex.

*READ current LINE FIELD VALUE flag l_belnr INTO wa.

if sy-subrc eq 0.

l_belnr = l_gt_output-belnr.

set parameter id 'BLN' field l_belnr.

call transaction 'FB03' and skip first screen.

else.

leave list-processing.

endif.

endcase.

rs_selfield-refresh = 'x'. "List Refresh

endform. "click

thanks n regards,

jay

Former Member
Not what you were looking for? View more on this topic or Ask a question