Application Development 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: 

METHOD TO USE FIELDCATALOG WHILE USING FM 'REUSE_ALV_POPUP_TO_SELECT' ..

Former Member
0 Kudos

HI EXPERTS,

I WANT TO KNOW CAN I USE FIELDCATALOG WITH FUNCTIONMODULE '*REUSE_ALV_POPUP_TO_SELECT*..

IF I CAN THAN TELL ME D WAY PLZZ..

I TRIED BUT I CANT GET OUTPUT AS I DESIRED..

SO PLZZ.

HELP IF POSSIBLE...

POINTS WILL BE REWARDED....

REGARDS,

BHUMIT MEHTA

4 REPLIES 4

Former Member
0 Kudos

Hello,

check out this piece of code it might be helpful.

PERFORM field USING 'I_OUTPUT' 'ARBPL' 'Resource' .

&----


*& Form field

&----


  • text

----


  • -->TABNAME text

  • -->FIELDNAME text

  • -->SELTEXT_M text

----


FORM field USING tabname fieldname seltext_l .

wa_fieldcat-tabname = tabname.

wa_fieldcat-fieldname = fieldname.

wa_fieldcat-seltext_l = seltext_l.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

ENDFORM. " field

&----


*& Form DISPLAY_ALV_REPORT

&----


  • text

----


FORM display_alv_report .

v_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

it_fieldcat = i_fieldcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

i_save = 'X'

  • IS_VARIANT =

  • IT_EVENTS = I_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

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = i_tab_output

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

ENDFORM. " DISPLAY_ALV_REPORT

regards

ashish

Former Member
0 Kudos

HI,

try thi sample code

type-pools : slis.

data : begin of itab occurs 0,

a(3),

b(3),

c(3),

end of itab.

data : it_fcat type SLIS_T_FIELDCAT_ALV with header line.

it_fcat-fieldname = 'A'.

it_fcat-tabname = 'ITAB'.

it_fcat-seltext_m = 'First'.

append it_fcat.

it_fcat-fieldname = 'B'.

it_fcat-tabname = 'ITAB'.

it_fcat-seltext_m = 'Second'.

append it_fcat.

it_fcat-fieldname = 'C'.

it_fcat-tabname = 'ITAB'.

it_fcat-seltext_m = 'Third'.

append it_fcat.

itab-a = '1'.

itab-b = '2'.

itab-c = '3'.

append itab.

append itab.

append itab.

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

I_ZEBRA = 'X'

i_tabname = 'ITAB' "(important)

IT_FIELDCAT = it_fcat[]

tables

t_outtab = itab[]

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF sy-subrc <> 0.

ENDIF.

Former Member
0 Kudos

Hi

YES, You can use Fieldcatalog in your FM.

Populating fieldcatalog is same as in reuse_alv_drid_display.

If you provide code then I will take look and find where the problem is.

Execute the following program, you can get an idea of this FM.

REPORT BALV_POPUP_TO_SELECT.

TYPE-POOLS: SLIS.

DATA: GT_OUTTAB TYPE SFLIGHT OCCURS 0,

GS_PRIVATE TYPE SLIS_DATA_CALLER_EXIT,

GS_SELFIELD TYPE SLIS_SELFIELD,

G_EXIT(1) TYPE C.

PARAMETERS: P_TITLE TYPE SY-TITLE.

*

START-OF-SELECTION.

SELECT * FROM SFLIGHT INTO TABLE GT_OUTTAB UP TO 5 ROWS.

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

I_TITLE = P_TITLE

  • I_SELECTION = 'X'

  • I_ZEBRA = ' '

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_CHECKBOX_FIELDNAME =

  • I_LINEMARK_FIELDNAME =

  • I_SCROLL_TO_SEL_LINE = 'X'

I_TABNAME = '1'

I_STRUCTURE_NAME = 'SFLIGHT'

  • IT_FIELDCAT =

  • IT_EXCLUDING =

  • I_CALLBACK_PROGRAM =

  • I_CALLBACK_USER_COMMAND =

IS_PRIVATE = GS_PRIVATE

IMPORTING

ES_SELFIELD = GS_SELFIELD

E_EXIT = G_EXIT

TABLES

T_OUTTAB = GT_OUTTAB

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

MESSAGE I000(0K) WITH SY-SUBRC.

ENDIF.

WRITE: / G_EXIT,

GS_SELFIELD-TABNAME,

gs_selfield-TABINDEX,

gs_selfield-SEL_TAB_FIELD,

gs_selfield-VALUE.

.

Reward me if it is useful

Former Member
0 Kudos

hi bhumit,

let me review the code you made, and i can hopefully predict the error you committed ,

anyways look at the to refer and see if you can find the mistake

----


  • DECLARING TYPES POOL *

----


  • All the definitions of internal tables, structures and constants

  • are declared in a type-pool called SLIS.

TYPE-POOLS: SLIS.

i'll go with will smith's fieldcat for simplification

data : begin of itab occurs 0,

a(3),

b(3),

c(3),

end of itab.

data : it_fcat type SLIS_T_FIELDCAT_ALV with header line.

it_fcat-fieldname = 'A'.

it_fcat-tabname = 'ITAB'.

it_fcat-seltext_m = 'First'.

append it_fcat.

it_fcat-fieldname = 'B'.

it_fcat-tabname = 'ITAB'.

it_fcat-seltext_m = 'Second'.

append it_fcat.

it_fcat-fieldname = 'C'.

it_fcat-tabname = 'ITAB'.

it_fcat-seltext_m = 'Third'.

append it_fcat.

itab-a = '1'.

itab-b = '2'.

itab-c = '3'.

append itab.

append itab.

append itab.

PERFORM ZF_POPUP_DISPLAY.

*&----


*

*& Form ZF_POPUP_DISPLAY

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM ZF_POPUP_DISPLAY .

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

I_TITLE = 'POPUP- TEST

I_TABNAME = 'ITAB' pass the table name in quotes common mistake

IT_FIELDCAT = IT_FCAT[]

TABLES

T_OUTTAB = ITAB[]

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. " ZF_POPUP_DISPLAY

feel free to drop in any questions,

and reward points if helpful

Rohan malik