Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV Display

Former Member
0 Likes
372

Hi all,

  • Call ABAP/4 List Viewer

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

i_callback_program = g_repid

i_callback_pf_status_set = 'lf_status'

i_callback_user_command = 'lf_usr'

  • I_STRUCTURE_NAME =

is_layout = lw_layout

it_fieldcat = li_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 = li_display.

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

FORM f_fieldcat USING x_fieldcat LIKE li_fieldcat.

DATA: ls_fieldcat TYPE slis_fieldcat_alv.

DATA: lv_cnt TYPE i VALUE 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = lv_cnt.

ls_fieldcat-fieldname = 'EBELN'.

ls_fieldcat-tabname = 'li_display'.

ls_fieldcat-outputlen = 10.

ls_fieldcat-reptext_ddic = 'PO Number'.

APPEND ls_fieldcat TO x_fieldcat.

lv_cnt = lv_cnt + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = lv_cnt.

ls_fieldcat-fieldname = 'LIFNR'.

ls_fieldcat-tabname = 'li_display'.

ls_fieldcat-outputlen = 10.

ls_fieldcat-reptext_ddic = 'Vendor'.

APPEND ls_fieldcat TO x_fieldcat.

lv_cnt = lv_cnt + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = lv_cnt.

ls_fieldcat-fieldname = 'BSART'.

ls_fieldcat-tabname = 'li_display'.

ls_fieldcat-outputlen = 4.

ls_fieldcat-reptext_ddic = 'Document Type'.

APPEND ls_fieldcat TO x_fieldcat.

lv_cnt = lv_cnt + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = lv_cnt.

ls_fieldcat-fieldname = 'BEDAT'.

ls_fieldcat-tabname = 'li_display'.

ls_fieldcat-outputlen = 8.

ls_fieldcat-reptext_ddic = 'Document Date'.

APPEND ls_fieldcat TO x_fieldcat.

lv_cnt = lv_cnt + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = lv_cnt.

ls_fieldcat-fieldname = 'WERKS'.

ls_fieldcat-tabname = 'li_display'.

ls_fieldcat-outputlen = 10.

ls_fieldcat-reptext_ddic = 'Site'.

APPEND ls_fieldcat TO x_fieldcat.

lv_cnt = lv_cnt + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = lv_cnt.

ls_fieldcat-fieldname = 'PRNTR'.

ls_fieldcat-tabname = 'li_display'.

ls_fieldcat-outputlen = 4.

ls_fieldcat-reptext_ddic = 'Printer'.

APPEND ls_fieldcat TO x_fieldcat.

CLEAR ls_fieldcat.

ENDFORM. " E01_FIELDCAT_INIT

&----


*& Form E05_LAYOUT_BUILD

&----


  • text

----


  • -->P_GS_LAYOUT text

----


FORM f_layout_build USING x_layout TYPE slis_layout_alv.

x_layout-colwidth_optimize = 'X'.

x_layout-zebra = 'X'.

x_layout-box_fieldname = 'CHECK'.

ENDFORM. " E05_LAYOUT_BUILD

&----


*& Form lf_status

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM lf_status .

SET PF-STATUS 'STAN'.

ENDFORM. " lf_status

&----


*& Form lf_usr

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM lf_usr .

CASE l_fcode.

WHEN '&SAV'.

LOOP AT li_display INTO lw_display WHERE check = 'X'.

MOVE lw_display TO lw_check.

APPEND lw_check TO li_check.

CLEAR lw_check.

ENDLOOP.

LOOP AT li_check INTO lw_check.

WRITE:/ lw_check-ebeln.

ENDLOOP.

ENDCASE.

ENDFORM. " lf_usr

In this code, output is taking some other pf-status 'INLI' instead of 'STAN' as mentioned in form lf_status. Can anyone please help me resolve this issue?

Regards,

Vishy.

1 ACCEPTED SOLUTION
Read only

former_member491305
Active Contributor
0 Likes
323

Hi,

In 'REUSE_ALV_LIST_DISPLAY', Give the subroutine name in CAPs.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

i_callback_program = g_repid

i_callback_pf_status_set = <b>'IF_STATUS'</b>

i_callback_user_command = <b>'IF_USR'</b>

  • I_STRUCTURE_NAME =

is_layout = lw_layout

