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: 

interactive alv

Akhil_Sun
Participant
0 Kudos

can anyone post me interactive alv on any object plzzzzzzz

4 REPLIES 4

Former Member
0 Kudos

yaaa

you can make event double click on alv row and then lead to second window or list for detail display

Former Member
0 Kudos

hi,

type-pools: slis.

tables: vbak,

vbap.

types: begin of ty_vbak,

vbeln type vbeln_va,

erdat type erdat,

ernam type ernam ,

end of ty_vbak.

types: begin of ty_vbap,

vbeln type vbeln_va,

posnr type posnr_va,

matnr type matnr,

matkl type matkl,

netwr type netwr_ap,

end of ty_vbap,

begin of ty_mara,

matnr type matnr,

mbrsh type mbrsh,

mtart type mtart,

end of ty_mara.

data: t_vbak type table of ty_vbak,

t_vbap type table of ty_vbap,

t_mara type table of ty_mara,

w_vbak type ty_vbak,

w_vbap type ty_vbap,

w_mara type ty_mara.

data: t_fieldcat type slis_t_fieldcat_alv,

w_fieldcat type slis_fieldcat_alv,

i_event type slis_t_event ,

w_event type slis_alv_event,

i_listheader type slis_t_listheader,

w_listheader type slis_listheader,

i_listheader1 type slis_t_listheader,

w_listheader1 type slis_listheader,

i_sort type slis_t_sortinfo_alv,

w_sort type slis_sortinfo_alv,

i_end type slis_t_listheader,

i_excluding type slis_t_extab,

w_excluding type slis_extab.

data: mydate(10).

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

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

select-options: s_vbeln for vbak-vbeln.

selection-screen: end of block b1.

perform populate_data.

perform fieldcat.

perform events_get. "USING I_EVENT.

*perform top_of_page.

*perform end.

*PERFORM USER_COMMAND.

perform display.

&----


*& Form populate_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


-

form populate_data .

select vbeln

from vbak into table t_vbak

where vbeln in s_vbeln.

if sy-subrc = 0.

select vbeln

posnr

matnr

matkl

netwr

from vbap into table t_vbap for all entries in t_vbak

where vbeln = t_vbak-vbeln.

sort t_vbap by vbeln .

endif.

endform. " populate_data

&----


*& Form fieldcat

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form fieldcat .

w_fieldcat-col_pos = 1.

w_fieldcat-fieldname = 'VBELN'.

w_fieldcat-tabname = 'T_VBAP'.

  • w_fieldcat-do_sum = .

w_fieldcat-key = 'X'.

w_fieldcat-seltext_m = 'SALES DOCU'.

w_fieldcat-outputlen = 20.

append w_fieldcat to t_fieldcat.

clear w_fieldcat.

w_fieldcat-col_pos = 2.

w_fieldcat-fieldname = 'POSNR'.

w_fieldcat-tabname = 'T_VBAP'.

  • w_fieldcat-do_sum = .

  • w_fieldcat-key = 'X'.

w_fieldcat-seltext_m = 'ITEM DETAILS'.

w_fieldcat-outputlen = 20.

append w_fieldcat to t_fieldcat.

clear w_fieldcat.

w_fieldcat-col_pos = 3.

w_fieldcat-fieldname = 'MATNR'.

w_fieldcat-tabname = 'T_VBAP'.

  • w_fieldcat-do_sum = .

  • w_fieldcat-key = 'X'.

w_fieldcat-seltext_m = 'MATERIAL NO'.

w_fieldcat-outputlen = 20.

append w_fieldcat to t_fieldcat.

clear w_fieldcat.

w_fieldcat-col_pos = 4.

w_fieldcat-fieldname = 'MATKL'.

w_fieldcat-tabname = 'T_VBAP'.

  • w_fieldcat-do_sum = .

  • w_fieldcat-key = 'X'.

w_fieldcat-seltext_m = 'MATERIAL DESC'.

w_fieldcat-outputlen = 20.

append w_fieldcat to t_fieldcat.

clear w_fieldcat.

w_fieldcat-col_pos = 5.

w_fieldcat-fieldname = 'NETWR'.

w_fieldcat-tabname = 'T_VBAP'.

