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 pop up

Former Member
0 Likes
764

i want to know about pop up fm and required parameters for it. plz pass simple sample code.

i want to know about pop up fm and required parameters for it. plz pass simple sample code.

4 REPLIES 4
Read only

Former Member
0 Likes
730

Hi,

Use FM REUSE_ALV_POPUP_TO_SELECT.

Check this sample code

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

I_TITLE = 'SALES ORDER INFO'

I_ZEBRA = 'X'

I_TABNAME = 1

I_STRUCTURE_NAME = 'vbak'

TABLES

T_OUTTAB = it_vbak

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.

Regards,

Satish

Read only

Former Member
0 Likes
730

here is a sample code

report z11_rohan_shadow_assign1 no standard page heading message-id

z11_shadow_mess.

----


  • DECLARING TYPES POOL *

----


  • All the definitions of internal tables, structures and constants

  • are declared in a type-pool called SLIS.

type-pools: slis.

----


  • DECLARING STRUCUTURES *

----


*&--Final structure

types: begin of struc_final,

matnr type matnr, "Material Number

werks type werks_d, "Plant

lgort type lgort_d, "Storage Location

labst type labst, "Valuated stock with unrestricted use

meins type meins, "unit of measurement

mtart type mtart, "material type

ersda type ersda, "Creation date

maktx type maktx, "material description

end of struc_final.

*&--Final structure 2 for drill

types: begin of struc_final_2,

matnr type matnr, "Material Number

werks type werks_d, "Plant

lgort type lgort_d, "Storage Location

name1 type name1,

lgobe type lgobe,

end of struc_final_2.

*&--mard structure

types: begin of struc_mard,

matnr type matnr, "Material Number

werks type werks_d, "Plant

lgort type lgort_d, "Storage Location

labst type labst, "Valuated stock with unrestricted use

end of struc_mard.

*&--mara structure

types: begin of struc_mara,

matnr type matnr,

meins type meins, "unit of measurement

mtart type mtart, "material type

ersda type ersda, "Creation date

end of struc_mara.

*&--maktx structure

types: begin of struc_maktx,

matnr type matnr, "material number

maktx type maktx, "material description

end of struc_maktx.

*&--t001w structure

types: begin of struc_p_desc,

werks type werks_d,

name1 type name1,

end of struc_p_desc.

*&--t001l structure

types: begin of struc_s_loc_desc,

werks type werks_d,

lgort type lgort_d,

lgobe type lgobe,

end of struc_s_loc_desc.

----


  • TABLES *

----


tables: mard.

**----


    • *

    • define macros *

    • *

**----


*&-- DEFINING MACRO FOR INITIAL FIELDCATALOG

define macro_fieldcat.

add 1 to l_fieldcat-col_pos.

*Defining macro reference fields

l_fieldcat-checkbox = &1.

l_fieldcat-fieldname = &2.

l_fieldcat-tabname = &3.

l_fieldcat-key = &4.

l_fieldcat-just = &5.

l_fieldcat-hotspot = &6.

l_fieldcat-do_sum = &7.

l_fieldcat-seltext_l = &8.

l_fieldcat-outputlen = &9.

append l_fieldcat to i_fieldcat.

end-of-definition.

*&-- DEFINING FIELDCATALOG FOR POPUP FIELDCATALOG

define macro_fieldcat_popup.

add 1 to l_fieldcat2-col_pos.

*Defining macro reference fields

l_fieldcat2-fieldname = &1.

l_fieldcat2-tabname = &2.

l_fieldcat2-key = &3.

l_fieldcat2-just = &4.

l_fieldcat2-seltext_l = &5.

l_fieldcat2-outputlen = &6.

l_fieldcat2-ref_tabname = &7.

append l_fieldcat2 to i_fieldcat2.

end-of-definition.

----


  • WORK AREA DECLARATION *

----


*&---work area for Internal Tables[population 1]

data: wa_mard type struc_mard,

wa_mara type struc_mara,

wa_maktx type struc_maktx,

wa_final type struc_final.

*population 2

data: wa_p_desc type struc_p_desc,

wa_s_loc_desc type struc_s_loc_desc,

wa_final_2 type struc_final_2.

*&--work area for layout

