data_change using cl_salv_table - not reacting to Enter key












1














I want to populate a field when another field was edited. So this is the method in the implementation.



When I press Enter nothing happens, but when i double click the change applies.



Do you have any idea or fix? I am using the class cl_salv_table.



METHOD data_changed_finished.
DATA: ls_inr TYPE LINE OF lvc_t_modi,
lv_stbl TYPE lvc_s_stbl,
gt_out type standard table of SPFLI,
ls_out LIKE LINE OF gt_out.


LOOP AT et_good_cells INTO ls_inr
WHERE fieldname = 'CITYFROM'.
EXIT.
ENDLOOP.

DATA:
ld_REFRESH_MODE TYPE SALV_DE_CONSTANT ,
ld_S_STABLE TYPE LVC_S_STBL.
ld_S_STABLE-row = 'X'.
ld_S_STABLE-col = 'X'.

IF sy-subrc = 0.
LOOP AT et_good_cells INTO ls_inr.
LOOP AT IT_SPFLI INTO ls_out
FROM ls_inr-row_id
TO ls_inr-row_id.

ls_out-DISTANCE = '556'.
MODIFY IT_SPFLI FROM ls_out.

ENDLOOP.
ENDLOOP.

ENDIF.


lv_stbl-row = 'X'.
lv_stbl-col = 'X'.

ld_S_STABLE-row = 'X'.
ld_S_STABLE-col = 'X'.
ld_REFRESH_MODE = 2.

CALL METHOD salv->REFRESH(
EXPORTING
REFRESH_MODE = ld_REFRESH_MODE
S_STABLE = ld_S_STABLE ).

ENDMETHOD.









share|improve this question
























  • Remark: CL_SALV_TABLE doesn't support the edition of cells, and doesn't have the two events DATA_CHANGED and DATA_CHANGED_FINISHED, so you probably have used a trick to access the private ALV grid control, which is an instance of the class CL_GUI_ALV_GRID (and this one has the two events). So the question is more about CL_GUI_ALV_GRID.
    – Sandra Rossi
    Nov 21 at 9:20


















1














I want to populate a field when another field was edited. So this is the method in the implementation.



When I press Enter nothing happens, but when i double click the change applies.



Do you have any idea or fix? I am using the class cl_salv_table.



METHOD data_changed_finished.
DATA: ls_inr TYPE LINE OF lvc_t_modi,
lv_stbl TYPE lvc_s_stbl,
gt_out type standard table of SPFLI,
ls_out LIKE LINE OF gt_out.


LOOP AT et_good_cells INTO ls_inr
WHERE fieldname = 'CITYFROM'.
EXIT.
ENDLOOP.

DATA:
ld_REFRESH_MODE TYPE SALV_DE_CONSTANT ,
ld_S_STABLE TYPE LVC_S_STBL.
ld_S_STABLE-row = 'X'.
ld_S_STABLE-col = 'X'.

IF sy-subrc = 0.
LOOP AT et_good_cells INTO ls_inr.
LOOP AT IT_SPFLI INTO ls_out
FROM ls_inr-row_id
TO ls_inr-row_id.

ls_out-DISTANCE = '556'.
MODIFY IT_SPFLI FROM ls_out.

ENDLOOP.
ENDLOOP.

ENDIF.


lv_stbl-row = 'X'.
lv_stbl-col = 'X'.

ld_S_STABLE-row = 'X'.
ld_S_STABLE-col = 'X'.
ld_REFRESH_MODE = 2.

CALL METHOD salv->REFRESH(
EXPORTING
REFRESH_MODE = ld_REFRESH_MODE
S_STABLE = ld_S_STABLE ).

ENDMETHOD.









share|improve this question
























  • Remark: CL_SALV_TABLE doesn't support the edition of cells, and doesn't have the two events DATA_CHANGED and DATA_CHANGED_FINISHED, so you probably have used a trick to access the private ALV grid control, which is an instance of the class CL_GUI_ALV_GRID (and this one has the two events). So the question is more about CL_GUI_ALV_GRID.
    – Sandra Rossi
    Nov 21 at 9:20
















1












1








1







I want to populate a field when another field was edited. So this is the method in the implementation.