w_fieldcat-do_sum = 'X'.

  • w_fieldcat-key = 'X'.

w_fieldcat-seltext_m = 'NET PRICE'.

w_fieldcat-outputlen = 20.

append w_fieldcat to t_fieldcat.

clear w_fieldcat.

endform. " fieldcat

&----


*& Form display

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form display .

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 = 'LISTHEADER'

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

it_excluding = i_excluding

  • IT_SPECIAL_GROUPS =

  • IT_SORT = i_sort

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

it_events = i_event

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

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

&----


*& Form top_of_page

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form top_of_page .

clear i_listheader.

w_listheader-typ = 'H'.

w_listheader-info = 'SALES DOCUMENT'.

append w_listheader to i_listheader.

clear w_listheader.

w_listheader-typ = 'S'.

w_listheader-key = 'DATE:'.

w_listheader-info = mydate.

append w_listheader to i_listheader.

clear w_listheader.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = i_listheader

i_logo = 'GEMS'

  • I_END_OF_LIST_GRID =

i_alv_form = 'X'

.

endform. " top_of_page

&----


*& Form events_get

&----


  • text

----


  • -->P_I_EVENT text

----


form events_get .

w_event-name = 'TOP_OF_PAGE'.

w_event-form = 'TOP_OF_PAGE'.

append w_event to i_event.

clear w_event.

w_event-name = 'END_OF_LIST'.

w_event-form = 'END'.

append w_event to i_event.

clear w_event.

w_event-name = 'USER_COMMAND'.

w_event-form = 'USER_COMMAND'.

append w_event to i_event.

clear w_event.

endform.

&----


*& Form end

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form end .

data: w_end type slis_listheader.

clear i_end.

w_end-typ = 'S'.

w_end-info = 'END-OF-PAGE'.

append w_end to i_end.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = i_end.

  • I_LOGO =

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

endform. " end

&----


*& Form USER_COMMAND

&----


  • text

----


  • -->R_UCOMM text

  • -->HIDE text

----


form user_command using r_ucomm like sy-ucomm hide type slis_selfield.

data: h_matnr type matnr.

h_matnr = hide-value.

select matnr mbrsh mtart from mara into table t_mara where matnr = h_mATNR.

data: t_fieldcat1 type slis_t_fieldcat_alv,

w_fieldcat1 type slis_fieldcat_alv.

w_fieldcat1-col_pos = 1.

w_fieldcat1-fieldname = 'MATNR'.

w_fieldcat1-tabname = 'T_MATNR'.

  • w_fieldcat-do_sum = .

  • W_FIELDCAT-KEY = 'X'.

w_fieldcat1-seltext_m = 'MATERIAL NUMBER'.

w_fieldcat1-outputlen = 20.

append w_fieldcat1 to t_fieldcat1.

clear w_fieldcat1.

w_fieldcat1-col_pos = 2.

w_fieldcat1-fieldname = 'MBRSH'.

w_fieldcat1-tabname = 'T_MATNR'.

  • w_fieldcat-do_sum = .

  • W_FIELDCAT-KEY = 'X'.

w_fieldcat1-seltext_m = 'MATERIAL TYPE'.

w_fieldcat1-outputlen = 20.

append w_fieldcat1 to t_fieldcat1.

clear w_fieldcat1.

w_fieldcat1-col_pos = 3.

w_fieldcat1-fieldname = 'MTART'.

w_fieldcat1-tabname = 'T_MATNR'.

  • w_fieldcat-do_sum = .

  • W_FIELDCAT-KEY = 'X'.

w_fieldcat1-seltext_m = 'INDUSTRY SECTOR'.

w_fieldcat1-outputlen = 20.

append w_fieldcat1 to t_fieldcat1.

clear w_fieldcat1.

perform header.

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 = 'HEADER'

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

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

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

&----


*& Form HEADER

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form header .

clear i_listheader1.

w_listheader1-typ = 'H'.

w_listheader1-info = 'MATERIAL DETAILS'.

append w_listheader1 to i_listheader1.

clear w_listheader1.

w_listheader1-typ = 'S'.

w_listheader1-key = 'DATE:'.

w_listheader1-info = mydate.

