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

f4 on editable alv

Former Member
0 Likes
798

i ve 2 date fields on alv where user can enter dates. there shud be a provison like f4 help for these dates fields thru which user can choose his own date.

how can i do this

i ve 2 date fields on alv where user can enter dates. there shud be a provison like f4 help for these dates fields thru which user can choose his own date.

how can i do this

5 REPLIES 5
Read only

Former Member
0 Likes
714

Hi

while filling the field catalog, give the table name = table which is having date field

and fieldname = date field name.

this will give u automatically f4 help.

Read only

Former Member
0 Likes
714

Check below program

&----


*& Report ZEDIT_ALV

&----


REPORT zedit_alv.

DATA: i_zkb_test TYPE TABLE OF zkb_test,

w_zkb_test TYPE zkb_test.

DATA: o_grid TYPE REF TO cl_gui_alv_grid,

o_container TYPE REF TO cl_gui_custom_container.

DATA: lt_fcat TYPE lvc_t_fcat,

ls_layo TYPE lvc_s_layo,

ls_sort TYPE lvc_s_sort,

lt_sort TYPE lvc_t_sort,

ls_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.

START-OF-SELECTION.

CALL SCREEN 9000.

&----


*& Module STATUS_9000 OUTPUT

&----


  • text

----


MODULE status_9000 OUTPUT.

SET PF-STATUS '9000'.

  • SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_9000 OUTPUT

&----


*& Module display_alv_9000 OUTPUT

&----


  • text

----


MODULE display_alv_9000 OUTPUT.

IF o_container IS INITIAL.

SELECT * FROM zkb_test INTO TABLE i_zkb_test.

IF cl_gui_alv_grid=>offline( ) IS INITIAL.

  • Create a custom container control for ALV Control

CREATE OBJECT o_container

EXPORTING

container_name = 'CONTAINER'.

  • Create a ALV Control

CREATE OBJECT o_grid

EXPORTING i_parent = o_container.

PERFORM build_field_catalgue.

CALL METHOD o_grid->set_table_for_first_display

EXPORTING

i_save = 'A'

i_default = 'X'

is_layout = ls_layo

CHANGING

it_outtab = i_zkb_test

it_fieldcatalog = lt_fcat

it_sort = lt_sort[].

ENDIF.

ENDIF.

ENDMODULE. " display_alv_9000 OUTPUT

&----


*& Module user_command_9000 INPUT

&----


  • text

----


MODULE user_command_9000 INPUT.

CASE sy-ucomm .

WHEN 'BACK' OR 'EXIT'.

SET SCREEN 0.

LEAVE SCREEN.

WHEN 'UPDATE'.

CALL METHOD o_grid->check_changed_data.

MODIFY zkb_test FROM TABLE i_zkb_test.

IF sy-subrc EQ 0.

COMMIT WORK AND WAIT.

MESSAGE 'Data updated' TYPE 'I'.

ENDIF.

  • Refresh the same in ALV

CALL METHOD o_grid->refresh_table_display.

ENDCASE.

ENDMODULE. " user_command_9000 INPUT

&----


*& Form build_field_catalgue

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM build_field_catalgue .

DATA: ls_fcat TYPE lvc_s_fcat.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-cprog

i_internal_tabname = 'I_ZKB_TEST'

i_structure_name = 'ZKB_TEST'

i_client_never_display = 'X'

CHANGING

ct_fieldcat = ls_fieldcat[]

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE 'FCAT Error' TYPE 'I'.

EXIT.

ENDIF.

LOOP AT ls_fieldcat.

CLEAR ls_fcat.

ls_fcat-fieldname = ls_fieldcat-fieldname. "Fieldname

ls_fcat-ref_table = ls_fieldcat-tabname. "DDIC ref struct

ls_fcat-inttype = ls_fieldcat-inttype. "Data type

ls_fcat-outputlen = ls_fieldcat-outputlen. "Column width

ls_fcat-coltext = ls_fieldcat-seltext_m. "Column Header

ls_fcat-seltext = ls_fieldcat-seltext_m. "Column Desc

ls_fcat-ref_field = ls_fieldcat-ref_fieldname. "Reference field

ls_fcat-ref_table = ls_fieldcat-ref_tabname. "Reference table

CASE ls_fieldcat-fieldname.

WHEN 'MANDT' OR 'SNO'.

ls_fcat-edit = ' '.

WHEN OTHERS.

ls_fcat-edit = 'X'.

ENDCASE.

APPEND ls_fcat TO lt_fcat.

ENDLOOP.

ENDFORM. " build_field_catalgue

Rewards if useful...

Regards,

Minal

Read only

Former Member
0 Likes
714

Solved on my own

Read only

0 Likes
714

Hi,

Can you share with me how did you solved the problem?

Thanks,

Dana.

Read only

0 Likes
714

Hi

Which field you are trying to do..

is it a normal field or for a date field.

send me ur mail id with all details.

so that i can share u all the stuff.