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

RE: alv reports

Former Member
0 Likes
783

Hi All,

I'm having the final grid display and i have two fields editable in that.

the user edit the two fields and then save it by clicking the save button .

My issue is my internal table is not getting populated on the bases of changed values.

<b>Please let me know how to capture those values that are changed by user as i have to then finally display another alv with updated values</b>

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
759

Hi..

i assume that u r having all the neseccary code up to here...this is the code for SAVE button...

MODULE USER_COMMAND_0999 INPUT.

DATA:

H_TAB_WA LIKE G_TAB_WA.

CASE W_UCOMM.

WHEN 'BACK'.

LEAVE PROGRAM.

WHEN 'TAB_MODI' OR 'SAVE'.

LOOP AT G_TAB_ITAB INTO G_TAB_WA.

  • FORMAT INPUT OFF.

MOVE-CORRESPONDING G_TAB_WA TO YH642_RAM.

READ TABLE H_TAB_ITAB WITH KEY EID = G_TAB_WA-EID INTO H_TAB_WA.

IF SY-SUBRC EQ 0.

IF G_TAB_WA NE H_TAB_WA.

MODIFY YH642_RAM.

ENDIF.

ELSE.

INSERT YH642_RAM.

ENDIF.

ENDLOOP.

SORT G_TAB_ITAB.

ENDCASE.

*CALL SCREEN 700.

ENDMODULE. " USER_COMMAND_0999 INPUT

Hi..

i assume that u r having all the neseccary code up to here...this is the code for SAVE button...

MODULE USER_COMMAND_0999 INPUT.

DATA:

H_TAB_WA LIKE G_TAB_WA.

CASE W_UCOMM.

WHEN 'BACK'.

LEAVE PROGRAM.

WHEN 'TAB_MODI' OR 'SAVE'.

LOOP AT G_TAB_ITAB INTO G_TAB_WA.

  • FORMAT INPUT OFF.

MOVE-CORRESPONDING G_TAB_WA TO YH642_RAM.

READ TABLE H_TAB_ITAB WITH KEY EID = G_TAB_WA-EID INTO H_TAB_WA.

IF SY-SUBRC EQ 0.

IF G_TAB_WA NE H_TAB_WA.

MODIFY YH642_RAM.

ENDIF.

ELSE.

INSERT YH642_RAM.

ENDIF.

ENDLOOP.

SORT G_TAB_ITAB.

ENDCASE.

*CALL SCREEN 700.

ENDMODULE. " USER_COMMAND_0999 INPUT

6 REPLIES 6
Read only

Former Member
0 Likes
760

Hi..

i assume that u r having all the neseccary code up to here...this is the code for SAVE button...

MODULE USER_COMMAND_0999 INPUT.

DATA:

H_TAB_WA LIKE G_TAB_WA.

CASE W_UCOMM.

WHEN 'BACK'.

LEAVE PROGRAM.

WHEN 'TAB_MODI' OR 'SAVE'.

LOOP AT G_TAB_ITAB INTO G_TAB_WA.

  • FORMAT INPUT OFF.

MOVE-CORRESPONDING G_TAB_WA TO YH642_RAM.

READ TABLE H_TAB_ITAB WITH KEY EID = G_TAB_WA-EID INTO H_TAB_WA.

IF SY-SUBRC EQ 0.

IF G_TAB_WA NE H_TAB_WA.

MODIFY YH642_RAM.

ENDIF.

ELSE.

INSERT YH642_RAM.

ENDIF.

ENDLOOP.

SORT G_TAB_ITAB.

ENDCASE.

*CALL SCREEN 700.

ENDMODULE. " USER_COMMAND_0999 INPUT

Read only

Former Member
0 Likes
759

Do something like this:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = W_REPID

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM

P_SELFLD TYPE SLIS_SELFIELD.

case p_ucomm.

when 'SAVE'.

Data ref1 type ref to cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = ref1.

call method ref1->check_changed_data

endcase.

ENDFORM.

Regards,

Ravi

Read only

Former Member
0 Likes
759

BALVHT_EDITABLETEXT

check the program for sample code...

Reward if helpful...

Read only

Former Member
0 Likes
759

you have to refresh the alv for that by using the method call method gr_alvgrid->refresh_table_display.

Read only

Former Member
0 Likes
759

hi,

Look at the Below Program

http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_editable.htm

look at the below blog

/people/community.user/blog/2007/01/10/displaychange-mode-of-editable-fields-in-alv-using-function-modules-but-not-custom-containers

Regards

sudheer

Read only

Former Member
0 Likes
759

Hi

Its possible by using oops only.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = ref1.

call method ref1->check_changed_data

**Please reward suitable points***

With Regards

Navin Khedikar