Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3548

Clearing of table control after pressing insert button

$
0
0

Hi all,

I am developing table control with wizard in module pool.

My table control has following fields

SR NO  VBELN  NAME1 ORT01  NETWR

 

Initially when i run the tcode for the first time i had developed the code such that the serial no. Column fills automatically...i.e initially my table control is able to hold 12 records so my serial no.column will have count upto 12....

 

But the problem is when i select 12th record and press insert then the table control gets cleared and starts the count from the 1st row..

 

All the code is automatically generated by table control wizard......

For thar serial no. I had written the following code:

 

PBO

PROCESS BEFORE OUTPUT.

 

   MODULE ZTABCTRL_CHANGE_TC_ATTR.

 

   LOOP AT   IT_TAB

        INTO WA_TAB

        WITH CONTROL ZTABCTRL

        CURSOR ZTABCTRL-CURRENT_LINE.

    MODULE ZTABCTRL_GET_LINES.

 

   ENDLOOP.

------------------------------------------------------------------------

MODULE ZTABCTRL_CHANGE_TC_ATTR.

          DESCRIBE TABLE IT_TAB LINES sy-dbcnt.

         ZTABCTRL-lines = sy-dbcnt.

ENDMODULE.

----------------------------------------------------------------------------------

MODULE ZTABCTRL_GET_LINES.

     clear wa_tab.

     READ TABLE IT_TAB INTO WA_TAB INDEX ZTABCTRL-CURRENT_LINE.

      WA_TAB-SR_NO = ZTABCTRL-CURRENT_LINE.

ENDMODULE.

----------------------------------------------------------------------------------------------------------

PAI

LOOP AT IT_TAB.

     CHAIN.

    FIELD WA_TAB-SR_NO.

       FIELD WA_TAB-VBELN.

       FIELD WA_TAB-NAME1.

       FIELD WA_TAB-ORT01.

       FIELD WA_TAB-NETWR.

       MODULE ZTABCTRL_MODIFY ON CHAIN-REQUEST.

   ENDCHAIN.

 

     FIELD WA_TAB-MARK

       MODULE ZTABCTRL_MARK ON REQUEST.

   ENDLOOP.

   MODULE ZTABCTRL_USER_COMMAND.

-------------------------------------------------------------------------------

MODULE ZTABCTRL_MODIFY INPUT.

 

   MODIFY IT_TAB

     FROM WA_TAB

     INDEX ZTABCTRL-CURRENT_LINE.

 

   IF sy-subrc NE 0.

     loop at it_tab into wa_tab.

 

     APPEND wa_tab to  it_tab.

     endloop.

   ENDIF.

ENDMODULE.

-----------------------------------------------------------------------------------

MODULE ZTABCTRL_MARK ON REQUEST.

DATA: g_ZTABCTRL_wa2 like line of IT_TAB.

     if ZTABCTRL-line_sel_mode = 1

     and WA_TAB-MARK = 'X'.

      loop at IT_TAB into g_ZTABCTRL_wa2

        where MARK = 'X'.

        g_ZTABCTRL_wa2-MARK = ''.

        modify IT_TAB

          from g_ZTABCTRL_wa2

          transporting MARK.

      endloop.

   endif.

   MODIFY IT_TAB

     FROM WA_TAB

     INDEX ZTABCTRL-CURRENT_LINE

     TRANSPORTING MARK.

ENDMODULE.

---------------------------------------------------------------------------------------------------------------------------------------

MODULE ZTABCTRL_USER_COMMAND INPUT.

   OK_CODE = SY-UCOMM.

   PERFORM USER_OK_TC USING    'ZTABCTRL'

                               'IT_TAB'

                               'MARK'

                      CHANGING OK_CODE.

   SY-UCOMM = OK_CODE.

ENDMODULE.

---------------------------------------------------------------------------------------------------------------------------

 

All  code is auto generated through table control.

 

Please provide ur valuable solutions.

Regards,

Akil.


Viewing all articles
Browse latest Browse all 3548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>