append w_listheader1 to i_listheader1.

clear w_listheader1.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = i_listheader1

i_logo = 'LOGO'

  • I_END_OF_LIST_GRID =

i_alv_form = 'X'

.

REWARD IF USEFUL,

THANKS AND REGARDS

Former Member
0 Kudos

Hi,

This interactive ALV is on Notifications...

You double click On any Notification Number then its details will be printed on SAP script... So first i will send you the program for ALV and after that I will send you the Program for SAP script....

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

&----


*& Report Z94406_NOTIFICATION *

*& *

&----


*& *

*& *

&----


REPORT z94406_notification.

TABLES: qmel,qmih,iflot,z94392_notif.

DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid .

DATA gc_custom_control_name TYPE scrfname VALUE 'CUST_C' .

DATA gr_ccontainer TYPE REF TO cl_gui_custom_container .

DATA gt_fieldcat TYPE lvc_t_fcat .

DATA gs_layout TYPE lvc_s_layo.

DATA: e_row_id TYPE lvc_s_row,

e_column_id TYPE lvc_s_col,

es_row_no TYPE lvc_s_roid,

ROW_ID_TABLE type LVC_T_ROID.

DATA: BEGIN OF itab1 OCCURS 0,

qmnum LIKE qmel-qmnum,

qmtxt LIKE qmel-qmtxt,

indtx LIKE qmel-indtx,

qmdat LIKE qmel-qmdat,

ltrmn LIKE qmel-ltrmn,

priok LIKE qmel-priok,

aufnr LIKE qmel-aufnr,

bezdt LIKE qmel-bezdt,

qmnam LIKE qmel-qmnam,

qmart LIKE qmel-qmart,

END OF itab1.

DATA: BEGIN OF itab2 OCCURS 0,

qmnum LIKE qmih-qmnum,

btpln LIKE qmih-btpln,

ingrp LIKE qmih-ingrp,

END OF itab2.

types : begin of itab.

types : celltab TYPE lvc_t_styl.

include structure z94392_notif.

types: end of itab.

Data: begin of ls_celltab1 occurs 0.

include structure lvc_s_styl.

Data: End of ls_celltab1.

Data: itab3 type table of itab with header line,

ls_celltab type lvc_s_styl.

Data: Flag type c value 'N'.

DATA : er_data_changed TYPE REF TO cl_alv_changed_data_protocol.

DATA : data_changed TYPE REF TO cl_alv_changed_data_protocol.

DATA : ls_mod_cell TYPE table of lvc_s_modi with header line,

lv_value TYPE lvc_value .

CLASS notification DEFINITION.

PUBLIC SECTION.

CLASS-METHODS : handle_double_click

FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING e_row e_column,

handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid

IMPORTING er_data_changed.

ENDCLASS. "NOTIFICATION DEFINITION

CLASS notification IMPLEMENTATION.

METHOD handle_data_changed.

PERFORM handle_data_changed USING er_data_changed.

ENDMETHOD. "handle_data_changed

METHOD handle_double_click.

PERFORM handle_double_click USING e_row e_column es_row_no.

ENDMETHOD. "handle_double_click

ENDCLASS. "NOTIFICATION IMPLEMENTATION

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.

SELECT-OPTIONS : notnum FOR qmel-qmnum OBLIGATORY,

notype FOR qmel-qmart,

floc FOR qmih-btpln,

name FOR qmel-qmnam.

SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

SELECT qmnum qmtxt indtx qmdat ltrmn priok aufnr bezdt qmnam qmart INTO

TABLE itab1 FROM qmel WHERE qmnum IN notnum

AND qmart IN notype AND qmnam IN name.

SELECT qmnum btpln ingrp INTO TABLE itab2 FROM qmih FOR ALL ENTRIES IN

itab1 WHERE qmnum = itab1-qmnum and btpln in floc.

IF sy-subrc NE 0.

MESSAGE 'ENTER A VALID ENTRY' TYPE 'I'.

ENDIF.

LOOP AT itab1.

itab3-qmnum = itab1-qmnum.

itab3-qmtxt = itab1-qmtxt.

itab3-indtx = itab1-indtx.