it_fieldcat = li_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 = li_display.

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

Hi all,

  • Call ABAP/4 List Viewer

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

i_callback_program = g_repid

i_callback_pf_status_set = 'lf_status'

i_callback_user_command = 'lf_usr'

  • I_STRUCTURE_NAME =

is_layout = lw_layout

it_fieldcat = li_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 = li_display.

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

FORM f_fieldcat USING x_fieldcat LIKE li_fieldcat.

DATA: ls_fieldcat TYPE slis_fieldcat_alv.

DATA: lv_cnt TYPE i VALUE 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = lv_cnt.

ls_fieldcat-fieldname = 'EBELN'.

ls_fieldcat-tabname = 'li_display'.

ls_fieldcat-outputlen = 10.

ls_fieldcat-reptext_ddic = 'PO Number'.

APPEND ls_fieldcat TO x_fieldcat.

lv_cnt = lv_cnt + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = lv_cnt.

ls_fieldcat-fieldname = 'LIFNR'.

ls_fieldcat-tabname = 'li_display'.

ls_fieldcat-outputlen = 10.

ls_fieldcat-reptext_ddic = 'Vendor'.

APPEND ls_fieldcat TO x_fieldcat.

lv_cnt = lv_cnt + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = lv_cnt.

ls_fieldcat-fieldname = 'BSART'.

ls_fieldcat-tabname = 'li_display'.

ls_fieldcat-outputlen = 4.

ls_fieldcat-reptext_ddic = 'Document Type'.

APPEND ls_fieldcat TO x_fieldcat.

lv_cnt = lv_cnt + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = lv_cnt.

ls_fieldcat-fieldname = 'BEDAT'.

ls_fieldcat-tabname = 'li_display'.

ls_fieldcat-outputlen = 8.

ls_fieldcat-reptext_ddic = 'Document Date'.

APPEND ls_fieldcat TO x_fieldcat.

lv_cnt = lv_cnt + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = lv_cnt.

ls_fieldcat-fieldname = 'WERKS'.

ls_fieldcat-tabname = 'li_display'.

ls_fieldcat-outputlen = 10.

ls_fieldcat-reptext_ddic = 'Site'.

APPEND ls_fieldcat TO x_fieldcat.

lv_cnt = lv_cnt + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = lv_cnt.

ls_fieldcat-fieldname = 'PRNTR'.

ls_fieldcat-tabname = 'li_display'.

ls_fieldcat-outputlen = 4.

ls_fieldcat-reptext_ddic = 'Printer'.

APPEND ls_fieldcat TO x_fieldcat.

CLEAR ls_fieldcat.

ENDFORM. " E01_FIELDCAT_INIT

&----


*& Form E05_LAYOUT_BUILD

&----


  • text

----


  • -->P_GS_LAYOUT text

----


FORM f_layout_build USING x_layout TYPE slis_layout_alv.

x_layout-colwidth_optimize = 'X'.

x_layout-zebra = 'X'.

x_layout-box_fieldname = 'CHECK'.

ENDFORM. " E05_LAYOUT_BUILD

&----


*& Form lf_status

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM lf_status .

SET PF-STATUS 'STAN'.

ENDFORM. " lf_status

&----


*& Form lf_usr

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM lf_usr .

CASE l_fcode.

WHEN '&SAV'.

LOOP AT li_display INTO lw_display WHERE check = 'X'.

MOVE lw_display TO lw_check.

APPEND lw_check TO li_check.

CLEAR lw_check.

ENDLOOP.

LOOP AT li_check INTO lw_check.

WRITE:/ lw_check-ebeln.

ENDLOOP.

ENDCASE.

ENDFORM. " lf_usr

In this code, output is taking some other pf-status 'INLI' instead of 'STAN' as mentioned in form lf_status. Can anyone please help me resolve this issue?

Regards,

Vishy.

1 REPLY 1
Read only

former_member491305
Active Contributor
0 Likes
324

Hi,

In 'REUSE_ALV_LIST_DISPLAY', Give the subroutine name in CAPs.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

i_callback_program = g_repid

i_callback_pf_status_set = <b>'IF_STATUS'</b>

i_callback_user_command = <b>'IF_USR'</b>

  • I_STRUCTURE_NAME =

is_layout = lw_layout

it_fieldcat = li_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 = li_display.

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2