When I press Enter nothing happens, but when i double click the change applies.



Do you have any idea or fix? I am using the class cl_salv_table.



METHOD data_changed_finished.
DATA: ls_inr TYPE LINE OF lvc_t_modi,
lv_stbl TYPE lvc_s_stbl,
gt_out type standard table of SPFLI,
ls_out LIKE LINE OF gt_out.


LOOP AT et_good_cells INTO ls_inr
WHERE fieldname = 'CITYFROM'.
EXIT.
ENDLOOP.

DATA:
ld_REFRESH_MODE TYPE SALV_DE_CONSTANT ,
ld_S_STABLE TYPE LVC_S_STBL.
ld_S_STABLE-row = 'X'.
ld_S_STABLE-col = 'X'.

IF sy-subrc = 0.
LOOP AT et_good_cells INTO ls_inr.
LOOP AT IT_SPFLI INTO ls_out
FROM ls_inr-row_id
TO ls_inr-row_id.

ls_out-DISTANCE = '556'.
MODIFY IT_SPFLI FROM ls_out.

ENDLOOP.
ENDLOOP.

ENDIF.


lv_stbl-row = 'X'.
lv_stbl-col = 'X'.

ld_S_STABLE-row = 'X'.
ld_S_STABLE-col = 'X'.
ld_REFRESH_MODE = 2.

CALL METHOD salv->REFRESH(
EXPORTING
REFRESH_MODE = ld_REFRESH_MODE
S_STABLE = ld_S_STABLE ).

ENDMETHOD.









share|improve this question















I want to populate a field when another field was edited. So this is the method in the implementation.



When I press Enter nothing happens, but when i double click the change applies.



Do you have any idea or fix? I am using the class cl_salv_table.



METHOD data_changed_finished.
DATA: ls_inr TYPE LINE OF lvc_t_modi,
lv_stbl TYPE lvc_s_stbl,
gt_out type standard table of SPFLI,
ls_out LIKE LINE OF gt_out.


LOOP AT et_good_cells INTO ls_inr
WHERE fieldname = 'CITYFROM'.
EXIT.
ENDLOOP.

DATA:
ld_REFRESH_MODE TYPE SALV_DE_CONSTANT ,
ld_S_STABLE TYPE LVC_S_STBL.
ld_S_STABLE-row = 'X'.
ld_S_STABLE-col = 'X'.

IF sy-subrc = 0.
LOOP AT et_good_cells INTO ls_inr.
LOOP AT IT_SPFLI INTO ls_out
FROM ls_inr-row_id
TO ls_inr-row_id.

ls_out-DISTANCE = '556'.
MODIFY IT_SPFLI FROM ls_out.

ENDLOOP.
ENDLOOP.

ENDIF.


lv_stbl-row = 'X'.
lv_stbl-col = 'X'.

ld_S_STABLE-row = 'X'.
ld_S_STABLE-col = 'X'.
ld_REFRESH_MODE = 2.

CALL METHOD salv->REFRESH(
EXPORTING
REFRESH_MODE = ld_REFRESH_MODE
S_STABLE = ld_S_STABLE ).

ENDMETHOD.






abap alv






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 9:12









Sandra Rossi

2,2991315




2,2991315










asked Nov 21 at 3:12









Dumbest666

1410




1410












  • Remark: CL_SALV_TABLE doesn't support the edition of cells, and doesn't have the two events DATA_CHANGED and DATA_CHANGED_FINISHED, so you probably have used a trick to access the private ALV grid control, which is an instance of the class CL_GUI_ALV_GRID (and this one has the two events). So the question is more about CL_GUI_ALV_GRID.
    – Sandra Rossi
    Nov 21 at 9:20




















  • Remark: CL_SALV_TABLE doesn't support the edition of cells, and doesn't have the two events DATA_CHANGED and DATA_CHANGED_FINISHED, so you probably have used a trick to access the private ALV grid control, which is an instance of the class CL_GUI_ALV_GRID (and this one has the two events). So the question is more about CL_GUI_ALV_GRID.
    – Sandra Rossi
    Nov 21 at 9:20


















