Skip to Content

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

the output is not displaying properly

hi experts,

below is the code for which i am not getting the proper output can u please help in this regard.i am not getting whats wrong with it.

*******************************************************************

  • TYPE-POOLS *

*******************************************************************

TYPE-POOLS: slis.

*-- Tables Declaration

TABLES: dd02l, t000.

*-- Constants Declaration

CONSTANTS: lc_z TYPE char1 VALUE 'Z',

lc_y TYPE char1 VALUE 'Y'.

DATA: xfield TYPE slis_t_fieldcat_alv.

DATA: afield TYPE slis_fieldcat_alv.

DATA: gt_print TYPE slis_print_alv.

DATA: x_layout TYPE slis_layout_alv.

DATA: gt_xevents TYPE slis_t_event.

DATA: repid LIKE sy-repid.

repid = sy-repid.

*--Internal table and Work Area Declaration

DATA: lines LIKE sy-dbcnt VALUE 0.

DATA: icursor TYPE cursor.

*DATA: icursor1 TYPE cursor.

DATA: lv_count TYPE i.

DATA: lv_table_var1 TYPE char1.

DATA: lv_ans TYPE char1.

TYPES: BEGIN OF itab,

t_name TYPE tabname,

t_ref TYPE REF TO data,

END OF itab.

*-- Field Symbol declaration for Dynamic Internal Table

FIELD-SYMBOLS <tab> TYPE table.

FIELD-SYMBOLS <tab1> TYPE ANY.

FIELD-SYMBOLS: <l_mandt>.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

PARAMETERS: p_table LIKE dd02l-tabname,

p_mdt_fm LIKE t000-mandt DEFAULT sy-mandt,

p_mdt_to LIKE t000-mandt DEFAULT '910'.

  • repl RADIOBUTTON GROUP radi

  • USER-COMMAND com ,

  • srepl RADIOBUTTON GROUP radi DEFAULT 'X'.

*

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN ON p_table.

lv_table_var1 = p_table+0(1).

*-- Validation for Standard tables

IF ( lv_table_var1 NE lc_z ) AND ( lv_table_var1 NE lc_y ).

MESSAGE e001(00) WITH text-002.

ENDIF.

*-- Start of Selection

START-OF-SELECTION.

DATA itab2 TYPE itab.

DATA t_ref1 TYPE REF TO data.

itab2-t_name = p_table.

*-- Create Dynamic Internal table

CREATE DATA itab2-t_ref TYPE TABLE OF (itab2-t_name) .

ASSIGN itab2-t_ref->* TO <tab>.

CREATE DATA t_ref1 LIKE LINE OF <tab>.

ASSIGN t_ref1->* TO <tab1>.

*-- Get the Number of entries in table

SELECT COUNT(*) FROM dd03l INTO lv_count

WHERE tabname = p_table

AND fieldname = 'MANDT'.

  • Check MANDT field the the table, if not exists through an error message

IF lv_count = 0.

MESSAGE i000(8i) WITH text-001 space space.

EXIT.

ELSE.

*-- Open cursor

OPEN CURSOR WITH HOLD icursor FOR

SELECT * FROM (p_table) CLIENT SPECIFIED

WHERE mandt = p_mdt_fm.

IF sy-subrc <> 0.

MESSAGE e000(8i) WITH text-001.

ENDIF.

DO.

FETCH NEXT CURSOR icursor INTO TABLE <tab> PACKAGE SIZE 1000.

IF sy-subrc <> 0.

CLOSE CURSOR icursor.

EXIT.

ENDIF.

**-- Insert records into target table

  • INSERT (p_table) CLIENT SPECIFIED FROM TABLE <tab>.

*-- Close the cursor

CALL FUNCTION 'DB_COMMIT'.

ENDDO.

ENDIF.

*CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

  • EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER = ' '

    • I_BUFFER_ACTIVE = ' '

  • I_CALLBACK_PROGRAM = SY-REPID

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = ' '

    • I_CALLBACK_TOP_OF_PAGE = ' '

    • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

    • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME = p_table

    • I_BACKGROUND_ID = ' '

    • I_GRID_TITLE =

    • I_GRID_SETTINGS =

    • IS_LAYOUT =

    • 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

    • 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 = <tab>

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

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

EXPORTING

i_callback_program = repid

  • I_CALLBACK_PF_STATUS_SET = ' '

i_callback_user_command = 'USER_COMMAND'.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

it_fieldcat = xfield

is_layout = x_layout

i_tabname = '<tab>'

it_events = gt_xevents

  • IT_SORT =

  • I_TEXT = ' '

TABLES

t_outtab = <tab>

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • MAXIMUM_OF_APPENDS_REACHED = 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_BLOCK_LIST_APPEND'

EXPORTING

it_fieldcat = xfield

is_layout = x_layout

i_tabname = '<tab>'

it_events = gt_xevents

  • IT_SORT =

  • I_TEXT = ' '

TABLES

t_outtab = <tab>

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

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

gt_print-reserve_lines = 1.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

EXPORTING

is_print = gt_print.

thanks in advance.

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