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

Editable ALV

Former Member
0 Likes
355

Dear All,

I have created following editable ALV report

its working

my problem is how can i handle save option

this is a z table i want to save change data in the same z table

&----


*& Report ZNNT_ALV

*&

&----


*&

*&

&----


REPORT ZNNT_ALV.

*

----


  • MODULE *

*----


    • *

    • Objective : Asset Movement with Factory *

    • Program : Updates Tables ( ) *

    • : Outputs List ( X ) *

    • : Downloads data ( ) *

    • *

    • Technical Spec No : Central & Production Planning *

    • Date Created : 2007-12-13 *

    • Author : Nelson Rodrigo *

    • Location : Regents Court - Sri Lanka *

    • LDB : N/A *

    • *

*----


    • External Dependencies *

*----


    • *

*----


    • Amendment History *

*----


    • Who Change ID Reason *

*----


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

*----


  • Tables : *

*----


*

TABLES : ZPP009_004.

TABLES : SSCRFIELDS.

*

*----


  • Types Begin with TY_ *

*----


*

TYPE-POOLS : SLIS.

*

TYPES : BEGIN OF TY_ZPP009_004,

OVEN_TYPE TYPE ZPP009_004-OVEN_TYPE,

OVEN_AVLBLE TYPE ZPP009_004-OVEN_AVLBLE,

FIELD_STYLE TYPE LVC_T_STYL,

END OF TY_ZPP009_004.

*

*----


  • Constants Begin with C_ *

*----


  • *

  • *

*----


  • Internal tables Begin with IT_ *

*----


*

DATA : IT_ZPP009_004 TYPE STANDARD TABLE OF TY_ZPP009_004,

WA_ZPP009_004 TYPE TY_ZPP009_004.

  • *

*----


  • Data Begin with W_ *

*----


*

*------ ALV DATA DECLARATIONSs

DATA : FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.

DATA : IT_FIELDCAT TYPE LVC_T_FCAT,

WA_FIELDCAT TYPE LVC_S_FCAT,

GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV,

GD_LAYOUT TYPE LVC_S_LAYO,

GD_REPID LIKE SY-REPID.

*

DATA : ZSTAT(3) TYPE C.

  • *

*----


  • Field Symbols Begin with FS_ *

*----


  • *

  • *

*----


  • Select Options Begin with SO_ *

*----


*

*

*----


  • Parameter Begin with PR_ *

*----


  • *

*----


  • I N I T I A L I Z A T I O N *

*----


*

*----


  • A T S E L E C T I O N S C R E E N *

*----


*

  • AT SELECTION-SCREEN OUTPUT.

*BREAK ITNR.

  • ZSTAT = SSCRFIELDS-UCOMM.

*

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

  • s t a r t o f s e l e c t i o n

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

  • *

START-OF-SELECTION.

*

BREAK ITNR.

PERFORM ZPP009_DATA_COLLECTION.

PERFORM ZPP009_SET_FIELD_ATTRIBUTES.

PERFORM ZPP009_BUILD_FELDCAT.

PERFORM ZPP009_BUILD_LAYOUT.

PERFORM ZPP009_DISPLAY_FIELDCAT.

*

END-OF-SELECTION.

  • *

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

  • E N D O F S E L E C T I O N

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

----


*

  • end of page

*----


**********************----


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

  • E N D O F A B A P

**********************----


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

*

*

&----


*& Form ZPP009_DATA_COLLECTION

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM ZPP009_DATA_COLLECTION .

*

SELECT *

FROM ZPP009_004

INTO CORRESPONDING FIELDS OF TABLE IT_ZPP009_004.

*

ENDFORM. " ZPP009_DATA_COLLECTION

*

*

&----


*& Form ZPP009_SET_FIELD_ATTRIBUTES

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM ZPP009_SET_FIELD_ATTRIBUTES .

*

DATA : LS_STYLEROW TYPE LVC_S_STYL .

DATA : IT_STYLETAB TYPE LVC_T_STYL .

*

LOOP AT IT_ZPP009_004 INTO WA_ZPP009_004.

IF WA_ZPP009_004-OVEN_AVLBLE LT 10.

LS_STYLEROW-FIELDNAME = 'OVEN_AVLBLE' .

LS_STYLEROW-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.

APPEND LS_STYLEROW TO WA_ZPP009_004-FIELD_STYLE.

MODIFY IT_ZPP009_004 FROM WA_ZPP009_004.

ENDIF.

ENDLOOP.

*

ENDFORM. " ZPP009_SET_FIELD_ATTRIBUTES

*

*

&----


*& Form ZPP009_BUILD_FELDCAT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM ZPP009_BUILD_FELDCAT .

*

wa_fieldcat-fieldname = 'OVEN_TYPE'.

wa_fieldcat-scrtext_m = 'Oven Type'.

wa_fieldcat-col_pos = 0.

wa_fieldcat-outputlen = 10.

wa_fieldcat-emphasize = 'X'.

wa_fieldcat-key = 'X'.

APPEND wa_fieldcat TO it_fieldcat.

CLEAR wa_fieldcat.

*

wa_fieldcat-fieldname = 'OVEN_AVLBLE'.

wa_fieldcat-scrtext_m = 'Oven Availability'.

wa_fieldcat-edit = 'X'.

wa_fieldcat-col_pos = 7.

wa_fieldcat-outputlen = 15.

  • wa_fieldcat-datatype = 'CURR'.

APPEND wa_fieldcat TO it_fieldcat.

CLEAR wa_fieldcat.

*

ENDFORM. " ZPP009_BUILD_FELDCAT

*

*

&----


*& Form ZPP009_BUILD_LAYOUT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM ZPP009_BUILD_LAYOUT .

*

gd_layout-stylefname = 'FIELD_STYLE'.

gd_layout-zebra = 'X'.

ENDFORM. " BUILD_LAYOUT

&----


*& Form DISPLAY_ALV_REPORT

&----


  • Display report using ALV grid

----


FORM display_alv_report.

*

GD_REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'

EXPORTING

i_callback_program = GD_REPID

is_layout_lvc = GD_LAYOUT

it_fieldcat_lvc = IT_FIELDCAT

i_save = 'X'

TABLES

t_outtab = IT_ZPP009_004

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

*

*

&----


*& Form ZPP009_DISPLAY_FIELDCAT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM ZPP009_DISPLAY_FIELDCAT .

*

GD_REPID = SY-REPID.

*

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'

EXPORTING

i_callback_program = GD_REPID

is_layout_lvc = GD_LAYOUT

it_fieldcat_lvc = IT_FIELDCAT

i_save = 'X'

TABLES

t_outtab = IT_ZPP009_004

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

please help me

2 REPLIES 2
Read only

Former Member
0 Likes
315

Hi,

Check examples in example reports BCALV*.

Hope it helps.

Regards,

Mireia

Read only

Former Member
0 Likes
315

Hi Nelson,

Whenever you change the ALV grid , the final table that you have used to display the ALV gets automatically changed.

So whenever there is a change in the ALV, use " handle_data_changed " event and modify the table with the changed/new value.

Reward if Useful.

Regards,

Chitra

Message was edited by:

Chitra Parameswaran