data: wa_layout type slis_layout_alv,

wa_layout2 type slis_layout_alv.

  • Structure to display variants for improt and export

data : it_variant like disvariant,

it_variant1 like disvariant.

*defining local workarea

data: l_fieldcat type slis_fieldcat_alv.

*defining local workarea2 for fieldcat popup

data: l_fieldcat2 type slis_fieldcat_alv.

----


  • INTERNAL TABLES DECLARATION *

----


*&---Internal tables for storing data.[populaiton 1]

data: i_mard type standard table of struc_mard,

i_mara type standard table of struc_mara,

i_maktx type standard table of struc_maktx,

i_final type standard table of struc_final.

*&--population 2

data: i_p_desc type standard table of struc_p_desc,

i_s_loc_desc type standard table of struc_s_loc_desc,

i_final_2 type standard table of struc_final_2.

*&---Internal table for field catalog

data : i_fieldcat type slis_t_fieldcat_alv,

*&--Internal table for drill down alvfieldcat

i_fieldcat2 type slis_t_fieldcat_alv,

*&---Internal table for the event catalog.

i_eventcat type slis_t_event,

*&---Internal table for the sorting sequence.

i_sortinfo type slis_t_sortinfo_alv,

*&---Internal table for the top of page event

i_listheader type slis_t_listheader.

  • DEFINING REFERENCE MACROS FOR INTITAL FIELDCATALOG

macro_fieldcat 'X' text-009 text-005 text-029 text-030 text-029 ' '

text-004 text-031.

macro_fieldcat ' ' text-011 text-005 ' ' text-030 ' ' ' '

text-007 text-032.

macro_fieldcat ' ' text-012 text-005 ' ' text-030 ' ' ' '

text-010 text-031.

macro_fieldcat ' ' text-014 text-005 ' ' text-030 ' ' ' '

text-013 text-031.

macro_fieldcat ' ' text-015 text-005 ' ' text-030 ' ' ' '

text-016 text-031.

macro_fieldcat ' ' text-017 text-005 ' ' text-033 text-029

text-029

text-019 text-031.

macro_fieldcat ' ' text-018 text-005 ' ' text-030 ' ' ' '

text-022 text-031.

macro_fieldcat ' ' text-020 text-005 ' ' text-030 ' ' ' '

text-025 text-031.

  • DEFINING REFERENCE MACROS FOR POPUP FIELDCATALOGUE

*MACRO_FIELDCAT_POPUP TEXT-009 TEXT-040 TEXT-029 TEXT-030 TEXT-004

*TEXT-031 TEXT-021.

macro_fieldcat_popup text-014 text-040 ' ' text-030 text-013

text-031 text-024.

macro_fieldcat_popup text-041 text-040 ' ' text-030 text-036

text-032 text-038.

macro_fieldcat_popup text-015 text-040 ' ' text-030 text-016

text-031 text-026.

macro_fieldcat_popup text-042 text-040 ' ' text-030 text-037

text-032 text-039.

----


  • VARIABLE DECLARATION *

----


data : v_progname type syrepid.

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

  • SELECTION SCREEN *

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

  • SCREEN FOR ENTERING INFORMATION

selection-screen begin of block charly with frame title text-001.

select-options: r_matnr for mard-matnr.

select-options: r_werks for mard-werks.

select-options: r_lgort for mard-lgort.

selection-screen end of block charly.

selection-screen begin of block options with frame title text-003.

*RADIO BUTTON

parameters: p_r01 radiobutton group rad1 default 'X', "GRID FORMAT

p_r02 radiobutton group rad1 . "LIST FORMAT

selection-screen end of block options.

*VARIANT

selection-screen begin of block b3 with frame title text-043.

parameters: p_var type slis_vari.

selection-screen end of block b3.

----


  • INITIALIZATION EVENT *

----


initialization.

*&--assigns main program name to v_progname which becomes the calling

  • program

v_progname = sy-repid.

  • Display default variant using FM REUSE_ALV_VARIANT_DEFAULT_GET

perform zf_default_variant.

*&--clearing workareas

clear: wa_mard,

wa_mara,

wa_maktx,

wa_final,

wa_layout.

*&--refreshing internal tables

