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: 

How to have Multiple lines as an editable field in ALV

Former Member
0 Kudos

Hi Experts

Please help me out with the requirement ... As I need multiple lines as an Editable

Field in ALV Grid Report.

Regards,

Krishna

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Motuku,

You wish to make columns editable or whole rows . Kindly put your point clearly.

if you wish to make a column editable use

wa_fieldcat-edit = 'X'.

in the fieldcatalog for that field.

Hope this helps you

Asha

4 REPLIES 4

Former Member
0 Kudos

Hi Motuku,

You wish to make columns editable or whole rows . Kindly put your point clearly.

if you wish to make a column editable use

wa_fieldcat-edit = 'X'.

in the fieldcatalog for that field.

Hope this helps you

Asha

0 Kudos

HI asha,

i used what u have said ' wa_fieldcat-edit = 'X'. '.

there we can enter the text in a single line of that but i want it to be done in multiple lines.

if it is possible plz let me know

regards

krishna

Former Member
0 Kudos

DATA: lt_rows TYPE lvc_t_row ,

  • e_ucomm type sy-ucomm ,

ls_selected_line TYPE lvc_s_row,

lf_row_index TYPE lvc_index,

wa_spfli TYPE spfli .

CASE e_ucomm.

WHEN 'FLIGHTS'.

CALL METHOD grid->get_selected_rows

IMPORTING et_index_rows = lt_rows.

LOOP AT lt_rows INTO ls_selected_line .

lf_row_index = ls_selected_line-index.

READ TABLE itab INDEX lf_row_index INTO wa_spfli .

SELECT * FROM sflight INTO TABLE itab1

WHERE carrid = wa_spfli-carrid

AND connid = wa_spfli-connid .

APPEND LINES OF itab1 TO itab_final .

regds

anjali

Former Member
0 Kudos

Refer the following code:

DATA: g_container TYPE scrfname VALUE 'CUSTOM CONTROL',
      g_custom_container TYPE REF TO cl_gui_custom_container,
      g_grid  TYPE REF TO cl_gui_alv_grid,
      gs_layout TYPE lvc_s_layo,
      ok_code LIKE sy-ucomm,
      save_ok LIKE sy-ucomm.
.

DATA: gt_outtab TYPE TABLE OF sflight.


*---------------------------------------------------------------------*
*       MAIN                                                          *
*---------------------------------------------------------------------*
CALL SCREEN 100 STARTING AT 1 1..

*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*

MODULE status_0100 OUTPUT.
  SET PF-STATUS 'MAIN100'.
  SET TITLEBAR 'MAIN100'.

ENDMODULE.                 " STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  pbo  OUTPUT
*&---------------------------------------------------------------------*
MODULE pbo OUTPUT.

  IF g_custom_container IS INITIAL.

    CREATE OBJECT g_custom_container
      EXPORTING
        container_name              = g_container
      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.


    CREATE OBJECT g_grid
      EXPORTING
        i_parent          = g_custom_container
      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'.

    SELECT * FROM sflight INTO TABLE gt_outtab UP TO 10 ROWS.

*§1.Set status of all cells to editable using the layout structure.
    CALL METHOD g_grid->set_table_for_first_display
      EXPORTING
        i_structure_name              = 'SFLIGHT'
        is_layout                     = gs_layout
      CHANGING
        it_outtab                     = gt_outtab
      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.

*§2.Use SET_READY_FOR_INPUT to allow editing initially.
    CALL METHOD g_grid->set_ready_for_input
      EXPORTING
        i_ready_for_input = 1.

  ENDIF.
ENDMODULE.                 " pbo  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  pai  INPUT
*&---------------------------------------------------------------------*
MODULE pai INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'EXIT'.
      PERFORM exit_program.
    WHEN 'SWITCH'.
      PERFORM switch_edit_mode.
    WHEN OTHERS.
*     do nothing
  ENDCASE.
ENDMODULE.                 " pai  INPUT
*&---------------------------------------------------------------------*
*&      Form  exit_program
*&---------------------------------------------------------------------*
FORM exit_program .
  LEAVE PROGRAM.
ENDFORM.                    " exit_program
*&---------------------------------------------------------------------*
*&      Form  switch_edit_mode
*&---------------------------------------------------------------------*
FORM switch_edit_mode .

*§3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.
  IF g_grid->is_ready_for_input( ) EQ 0.
    CALL METHOD g_grid->set_ready_for_input
      EXPORTING
        i_ready_for_input = 1.
  ELSE.
    CALL METHOD g_grid->set_ready_for_input
      EXPORTING
        i_ready_for_input = 0.
  ENDIF.
ENDFORM.                    " switch_edit_mode