Remark: CL_SALV_TABLE doesn't support the edition of cells, and doesn't have the two events DATA_CHANGED and DATA_CHANGED_FINISHED, so you probably have used a trick to access the private ALV grid control, which is an instance of the class CL_GUI_ALV_GRID (and this one has the two events). So the question is more about CL_GUI_ALV_GRID.
– Sandra Rossi
Nov 21 at 9:20






Remark: CL_SALV_TABLE doesn't support the edition of cells, and doesn't have the two events DATA_CHANGED and DATA_CHANGED_FINISHED, so you probably have used a trick to access the private ALV grid control, which is an instance of the class CL_GUI_ALV_GRID (and this one has the two events). So the question is more about CL_GUI_ALV_GRID.
– Sandra Rossi
Nov 21 at 9:20














1 Answer
1






active

oldest

votes


















1














So, as I said in the comments, it's obvious to me that the question is more about CL_GUI_ALV_GRID (not CL_SALV_TABLE). By default the Enter key does not trigger the events DATA_CHANGED and DATA_CHANGED_FINISHED.



If you want this feature, you must call the method REGISTER_EDIT_EVENT and pass one of these two constants for a synchronous firing of the two events :




  • MC_EVT_ENTER : the events will always be fired when Enter is pressed, even if no cells have been changed

  • MC_EVT_MODIFIED : the events will be fired as soon as one cell is changed and either Enter is pressed or the focus is changed to another cell.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404765%2fdata-change-using-cl-salv-table-not-reacting-to-enter-key%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    So, as I said in the comments, it's obvious to me that the question is more about CL_GUI_ALV_GRID (not CL_SALV_TABLE). By default the Enter key does not trigger the events DATA_CHANGED and DATA_CHANGED_FINISHED.



    If you want this feature, you must call the method REGISTER_EDIT_EVENT and pass one of these two constants for a synchronous firing of the two events :




    • MC_EVT_ENTER : the events will always be fired when Enter is pressed, even if no cells have been changed

    • MC_EVT_MODIFIED : the events will be fired as soon as one cell is changed and either Enter is pressed or the focus is changed to another cell.






    share|improve this answer


























      1














      So, as I said in the comments, it's obvious to me that the question is more about CL_GUI_ALV_GRID (not CL_SALV_TABLE). By default the Enter key does not trigger the events DATA_CHANGED and DATA_CHANGED_FINISHED.



      If you want this feature, you must call the method REGISTER_EDIT_EVENT and pass one of these two constants for a synchronous firing of the two events :




      • MC_EVT_ENTER : the events will always be fired when Enter is pressed, even if no cells have been changed

      • MC_EVT_MODIFIED : the events will be fired as soon as one cell is changed and either Enter is pressed or the focus is changed to another cell.






      share|improve this answer
























        1












        1








        1






        So, as I said in the comments, it's obvious to me that the question is more about CL_GUI_ALV_GRID (not CL_SALV_TABLE). By default the Enter key does not trigger the events DATA_CHANGED and DATA_CHANGED_FINISHED.



        If you want this feature, you must call the method REGISTER_EDIT_EVENT and pass one of these two constants for a synchronous firing of the two events :




        • MC_EVT_ENTER : the events will always be fired when Enter is pressed, even if no cells have been changed

        • MC_EVT_MODIFIED : the events will be fired as soon as one cell is changed and either Enter is pressed or the focus is changed to another cell.






        share|improve this answer












        So, as I said in the comments, it's obvious to me that the question is more about CL_GUI_ALV_GRID (not CL_SALV_TABLE). By default the Enter key does not trigger the events DATA_CHANGED and DATA_CHANGED_FINISHED.



        If you want this feature, you must call the method REGISTER_EDIT_EVENT and pass one of these two constants for a synchronous firing of the two events :




        • MC_EVT_ENTER : the events will always be fired when Enter is pressed, even if no cells have been changed

        • MC_EVT_MODIFIED : the events will be fired as soon as one cell is changed and either Enter is pressed or the focus is changed to another cell.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 at 9:33









        Sandra Rossi

        2,2991315




        2,2991315






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404765%2fdata-change-using-cl-salv-table-not-reacting-to-enter-key%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            TypeError: fit_transform() missing 1 required positional argument: 'X'