refresh: i_mard,

i_mara,

i_maktx,

i_final,

i_eventcat,

i_sortinfo,

i_listheader.

----


  • AT SELECTION SCREEN ON VLAUE REQUEST *

----


at selection-screen on value-request for p_var.

perform zf_variant_f4. "USING FM REUSE_ALV_VARIANT_F4

----


  • AT SELECTION SCREEN *

----


at selection-screen.

*check the material no.

perform zf_validate_field.

*check the variant provided

perform zf_variant_check.

----


  • START OF SELECTION EVENT

----


start-of-selection.

  • fetch the data

perform zf_populate_info.

----


  • END OF SELECTION EVENT

----


end-of-selection.

*If Internal Table Is Populated Then Only Display Alv Report.

if i_final is not initial.

  • &---Build layout.

perform zf_layout.

  • &---build event catalogue

perform zf_eventcat using i_eventcat.

  • build sorting

perform zf_sorting using i_sortinfo.

  • &---Build Listheader for TOP OF PAGE EVENT.

perform zf_build_listheader using i_listheader.

if p_r01 = 'X'. "if 1st radio button is selected

*&---Display alv grid.

perform zf_display_alv_grid.

else.

*&---Display alv grid.

perform zf_display_alv_list.

endif.

else.

*If Table is not Populated ie Records Does not exist

message e004.

endif.

&----


*& Form zf_validate_field

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_validate_field .

  • TECHNICAL VALIDATION [SINGLE FIELD CHECK]

  • CASE 1- IF NOTHING IS ENTERED, PRINT ALL RECORDS

if r_matnr[] is initial and r_werks[] is initial and r_lgort[] is

initial.

exit.

endif.

  • CASE 2- IF ONLY MATERIAL NUMBER IS ENTERED

if r_matnr[] is not initial and r_werks[] is initial and r_lgort[] is

initial.

*validate material

select matnr

into wa_mard-matnr

from mara

up to 1 rows

where matnr in r_matnr.

endselect.

if sy-subrc <> 0. "if unsuccessful

message e001. "material does not exist

else.

exit.

endif.

endif.

  • CASE 3- IF ONLY PLANT IS ENTERED

if r_matnr[] is initial and r_werks[] is not initial and r_lgort[] is

initial.

*validate plants

select werks

into wa_mard-werks

from marc

up to 1 rows

where werks in r_werks.

endselect.

if sy-subrc <> 0. "if unsuccessful

message e002. "plant does not exist

else.

exit.

endif.

endif.

  • CASE 3- IF ONLY STORAGE IS ENTERED

if r_matnr[] is initial and r_werks[] is initial and r_lgort[] is

not initial.

*validate LGORT

select lgort

into wa_mard-lgort

from mard

up to 1 rows

where lgort in r_lgort.

endselect.

if sy-subrc <> 0. "if unsuccessful

message e003. "storage location does not exist

else.

exit.

endif.

endif.

  • CASE 4- CHECKING BUISNESS VALIDATION 1 - MATERIAL AND PLANT

if r_matnr[] is not initial and r_werks[] is not initial.

  • to see if material exist for the entered plant.

select matnr

into wa_mard-matnr

from mard up to 1 rows

where matnr in r_matnr and werks in r_werks.

endselect.

if sy-subrc <> 0 . "if unsuccesful

*No particular combination exists

message e006.

else.

exit.

endif.

endif.

  • CASE 6 - CHECKING BUISNESS VALIDATION 2 - PLANT AND STORAGE

if r_werks[] is not initial and r_matnr[] is initial and

r_lgort[] is not initial.

select werks

into wa_mard-werks

from mard

up to 1 rows

where werks in r_werks and lgort in r_lgort.

endselect.

if sy-subrc <> 0.

*No particular combination exists

message e006.

else.

exit.

endif.

endif.

  • CASE 7 - CHECKING BUISNESS VALIDATION 3 - MATERIAL AND STORAGE

if r_matnr[] is not initial and r_werks[] is initial.

select matnr

into wa_mard-matnr

from mard

up to 1 rows

where matnr in r_matnr and lgort in r_lgort.

endselect.

if sy-subrc <> 0.

*No particular combination exists

