Skip to Content
author's profile photo Former Member
Former Member

problem with ALV mehtod copy_row

Hello all,

i would like to realize an ALV with the function of copying a row.

i copied the example BCALV_EDIT_04 and commented the two lines that excluded the copy function. when i start my example i select a row, i push the button, but none of the fields are ready for an entry.

what's wrong with my example, what did i forget?

many thanks for your help.

Robert

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2007 at 02:35 PM

    Hello Robert,

    I#m not sure if I understood your problem clearly.

    You have to create a new line after copying the line you want to copy and then choose paste.

    Regards,

    Walter

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2007 at 03:05 PM

    Hi Walter,

    i'm sorry for my bad description. what i expected after i included the "copy_row"-method, was the following behaviour:

    - the dialog takes the line i marked

    - the line is inserted in the control

    - i can edit the values of the new line

    what happens is, that the dialog inserts the line in the control, but i can't edit any of the values. so in my opinion the "copy"-function does not work as i am used to it.

    thanks for your reply,

    Robert

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 03:29 AM

    Create screen with 9000

    &----


    *& Report Z_EDIT_ALV

    &----


    REPORT z_edit_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.

    <b> CALL SCREEN 9000.</b>

    &----


    *& 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

    <b> container_name = 'CONTAINER'.</b>

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

    Minal

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.