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

Table Maintenance Generator - Refresh?

Former Member
0 Likes
1,748

Hi Guys,

Thats the Requirement:

There should be an Add Line Button in the Customizing View.

So far i did this:

Via Table Maintenance Generator created a View.

With Enviroment ->Modifications -> User Interface and Events i replaced the Standard Interface and added my Button with a custom function code.

I created a Module and added it to the PAI.

The Module Code is as follows. However the screen doesn't show the new empty line Is there any way to tell SAP to refresh the screen or some other status flag to say the display has changed...?

DATA: BEGIN OF l_total OCCURS 0.

           INCLUDE STRUCTURE z_test.

           INCLUDE STRUCTURE vimflagtab.

   DATA: END OF l_total.

   DATA: BEGIN OF l_extract OCCURS 0.

           INCLUDE STRUCTURE z_test.

   DATA: END OF l_extract.

   data: l_code like ok_code.

*

   l_code = ok_code.

   CASE l_code.

     WHEN 'NEWBUTTON'.

       l_total[] = total[].

       l_extract[] = extract[].

       READ TABLE l_total WITH KEY mark = 'M'.

       IF sy-subrc = 0.

         "add line at this position

         APPEND INITIAL LINE TO l_total.

         APPEND INITIAL LINE TO l_extract.

       ELSE.

         "append line at the end

         APPEND INITIAL LINE TO l_total.

         APPEND INITIAL LINE TO l_extract.

       ENDIF.

       total[] = l_total[].

       extract[] = l_extract[].

   ENDCASE.

...

This is the List of the Modules in PAI - mine is the New_Button the rest is generated stuff:

PROCESS AFTER INPUT.

  MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.

  module NEW_button.

  MODULE LISTE_BEFORE_LOOP.

  LOOP AT EXTRACT.

    MODULE LISTE_INIT_WORKAREA.

    CHAIN.

     FIELD ZKMI_TEST-ZKEY .

     FIELD ZKMI_TEST-ZTEXT .

     MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.

    ENDCHAIN.

    FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.

    CHAIN.

     FIELD ZKMI_TEST-ZKEY .

     MODULE LISTE_UPDATE_LISTE.

    ENDCHAIN.

  ENDLOOP.

  MODULE LISTE_AFTER_LOOP.

For completness the Table for now has two columns key and text.

4 REPLIES 4
Read only

Former Member
0 Likes
873

Hallo Klaus,

do I understand clearly: when user start a view, he/she should see a line. In this line is a button, which give user a possibility to add new line ?? When user click button, new " initial line" should appear ... but it dosn't.

If yes, have you tried event 26 ??

Regards,

Marek.

Read only

0 Likes
873

Hi,

not completly. The view is the "normal" generated Table View. The Button is in the Menu. Basically besides Change/Display, Mark Block,  Mark all,...

But yes if the Button in Pressed it shall insert a blank line.

Read only

Former Member
0 Likes
873

Hi Klaus,

How this button is different from the 'New entries' button.?

Thanks

Read only

Former Member
0 Likes
873

hi Klaus,

the new line didnot display on the table, when you click the New button. This time you should click 'SAVE' button, then the new line will show on the screen. if you want ask why, just see logic in 'SAVE'.

hope it give you some help.

regards,

Archer.