itab3-qmdat = itab1-qmdat.

itab3-ltrmn = itab1-ltrmn.

itab3-priok = itab1-priok.

itab3-aufnr = itab1-aufnr.

itab3-bezdt = itab1-bezdt.

itab3-qmnam = itab1-qmnam.

itab3-qmart = itab1-qmart.

READ TABLE itab2 WITH KEY qmnum = itab1-qmnum.

itab3-btpln = itab2-btpln.

itab3-ingrp = itab2-ingrp.

APPEND itab3.

ENDLOOP.

END-OF-SELECTION.

CALL SCREEN '100'.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

  • SET TITLEBAR 'xxx'.

If flag eq 'N'.

Set pf-status '100' excluding 'SAVE'.

else.

SET PF-STATUS '100'.

clear flag.

endif.

IF gr_alvgrid IS INITIAL .

CREATE OBJECT gr_ccontainer

EXPORTING

  • PARENT =

container_name = gc_custom_control_name

  • STYLE =

  • LIFETIME = lifetime_default

  • REPID =

  • DYNNR =

  • NO_AUTODEF_PROGID_DYNNR =

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5

OTHERS = 6

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

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

ls_celltab1-fieldname = 'QMTXT'.

append ls_celltab1.

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

loop at itab3.

loop at ls_celltab1 into ls_celltab.

if ls_celltab-fieldname = 'QMTXT'.

if itab3-qmart = 'M1' or itab3-qmart = 'M2' or itab3-qmart = 'N1'.

ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.

else.

ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.

endif.

endif.

append ls_celltab to itab3-celltab.

modify itab3.

endloop.

endloop.

PERFORM prepare_field_catalog CHANGING gt_fieldcat.

CREATE OBJECT gr_alvgrid

EXPORTING

  • I_SHELLSTYLE = 0

  • I_LIFETIME =

i_parent = gr_ccontainer

  • I_APPL_EVENTS = space

  • I_PARENTDBG =

  • I_APPLOGPARENT =

  • I_GRAPHICSPARENT =

  • I_NAME =

EXCEPTIONS

error_cntl_create = 1

error_cntl_init = 2

error_cntl_link = 3

error_dp_create = 4

OTHERS = 5

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

  • gs_layout-edit = 'X'.

gs_layout-stylefname = 'CELLTAB'.

CALL METHOD gr_alvgrid->set_table_for_first_display

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

  • i_structure_name = 'Z94392_NOTIF'

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = 'X'

is_layout = gs_layout

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

it_outtab = itab3[]

IT_FIELDCATALOG = gt_fieldcat

  • IT_SORT =

  • IT_FILTER =

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

SET HANDLER notification=>handle_double_click FOR gr_alvgrid.

SET HANDLER notification=>handle_data_changed FOR gr_alvgrid.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE user_command_0100 INPUT.

DATA : answer1 TYPE c,

answer2 TYPE c.

CALL METHOD gr_alvgrid->check_changed_data.

if flag = 'N'.

Flag = 'Y'.

set pf-status '100'.

endif.

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

IF data_changed IS NOT INITIAL.

PERFORM popup_if_data_change_in_alv.

ELSE.

PERFORM popup_if_data_no_change_in_alv.

ENDIF.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Form handle_double_click

&----


  • text

----


  • -->P_E_ROW text

  • -->P_E_COLUMN text

  • -->P_ES_ROW_NO text

----


FORM handle_double_click USING e_row TYPE lvc_s_row

e_column TYPE lvc_s_col

es_row_no TYPE lvc_s_roid.

if flag = 'N'.

Flag = 'Y'.

set pf-status '100'.

endif.

DATA: t_output TYPE itab.

READ TABLE itab3 INTO t_output INDEX e_row-index .

IF sy-subrc = 0 AND e_column-fieldname EQ 'QMNUM'.

SET PARAMETER ID 'ABC' FIELD t_output-qmnum.

SET PARAMETER ID 'EFG' FIELD t_output-qmart.

SET PARAMETER ID 'IJK' FIELD t_output-btpln.

SET PARAMETER ID 'LMN' FIELD t_output-qmnam.

CALL TRANSACTION 'Z94406_SAPSCR' AND SKIP FIRST SCREEN.