message e006.

else.

exit.

endif.

endif.

  • CASE 8 - CHECKING BUISNESS VALIDATION 4 - MATERIAL,PLANT AND STORAGE

if r_matnr[] is not initial and r_werks[] is not initial.

select matnr

into wa_mard-matnr

from mard

up to 1 rows

where matnr in r_matnr and werks in r_werks and lgort in

r_lgort.

endselect.

if sy-subrc <> 0.

*No particular combination exists

message e006.

endif.

endif.

endform. " zf_validate_field

&----


*& Form zf_populate_info

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_populate_info .

*&--fetching the data from mard table

select matnr

werks

lgort

labst

into table i_mard

from mard

where matnr in r_matnr and werks in r_werks and lgort in

r_lgort

.

if sy-subrc <> 0. "if unsuccesful

message e004. "Error- Record does not exist

endif.

  • selection of material description

if i_mard[] is not initial.

*SELECT DISTINCT FOR UNIQUE ENTRIES ONLY

select distinct matnr

maktx

into table i_maktx

from makt

for all entries in i_mard

where matnr = i_mard-matnr and

spras = sy-langu.

if sy-subrc <> 0. " if unsucessful

wa_maktx-maktx = text-028. "NO DESCRIPTION

endif.

*fetching information from mara

select distinct matnr

meins

mtart

ersda

into table i_mara

from mara for all entries in i_mard

where matnr = i_mard-matnr.

if sy-subrc <> 0.

message e003.

endif.

*&--sorting the tables

sort: i_mard by matnr werks lgort,

i_mara by matnr,

i_maktx by matnr.

*&--Clearing workareas.

clear: wa_mard,

wa_mara,

wa_maktx,

wa_final.

*PROCESSING

loop at i_mard into wa_mard.

*moving values to final workarea

wa_final = wa_mard.

at new matnr.

read table i_maktx into wa_maktx

with key matnr = wa_mard-matnr binary search.

read table i_mara into wa_mara

with key matnr = wa_mard-matnr binary search.

endat.

if sy-subrc = 0.

"if succesful then move to final workarea

wa_final-maktx = wa_maktx-maktx.

*for mara values

wa_final-meins = wa_mara-meins.

wa_final-mtart = wa_mara-mtart.

wa_final-ersda = wa_mara-ersda.

endif.

*append final workarea

append wa_final to i_final.

endloop.

refresh: i_mard.

clear: wa_mard.

endif.

endform. "zf_populate_info

*ENDFORM. " zf_build_fieldcat

&----


*& Form zf_display_alv_grid

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_display_alv_grid .

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = v_progname

is_layout = wa_layout

it_fieldcat = i_fieldcat

it_events = i_eventcat

it_sort = i_sortinfo

i_default = 'X'

i_save = 'A'

is_variant = it_variant1

tables

t_outtab = i_final "output table

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_display_alv_grid

&----


*& Form zf_display_alv_list

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_display_alv_list .

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

i_callback_program = v_progname

is_layout = wa_layout

it_fieldcat = i_fieldcat

it_events = i_eventcat

it_sort = i_sortinfo

i_default = 'X'

i_save = 'A'

is_variant = it_variant1

tables

t_outtab = i_final

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_display_alv_list

&----


*& Form ZF_LAYOUT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_layout .

wa_layout-zebra = 'X'.

wa_layout-totals_text = 'TOTAL'.

endform. " ZF_LAYOUT

*&----


*

*& Form ZF_EVENTCAT

*&----


*

  • text

*----


*

  • -->P_I_EVENTCAT text

*----


*

form zf_eventcat using p_i_eventcat type slis_t_event.

data: l_eventcat type slis_alv_event.

clear l_eventcat.

call function 'REUSE_ALV_EVENTS_GET'

exporting

i_list_type = 0

importing

et_events = p_i_eventcat

exceptions

list_type_wrong = 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.

  • TOP OF PAGE FORM

clear l_eventcat.

read table p_i_eventcat into l_eventcat with key

name = slis_ev_top_of_page.

"(COMPONENT "NAME" of structure)

if sy-subrc = 0. "if success

move 'ZF_TOP_OF_PAGE' to l_eventcat-form.