ENDIF.

ENDFORM. " handle_double_click

&----


*& Form handle_data_changed

&----


  • text

----


  • -->P_ER_DATA_CHANGED text

  • -->P_E_ONF4 text

  • -->P_E_ONF4_BEFORE text

  • -->P_E_ONF4_AFTER text

----


FORM handle_data_changed USING er_data_changed type ref TO

cl_alv_changed_data_protocol.

SORT er_data_changed->mt_mod_cells BY row_id .

LOOP AT er_data_changed->mt_mod_cells

INTO ls_mod_cell

WHERE fieldname = 'QMTXT' .

append ls_mod_cell.

endloop.

data_changed = er_data_changed.

IF data_changed IS NOT INITIAL.

PERFORM popup_if_data_change_in_alv.

ELSE.

PERFORM popup_if_data_no_change_in_alv.

ENDIF.

ENDFORM. " handle_data_changed

&----


*& Form popup_if_data_change_in_alv

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM popup_if_data_change_in_alv .

CASE sy-ucomm.

WHEN 'SHIFT-F3'.

CALL FUNCTION 'C14A_POPUP_SAVE_WITH_CANCEL'

IMPORTING

e_answer = answer1.

IF answer1 EQ 'J'.

Perform save.

MESSAGE 'Data saved successfully' TYPE 'I'.

LEAVE PROGRAM.

CLEAR data_changed.

ELSEIF answer1 EQ 'N'.

LEAVE PROGRAM.

CLEAR data_changed.

ENDIF.

WHEN 'F3'.

CALL FUNCTION 'C14A_POPUP_SAVE_WITH_CANCEL'

IMPORTING

e_answer = answer2.

IF answer2 EQ 'J'.

Perform save.

MESSAGE 'Data saved successfully' TYPE 'I'.

LEAVE TO SCREEN '0'.

CLEAR data_changed.

ELSEIF answer2 EQ 'N'.

LEAVE TO SCREEN '0'.

CLEAR data_changed.

ENDIF.

WHEN 'F12'.

LEAVE TO SCREEN '0'.

CLEAR data_changed.

ENDCASE.

ENDFORM. " popup_if_data_change_in_alv

&----


*& Form popup_if_data_no_change_in_alv

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM popup_if_data_no_change_in_alv .

CASE sy-ucomm.

WHEN 'SHIFT-F3'.

LEAVE PROGRAM.

WHEN 'F3'.

LEAVE TO SCREEN '0'.

WHEN 'F12'.

LEAVE TO SCREEN '0'.

ENDCASE.

ENDFORM. " popup_if_data_no_change_in_alv

&----


*& Form save

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form save .

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

Data: Begin of notif.

include structure BAPI2080_NOTHDRI.

Data: end of notif.

DATA: t_output TYPE itab,

Notifheader type BAPI2080_NOTHDRI,

notifheader_x type BAPI2080_NOTHDRI_X,

RETURN2 TYPE BAPIRET2,

return type table of BAPIRET2,

return1 type table of BAPIRET2,

notifheader_export type BAPI2080_NOTHDRE.

Loop at ls_mod_cell.

READ TABLE itab3 INTO t_output INDEX ls_mod_cell-row_id.

Notifheader-short_text = ls_mod_cell-value.

Notifheader_x-short_text = ls_mod_cell-value.

CALL FUNCTION 'ALM_PM_NOTIFICATION_MODIFY'

EXPORTING

number = t_output-qmnum

NOTIFHEADER = notifheader

NOTIFHEADER_X = notifheader_x

IMPORTING

NOTIFHEADER_EXPORT = notifheader_export

TABLES

  • NOTIFITEM =

  • NOTIFITEM_X =

  • NOTIFCAUS =

  • NOTIFCAUS_X =

  • NOTIFACTV =

  • NOTIFACTV_X =

  • NOTIFTASK =

  • NOTIFTASK_X =

  • NOTIFPARTNR =

  • NOTIFPARTNR_X =

RETURN = return1

.

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

CALL FUNCTION 'ALM_PM_NOTIFICATION_SAVE'

EXPORTING

number = t_output-qmnum

IMPORTING