"matches name and moves form to workarea and modifies table

modify p_i_eventcat from l_eventcat index sy-tabix

transporting form.

endif.

  • USER_COMMAND FORM

clear l_eventcat.

read table p_i_eventcat into l_eventcat with key

name = slis_ev_user_command.

if sy-subrc = 0.

move 'ZF_USER_COMMAND' to l_eventcat-form.

modify p_i_eventcat from l_eventcat index sy-tabix

transporting form.

endif.

endform. " ZF_EVENTCAT

*&----


*

*& Form ZF_TOP_OF_PAGE

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


form zf_top_of_page .

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = i_listheader.

endform. " ZF_TOP_OF_PAGE

&----


*& Form ZF_BUILD_LISTHEADER

&----


  • text

----


  • -->P_I_LISTHEADER text

----


form zf_build_listheader using p_i_listheader type slis_t_listheader.

data: l_listheader type slis_listheader,

l_lines type i,

l_records(10) type c.

refresh p_i_listheader.

clear l_listheader.

  • HEADER [PRINTS THE HEADER IN BOLD AND CAPITAL]

l_listheader-typ = 'H'.

l_listheader-info = 'STORAGE LOCATION WISE MATERIAL REPORT'.

append l_listheader to p_i_listheader.

  • SELECTION

*for date

l_listheader-typ = 'S'.

l_listheader-key = text-035.

concatenate sy-datum6(2) '.' sy-datum4(2) '.' sy-datum(4) into

l_listheader-info.

append l_listheader to p_i_listheader.

*for Total no. of records

describe table i_final lines l_lines.

l_records = l_lines.

l_listheader-typ = 'S'.

l_listheader-key = text-034.

l_listheader-info = l_records.

append l_listheader to p_i_listheader.

endform. " ZF_BUILD_LISTHEADER

&----


*& Form ZF_SORTING

&----


  • text

----


  • -->P_I_SORTINFO text

----


form zf_sorting using p_i_sortinfo type slis_t_sortinfo_alv.

data l_sortinfo type slis_sortinfo_alv.

refresh p_i_sortinfo.

clear l_sortinfo.

l_sortinfo-spos = '1'. "sorting position

l_sortinfo-fieldname = text-009. "fieldname

l_sortinfo-tabname = 'I_FINAL'. "final table

l_sortinfo-down = 'X'.

l_sortinfo-group = '*'. "DONT REPEAT COMMON ITEM

append l_sortinfo to p_i_sortinfo.

endform. " ZF_SORTING

&----


*& Form ZF_USER_COMMAND

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_user_command using r_ucomm like sy-ucomm

rs_selfield type slis_selfield .

case r_ucomm.

*&-- when hotspot is clikced

when '&IC1'.

if rs_selfield-fieldname = 'WERKS'.

read table i_final into wa_final index rs_selfield-tabindex.

if sy-subrc = 0. "if succesful

*PERFORM FOR POPUALTING THE INITIAL FETCH OPERTAIONM

perform zf_popualte_table_2.

else. "if unsuccesful

message e004. "Error- Record does not exist

endif.

*&--PERFORM FOR DATA POPUALTION OF PLANT AND STORAGE DECRIPTION

perform zf_data_popualtion_2.

*&--PERFORM TO Call POPUP FUNCTION

perform zf_alv_grid_display_popup.

perform zf_popup_display.

  • PERFORM ZF_LAYOUT2.

refresh: i_final_2.

endif.

endcase.

endform. " ZF_USER_COMMAND

&----


*& Form ZF_POPUALTE_TABLE_2

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_popualte_table_2 .

select matnr

werks

lgort

from mard

into corresponding fields of table i_mard

where matnr = wa_final-matnr and werks = wa_final-werks.

endform. " ZF_POPUALTE_TABLE_2

&----


*& Form ZF_DATA_POPUALTION_2

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_data_popualtion_2 .

  • selection of storage location filtered by material no.of mard

if i_mard[] is not initial.

*SELECT PLANT DESCRIPTION

select werks

name1

into table i_p_desc

from t001w

for all entries in i_mard where werks = i_mard-werks.

if sy-subrc <> 0. " if unsucessful

wa_p_desc-name1 = text-028. "NO DESCRIPTION

endif.

*SELECT STORAGE LOCATION DESCRIPTIONS

select werks

lgort

lgobe

into table i_s_loc_desc

from t001l

for all entries in i_mard where werks = i_mard-werks and

lgort = i_mard-lgort.

if sy-subrc <> 0. " if unsucessful

wa_s_loc_desc-lgobe = text-028. "NO DESCRIPTION

endif.

*&--sorting the tables

sort: i_mard by matnr werks lgort,

i_p_desc by werks,

i_s_loc_desc by werks lgort.

*&--Clearing workareas.

clear: wa_mard,

wa_p_desc,

wa_s_loc_desc,

wa_final_2.

*PROCESSING [2nd time]

loop at i_s_loc_desc into wa_s_loc_desc .

*moving values to final workarea

wa_final_2-werks = wa_s_loc_desc-werks .

wa_final_2-lgort = wa_s_loc_desc-lgort .

wa_final_2-lgobe = wa_s_loc_desc-lgobe.

read table i_p_desc into wa_p_desc

with key werks = wa_s_loc_desc-werks binary search.

read table i_mard into wa_mard

with key werks = wa_s_loc_desc-werks binary search.

if sy-subrc = 0.

*for t001w [plant desc] values

wa_final_2-name1 = wa_p_desc-name1.

*for matnr values

wa_final_2-matnr = wa_mard-matnr.

endif.

*append final workarea

append wa_final_2 to i_final_2.

endloop.

endif.

endform. " ZF_DATA_POPUALTION_2

*&----


*

*& Form ZF_POPUP_DISPLAY

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

form zf_popup_display .

call function 'REUSE_ALV_POPUP_TO_SELECT'

exporting

i_title = 'POPUP- DISPLAYING MATERIAL-STORAGE'

i_tabname = 'I_FINAL_2'

it_fieldcat = i_fieldcat2

tables

t_outtab = i_final_2

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

&----


*& Form ZF_DEFAULT_VARIANT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_default_variant .

it_variant1-report = sy-repid.

  • Search default variant for the report

call function 'REUSE_ALV_VARIANT_DEFAULT_GET'

exporting

i_save = 'A'

changing

cs_variant = it_variant1

exceptions

wrong_input = 1

not_found = 2

program_error = 3

others = 4.

if sy-subrc = 0. "if succesful set as default.

p_var = it_variant1-variant.

endif.

endform. " ZF_DEFAULT_VARIANT

&----


*& Form ZF_VARIANT_F4

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_variant_f4 .

it_variant-report = sy-repid.

call function 'REUSE_ALV_VARIANT_F4'

exporting

is_variant = it_variant

i_save = 'A'

importing

  • E_EXIT =

es_variant = it_variant1

exceptions

not_found = 1

program_error = 2

others = 3

.

if sy-subrc = 0. "if sccesfully found, load the variant

p_var = it_variant1-variant.

endif.

endform. " ZF_VARIANT_F4

&----


*& Form ZF_VARIANT_CHECK

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form zf_variant_check .

if not p_var is initial.

it_variant-report = sy-repid.

it_variant-variant = p_var.

call function 'REUSE_ALV_VARIANT_EXISTENCE'

exporting

i_save = 'A'

changing

cs_variant = it_variant

exceptions

wrong_input = 1

not_found = 2

program_error = 3

others = 4.

if sy-subrc = 0.

clear it_variant1.

move p_var to it_variant1-variant.

move sy-repid to it_variant1-report.

else.

message e007.

endif.

else.

clear it_variant.

endif.

endform. " ZF_VARIANT_CHECK

*&----


*

*& Form ZF_ALV_GRID_DISPLAY_POPUP

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

form zf_alv_grid_display_popup .

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

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

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

it_fieldcat = i_fieldcat2

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

i_screen_start_line = 1

i_screen_end_column = 50

i_screen_end_line = 10

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

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_ALV_GRID_DISPLAY_POPUP

reward if helpful

keep rockin

vivek

Read only

Former Member
0 Likes
730

Hi,

Please refer to the link below :

http://sap.ittoolbox.com/code/archives.asp?i=10&d=3430&a=s

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
730

thanx all