NOTIFHEADER = notifheader_export

TABLES

RETURN = return

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'

IMPORTING

RETURN = Return2.

.

endloop.

endform. " save

&----


*& Form prepare_field_catalog

&----


  • text

----


----


form prepare_field_catalog changing gt_fieldcat type lvc_t_fcat.

DATA ls_fcat type lvc_s_fcat .

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

I_STRUCTURE_NAME = 'Z94392_NOTIF'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_BYPASSING_BUFFER =

  • I_INTERNAL_TABNAME =

CHANGING

ct_fieldcat = GT_FIELDCAT[]

  • EXCEPTIONS

  • INCONSISTENT_INTERFACE = 1

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

LOOP AT Gt_fieldcat INTO ls_fcat .

CASE ls_fcat-fieldname .

WHEN 'QMTXT' .

ls_fcat-outputlen = '40' .

ls_fcat-coltext = 'Short Text' .

ls_fcat-seltext = 'Short Text' .

ls_fcat-edit = 'X'.

MODIFY gt_fieldcat FROM ls_fcat .

clear ls_fcat.

ENDCASE .

ENDLOOP .

endform. " prepare_field_catalog

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

Reward if helpful.

Former Member
0 Kudos

Hi,

Its code for SAP script...

&----


*& Report Z94406_SAPSCR_NOTIF *

*& *

&----


*& *

*& *

&----


REPORT Z94406_SAPSCR_NOTIF .

TABLES: qmel,qmih,z94392_notif,iflot.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.

PARAMETERS: N_NUMBER LIKE z94392_notif-QMNUM memory id ABC,

N_TYPE LIKE z94392_notif-QMART MEMORY ID EFG,

F_LOCA LIKE z94392_notif-btpln MEMORY ID IJK,

NAME LIKE z94392_notif-QMNAM MEMORY ID LMN.

SELECTION-SCREEN END OF BLOCK b1.

SELECT SINGLE * FROM QMEL WHERE QMNUM = N_NUMBER AND QMART = N_TYPE AND

QMNAM = NAME.

SELECT SINGLE * FROM QMIH WHERE QMNUM = N_NUMBER AND BTPLN = F_LOCA.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

  • APPLICATION = 'TX'

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMS =

  • DEVICE = 'PRINTER'

  • DIALOG = 'X'

FORM = 'Z94406_SAPSCR_NOTIF'

LANGUAGE = SY-LANGU

  • OPTIONS =

  • MAIL_SENDER =

  • MAIL_RECIPIENT =

  • MAIL_APPL_OBJECT =

  • RAW_DATA_INTERFACE = '*'

  • IMPORTING

  • LANGUAGE =

  • NEW_ARCHIVE_PARAMS =

  • RESULT =

  • EXCEPTIONS

  • CANCELED = 1

  • DEVICE = 2

  • FORM = 3

  • OPTIONS = 4

  • UNCLOSED = 5

  • MAIL_OPTIONS = 6

  • ARCHIVE_ERROR = 7

  • INVALID_FAX_NUMBER = 8

  • MORE_PARAMS_NEEDED_IN_BATCH = 9

  • SPOOL_ERROR = 10

  • CODEPAGE = 11

  • OTHERS = 12

.

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 'WRITE_FORM'

EXPORTING

ELEMENT = '100'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

  • IMPORTING

  • PENDING_LINES =

  • EXCEPTIONS

  • ELEMENT = 1

  • FUNCTION = 2

  • TYPE = 3

  • UNOPENED = 4

  • UNSTARTED = 5

  • WINDOW = 6

  • BAD_PAGEFORMAT_FOR_PRINT = 7

  • SPOOL_ERROR = 8

  • CODEPAGE = 9

  • OTHERS = 10

.

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 'CLOSE_FORM'

  • IMPORTING

  • RESULT =

  • RDI_RESULT =

  • TABLES

  • OTFDATA =

  • EXCEPTIONS

  • UNOPENED = 1

  • BAD_PAGEFORMAT_FOR_PRINT = 2

  • SEND_ERROR = 3

  • SPOOL_ERROR = 4

  • CODEPAGE = 5

  • OTHERS = 6

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

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

reward if helpful.