Table Control Related Problem

Hi,
I have created table control displaying fields from ztable and now i have created user defined structure containing the same table as structure and one more field is added as MARK for capturing row. Now the problem is when i select one row on table control and scroll down to select another row and again if i scroll up to select another row , its not showing the previous row selected Please provide me solution
Please follow the code for reference.
On screen 0600.
PROCESS BEFORE OUTPUT.
  MODULE status_0600.
  MODULE fetch_data.
  MODULE vertical_scroll2.
  LOOP AT it_vnd INTO fl_vnd WITH CONTROL tbl_2.
    MODULE display_fetched_data.
  ENDLOOP.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0600.
  LOOP AT it_vnd.
    FIELD fl_vnd-mark
    MODULE move_records ON INPUT.
  ENDLOOP.
  MODULE create_records.
  MODULE change_delete.
In TOP INCLUDE
TYPES:   BEGIN OF zthird.
        INCLUDE STRUCTURE zfmmvndrcert.
TYPES:    mark TYPE c LENGTH 1.
TYPES:   END OF zthird.
CONTROLS :  tbl_2 TYPE TABLEVIEW USING SCREEN 0600.
DATA :         it_vnd TYPE  TABLE OF zthird,
                   it_evnd TYPE TABLE OF zthird,
                   it_strd TYPE TABLE OF zthird,
                   fl_vnd  TYPE zthird.
PROCESS BEFORE OUT.
MODULE status_0600 OUTPUT.
  DATA l_code TYPE TABLE OF sy-ucomm.
  APPEND 'SAVE' TO l_code.
  SET PF-STATUS 'ZVNDR' EXCLUDING l_code.
  SET TITLEBAR 'ZVND'.
ENDMODULE.                 " STATUS_0600  OUTPUT
MODULE fetch_data OUTPUT.
SOME  DATA FETCHING LOGIC IS THERE BUT NOT INCLUDED
  SORT it_vnd BY lifnr cert_number cert_type DESCENDING.
  LOOP AT it_strd INTO fl_vnd.
    fl_vnd-mark = c_x.
    MODIFY it_vnd FROM fl_vnd TRANSPORTING mark WHERE lifnr       = fl_vnd-lifnr
                                                AND   cert_number = fl_vnd-cert_number
                                                AND   cert_type   = fl_vnd-cert_type.
    CLEAR fl_vnd.
  ENDLOOP.
  DESCRIBE TABLE it_vnd LINES v_ln.
ENDMODULE.                 " fetch_data  OUTPUT
module vertical_scroll2 output.
describe table it_vnd
lines v_lines.
tbl_2-lines = v_lines + 2.
endmodule.                 " vertical_scroll2  OUTPUT
MODULE display_fetched_data OUTPUT.
    MOVE-CORRESPONDING fl_vnd TO zfmmvndrcert.
    CLEAR fl_vnd.
ENDMODULE.                 " display_fetched_data  OUTPUT
PROCESS AFTER INPUT.
MODULE move_records INPUT.
  IF v_fl EQ space.
    REFRESH : it_evnd,it_strd.
    v_fl = c_x.
  ENDIF.
  MOVE-CORRESPONDING zfmmvndrcert TO fl_vnd.
  fl_vnd-mark = c_x.
  MODIFY it_vnd FROM fl_vnd TRANSPORTING mark WHERE lifnr = fl_vnd-lifnr.
  APPEND fl_vnd to it_strd.
  APPEND fl_vnd TO it_evnd.
  CLEAR fl_vnd.
DESCRIBE TABLE it_evnd
lines v_ln.
ENDMODULE.                 " move_records  INPUT
Please provide me solution.
Thanks ...
PARAG
Edited by: Matt on Jan 14, 2009 2:02 PM added  tag

Ok. So you want to select multiple rows.
For this, add one single char field say SEL in your internal table for table control i.e it_vnd.
Then on your screen layout, table control properties add the field into w/SelName field (IT_VND-SEL).
Now when you select records in the table control, the field SEL will have value X.
Check if the above solution works.
regards,
Jinson

Similar Messages

  • Module pool question -table control related

    Hi All,
    I have table control with field mark some input enabled fields in it Now the problem is  when i change the content of one row and select that row then control goes to modue in PAI which is called on ON REQUEST but the changed vaule is not capturing in it only slected row with previous content come in that module . Can u suggest some solution or neccessary setting to be done in attribute of tabe control?
    If possible provide code for it
    Thanks
    Parag

    Hi,
       Please go through the following code below to solve your issue.
    REPORT demo_dynpro_tabcont_loop_at.
    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
    DATA: cols LIKE LINE OF flights-cols,
          lines TYPE i.
    DATA: ok_code TYPE sy-ucomm,
          save_ok TYPE sy-ucomm.
    DATA: itab TYPE TABLE OF demo_conn.
    TABLES demo_conn.
    *SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.*
    LOOP AT flights-cols INTO cols WHERE index GT 2.
      cols-screen-input = '0'.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDLOOP.
    CALL SCREEN 100.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
      DESCRIBE TABLE itab LINES lines.
      flights-lines = lines.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE read_table_control INPUT.
      MODIFY itab FROM demo_conn INDEX flights-current_line.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'TOGGLE'.
          LOOP AT flights-cols INTO cols WHERE index GT 2.
            IF  cols-screen-input = '0'.
              cols-screen-input = '1'.
            ELSEIF  cols-screen-input = '1'.
              cols-screen-input = '0'.
            ENDIF.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDLOOP.
        WHEN 'SORT_UP'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'SORT_DOWN'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'DELETE'.
          READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              DELETE itab.
            ENDLOOP.
          ENDIF.
      ENDCASE.
    ENDMODULE.

  • Table control related...

    Hi,
    My question is - how can I develop table control having three columns with only one column editable?

    Hi,
    write module in PBO as below
    *&      Module  FIELD_STATUS_9012  OUTPUT
          text
    module FIELD_STATUS_9012 output.
      LOOP AT SCREEN.
        CASE screen-name.
    The following are the screen field names
          WHEN 'WA_LC_BG_ACCT-BELNR' OR
               'WA_LC_BG_ACCT-WRBTR' OR
               'WA_LC_BG_ACCT-ZFBDT' OR
               'WA_LC_BG_ACCT-PYDATE' OR
               'WA_LC_BG_ACCT-BCHARG' OR
               'WA_LC_BG_ACCT-INTRST'.
              screen-input = 0.
              MODIFY SCREEN.
        ENDCASE.
      ENDLOOP.
    endmodule.                 " FIELD_STATUS_9012  OUTPUT
    Regards,
    Raju.

  • Problem in more than one table control in a BDT screen

    HI gurus,
    Please help, I have placed two table controls in a BDT screen (same screen), in Business Partner (BP). When  I put only one table control then that is working fine but when I place two table controls then problem starts, table don't get scrolled may times, please suggest, its urgent.

    Hi,
    Try to implement the notes
    800369
    789747
    768803
    768479
    754237
    And if this doesnt solve problem, then describe the problem in detail.
    Smita.

  • How to insert row in table control and save the data in tables

    Hi,
    I have one table control i am displaying data into table control ,
    my problem is : i want to display data into read mode in table control.
    but when i click on insert button on the same screen i want one blank line should inserted into table control , then i want to insert some data into table control on that row , when i click the save button . the new data inserted into the table control is insert that data into ztable ,
    please give me solution
    main problen is  how can know inserted line in table control and pass that data into ztable.

    Hi,
    Follow the below logic,
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0001.
      MODULE POPULATE_TABLE_CONTROL. --> Get the data from table store in 
                                                                          ITAB
      LOOP AT GT_CTRL_LP_D516 INTO GS_WA_CTRL_LP_D516
           WITH CONTROL CTRL_LP_D516
           CURSOR CTRL_LP_D516-CURRENT_LINE.
      The following module moves data to control
        MODULE MOVE_TO_CONTROL.--> Move data from ITAB to table control
      ENDLOOP.
    PROCESS AFTER INPUT.
      LOOP AT GT_CTRL_LP_D516.
      ENDLOOP.
      MODULE EXIT AT EXIT-COMMAND.
      MODULE USER_COMMAND_0001.  --> Here you have to take out the values from table control and update database table
    Reward points if helpful.
    Thanks and regards,
    Mallareddy Rayapureddy,
    Munich, Germany.

  • TABLE CONTROL IN SUBSCREEN

    Hi experts,
    In module pool programming in main screen i have added one sub screen.in subscreen i added one table control.my problem is i am not able to get cursor position in table controland how to disable the records in table control.how to enable one record in table control.please any body help me
    thanks in advance.
    tharangini.

    hi,
    set cursor field 'ITABL-MAKTX' line tabcon-top_line.
    tabcon is table control name.

  • Selection-screen pushbutton & Table Control

    Hi Everyone
    In my program i have a pushbutton in my selection-screen; this button call a screen with a table control, the problem is when i run my report and return to the first screen, the data in the TC is cleared.
    It's possible to save the information of my TC if i run my report and return to the first screen??
    Thanks & Regards
        David

    Hi,
    Write the logic for putting data from an internal table into table control in the PBO of the called screen & not in the PAI of the calling screen. Also, when you exit that screen, retrieve data into the internal table.
    For e.g. if Screen 9002 contains table control then
    PBO of Screen 9002:
    loop at it_itab into x_itab with control table_control_name.
    module put_data.
    endloop.
    PAI of screen 9002:
    loop at it_itab into x_itab.
    module get_data.
    endloop.
    Reward points if the answer is helpful.
    Regards,
    Mukul

  • Table control selection

    Hi,
    I have used GET CURSOR LINE V_LINE for getting the selected line number of my
    table control.To get values used
    READ ITAB INDEX  tablecontrolname_currentline.
    My table control visible length is 14.I have fisrst column as IDENTIFIER
    in my table control.say it has "10 to 40 " values.so for first 14 rows in the table
    control no problem.(for IDENTIFIER 10 TO 24).
    Upto 14 rows its retrieving IDENTIFIER correctly.
    when i scroll the page it will display new set of values.Say it have 12 to 26 now.
    When i select the row having IDENTIFIER 36 the line number is 14.So Get cursor line
    is taking it as 13.
    But while reading the table its reading the row its giving the values of the
    IDENTIFIER 24 which is the 14th row value in the table control.How to solve this problem??
    Regards,
    Anila

    Hi,
    Before calling the table control in the screen using
    Loop At ITAB..
    EndLoop.
    Describe table ITAB Lines LINES.
    TC_502-LINES = LINES.
    Should solve your problem
    Santhosh

  • Problem related to display column's full length as default in table control

    Hi Experts,
    I have a screen in report program. In that a table control has been designed.
    Now the issue is that when report program has been executed and the table control screen is called on a particular action then the table columns full length is not visible as default however when i checked the screen layout the default and visible length of colum header and column field is as per required.
    For example  - We have a Period field with default length as 6 and visible length as 15. Its column header is Period with both default length as 15 and visible length as 15.
    The period field has an internal table field reference and its format is NUMC.
    While column header Period is Text field created of type CHAR.
    Please suggest. Any help or inputs will be highly appreciated.
    Thanks,
    Akash

    Hi
    set cursor field 'WA_CODFOD-C_NOTE_NO' line mline.
    The value of MLINE can be from 1 and N, where N is the number of the lines shown in the table control, so if your table control can display 5 line, MLINE will be from 1 to 5.
    Now you need to create the link between the line of the table control and the line of internal table, the rule is:
    Internal Table Line = <table control>-TOP_LINE + <table control line> - 1.
    Max

  • Table Control Text  fields problem , help plz

    Hello Anand , Rich , John & All
      I hav problem with Text 3 fields( type c)(either L or R aligned )  , it is not geting updated , otherwise everything else is perfectly fine(scrolling,sorting etc ....) .
    Fields giving problem are
    1. Status(20) type c
    2. Fdat  type date
    3. Remark(100) type c
    All numerical fields are working fine .
    <u><b> My yahoo messenger-id is [email protected]</b></u>
    <b>Any light on this will be awarded plz .</b>
    FLOW LOGIC
    PROCESS BEFORE OUTPUT.
    MODULE SET_STATUS.
    LOOP AT      ITAB
          WITH    CONTROL TCL1
          CURSOR  TCL1-CURRENT_LINE .
       MODULE SET_LINE_COUNT .
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE UPD_OK_COD.
    MODULE EXIT_COMAND AT EXIT-COMMAND.
    MODULE SCROLL_SORT.
    LOOP AT ITAB.
          MODULE UPDATE_ITAB.
    ENDLOOP.
    MODULE UPDATE_TABLE.
    REPORT ZSD_REP_ORDER_BANK_CHANGE NO STANDARD PAGE HEADING LINE-SIZE 255.
    TABLES: VBAK,VBAP,VBRK,ZSD_TABL_ORDBANK,MARA,KONV.
    CONTROLS: TCL1 TYPE TABLEVIEW USING SCREEN 0200.
    DATA: ITAB LIKE ZSD_TABL_ORDBANK OCCURS 0 WITH HEADER LINE,
          WA_ITAB LIKE ZSD_TABL_ORDBANK,
          OK_CODE LIKE SY-UCOMM,
          SAVE_OK_CODE LIKE SY-UCOMM,
          UPD_OK_CODE LIKE SY-UCOMM,
          ANSWER TYPE C,
          I LIKE SY-LOOPC ,
          J LIKE SY-LOOPC,
          V_LINES LIKE SY-LOOPC,
          LINE_COUNT LIKE SY-LOOPC,
          STS  TYPE N,
          EMGRP LIKE MARA-EXTWG,
          QTY LIKE ZSD_TABL_ORDBANK-QTY,
          UPRICE LIKE ZSD_TABL_ORDBANK-UPRICE,
          TOT LIKE ZSD_TABL_ORDBANK-TOT,
          INO LIKE VBAP-POSNR,
          COL TYPE CXTAB_COLUMN,
          COPIED_ONCE ,
          FLDNAME(100),HELP(100).
    FIELD-SYMBOLS:
         <FS_ITAB> LIKE LINE OF ITAB,
         <FS_TCL1> LIKE LINE OF TCL1-COLS.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
      SELECT-OPTIONS: S_CCODE FOR ZSD_TABL_ORDBANK-CCODE
                              NO INTERVALS NO-EXTENSION  OBLIGATORY,
                      S_SORG  FOR ZSD_TABL_ORDBANK-SORG
                              NO INTERVALS NO-EXTENSION  OBLIGATORY,
                      S_DCHAN FOR ZSD_TABL_ORDBANK-DISTCHAN,
                      S_DIV FOR ZSD_TABL_ORDBANK-DIV,
                      S_MATNO FOR ZSD_TABL_ORDBANK-MATNO,
                      S_CUSTNO FOR ZSD_TABL_ORDBANK-CUSTNO ,
                      S_QTNO FOR ZSD_TABL_ORDBANK-QTNO,
                      S_QTDAT FOR ZSD_TABL_ORDBANK-QTDAT,
                      S_QTVDAT FOR ZSD_TABL_ORDBANK-QTVALDAT,
                      S_SONO   FOR ZSD_TABL_ORDBANK-SONO.
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN.
       SELECT * FROM  ZSD_TABL_ORDBANK
                   INTO  TABLE ITAB
                   WHERE CCODE IN S_CCODE
                     AND SORG IN  S_SORG
                     AND DISTCHAN IN  S_DCHAN
                     AND DIV IN S_DIV
                     AND MATNO IN  S_MATNO
                     AND CUSTNO IN  S_CUSTNO
                     AND QTNO IN  S_QTNO
                     AND QTDAT IN  S_QTDAT
                     AND QTVALDAT IN  S_QTVDAT
                     AND SONO IN  S_SONO .
          IF SY-SUBRC EQ 0.
             REFRESH ITAB.
             CLEAR COPIED_ONCE.
             CALL SCREEN 0200.
          ELSE.
             MESSAGE E012(ZQOTBANK) .
          ENDIF.
    *&      Module  SET_STATUS  OUTPUT
    *       text
    MODULE SET_STATUS OUTPUT.
      SET PF-STATUS '0200'.
      SET TITLEBAR '0200'.
        IF COPIED_ONCE IS INITIAL.
          SELECT * FROM  ZSD_TABL_ORDBANK
                   INTO  TABLE ITAB
                   WHERE CCODE IN S_CCODE
                     AND SORG IN  S_SORG
                     AND DISTCHAN IN  S_DCHAN
                     AND DIV IN S_DIV
                     AND MATNO IN  S_MATNO
                     AND CUSTNO IN  S_CUSTNO
                     AND QTNO IN  S_QTNO
                     AND QTDAT IN  S_QTDAT
                     AND QTVALDAT IN  S_QTVDAT
                     AND SONO IN  S_SONO .
          IF SY-SUBRC EQ 0.
            DESCRIBE TABLE ITAB LINES V_LINES.
            TCL1-LINES = V_LINES.
          ENDIF.
          COPIED_ONCE = 'X'.
          REFRESH CONTROL 'TCL1' FROM SCREEN '0200'.
       ENDIF.
          LOOP AT ITAB.
             QTY = ITAB-QTY.
             UPRICE  = ITAB-UPRICE.
             TOT = QTY * UPRICE .
             ITAB-TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-CGL_QTY.
             UPRICE  = ITAB-CGL_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-CGL_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-BHEL_QTY.
             UPRICE  = ITAB-BHEL_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-BHEL_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-ALSTOM_QTY.
             UPRICE  = ITAB-ALSTOM_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-ALSTOM_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-SIEMENS_QTY.
             UPRICE  = ITAB-SIEMENS_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-SIEMENS_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-TELK_QTY.
             UPRICE  = ITAB-TELK_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-TELK_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-OTH_QTY.
             UPRICE  = ITAB-OTH_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-OTH_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             MODIFY ITAB.
          ENDLOOP.
    ENDMODULE.                 " SET_STATUS  OUTPUT
    *&      Module  SET_LINE_COUNT  INPUT
    *       text
    MODULE SET_LINE_COUNT OUTPUT.
      LINE_COUNT = SY-LOOPC.
    ENDMODULE.                 " SET_LINE_COUNT  INPUT
    *&      Module  UPD_OK_CODE  INPUT
    *       text
    MODULE UPD_OK_COD INPUT.
    IF OK_CODE = 'SAVE'.
        UPD_OK_CODE = OK_CODE.
    *    CLEAR OK_CODE.
    ENDIF.
    ENDMODULE.                 " UPD_OK_CODE  INPUT
    *&      Module  EXIT_COMAND  INPUT
    *       text
    MODULE EXIT_COMAND INPUT.
    SAVE_OK_CODE = OK_CODE.
    CLEAR OK_CODE.
    CASE SAVE_OK_CODE.
        WHEN 'BACK'.
          CALL FUNCTION 'POPUP_TO_CONFIRM'
            EXPORTING
              TITLEBAR       = 'Order Bank Entry'
              TEXT_QUESTION  = 'Do you want to Go BacK ?'
              TEXT_BUTTON_1  = 'Yes'
              TEXT_BUTTON_2  = 'No'
              DEFAULT_BUTTON = '2'
            IMPORTING
              ANSWER         = ANSWER.
          IF ANSWER = '1'.
            LEAVE TO SCREEN 0.
          ELSE.
          ENDIF.
        WHEN '%EX'.
          CALL FUNCTION 'POPUP_TO_CONFIRM'
            EXPORTING
              TITLEBAR       = 'Order Bank Entry'
              TEXT_QUESTION  = 'Do you want to Exit ?'
              TEXT_BUTTON_1  = 'Yes'
              TEXT_BUTTON_2  = 'No'
              DEFAULT_BUTTON = '2'
            IMPORTING
              ANSWER         = ANSWER.
          IF ANSWER = '1'.
            LEAVE TO SCREEN 0.
          ELSE.
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " EXIT_COMAND  INPUT
    *&      Module  UPDATE_MOD  INPUT
    *       text
    MODULE UPDATE_ITAB INPUT.
        MODIFY TABLE ITAB FROM ITAB.
    ENDMODULE.                 " UPDATE_MOD  INPUT
    *&      Module SCROLL INPUT
    *       text
    MODULE SCROLL_SORT INPUT.
    SAVE_OK_CODE = OK_CODE.
    CLEAR OK_CODE.
    CASE SAVE_OK_CODE.
      WHEN 'P--'.
          TCL1-TOP_LINE = 1.
      WHEN 'P-'.
          TCL1-TOP_LINE = TCL1-TOP_LINE - LINE_COUNT.
          IF TCL1-TOP_LINE LE 0.
             TCL1-TOP_LINE = 1.
          ENDIF.
      WHEN 'P+'.
          I = TCL1-TOP_LINE + LINE_COUNT.
          J = TCL1-LINES - LINE_COUNT + 1.
          IF J LE 0.
             J = 1.
          ENDIF.
          IF I LE J.
             TCL1-TOP_LINE = I.
          ELSE.
             TCL1-TOP_LINE = J.
          ENDIF.
      WHEN 'P++'.
          TCL1-TOP_LINE = TCL1-LINES - LINE_COUNT + 1.
          IF TCL1-TOP_LINE LE 0.
              TCL1-TOP_LINE = 1.
          ENDIF.
      WHEN 'SORTUP'.
          READ TABLE TCL1-COLS ASSIGNING <FS_TCL1> WITH KEY SELECTED = 'X'.
          IF SY-SUBRC = 0.
              SPLIT <FS_TCL1>-SCREEN-NAME AT '-' INTO HELP FLDNAME.
              SORT ITAB ASCENDING BY (FLDNAME).
          ENDIF.
      WHEN 'SORTDN'.
          READ TABLE TCL1-COLS ASSIGNING <FS_TCL1> WITH KEY SELECTED = 'X'.
          IF SY-SUBRC = 0.
              SPLIT <FS_TCL1>-SCREEN-NAME AT '-' INTO HELP FLDNAME.
              SORT ITAB DESCENDING BY (FLDNAME).
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND  INPUT
    *&      Module  TABL_UPD  INPUT
    *       text
      MODULE UPDATE_TABLE INPUT.
       CASE UPD_OK_CODE.
       WHEN 'SAVE'.
         UPDATE ZSD_TABL_ORDBANK FROM TABLE ITAB .
         IF SY-SUBRC EQ 0.
             MESSAGE I002(ZQOTBANK) .
             CLEAR  UPD_OK_CODE.
         ELSE.
             MESSAGE E003(ZQOTBANK) .
         ENDIF.
       ENDCASE.
      ENDMODULE.                 " TABL_UPD  INPUT
    Thnx
    moni<b></b><b></b>
    Message was edited by: md monirujjaman
    Message was edited by: md monirujjaman

    Hi Moni,
    The problem as I had replied in your earlier post is with the MODIFY statement.
    MODIFY TABLE ITAB FROM ITAB. This statement will do the modifications based on the table key. When you have character fields as editable, then some problems are to be anticipated. In such a scenario, you must update the internal table based on the <i>index</i>, rather than based on <i>key</i>.
    So consider using
    MODIFY ITAB FROM ITAB INDEX TCL-CURRENT_LINE.
    Where TCL is the name of the Table Control. Also observe the difference in syntax here, don't use the TABLE keyword for the MODIFY statement.
    Please try it out and let me know.
    Regards,
    Anand Mandalika.

  • Table control small Issues , Plz help in tracing the problem

    Hello John , Rich , Anand & all
    My sorting is working fine but thr is small problem
    1. user has habit of pressing enter after everything,
        after entering the values in editable fields in Table control , it doesnt retain the entered values but if he presses save button  immediately after entering values , it saves .
    how 2 hold the values after pressing enter  button
    2. Now with this code , it saves the table control content but doesnt display the latest values immediately on the screen .
    3. User doesnt want to press SAVE button , he wants save the Table control content by pressing ENTER button,
      What is the OK_CODE value for Enter Button plz ?
    Plllllzzzzz help me for god sake ASAP.
    <u><b>Everyone whoever make an attempt is going to get 10 pnts.</b></u>
    ==========================
    FLOW Logic
    PROCESS BEFORE OUTPUT.
    MODULE SET_STATUS.
    LOOP AT ITAB
    WITH CONTROL TCL1
    CURSOR TCL1-CURRENT_LINE .
    MODULE SET_LINE_COUNT .
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE GET_OK_CODE .
    MODULE EXIT_COMAND AT EXIT-COMMAND.
    MODULE SCROLL_SORT.
    LOOP AT ITAB.
    MODULE UPDATE_MOD.
    ENDLOOP.
    ==========================
    REPORT ZSD_REP_ORDER_BANK_CHANGE NO STANDARD PAGE HEADING LINE-SIZE 255.
    TABLES: VBAK,VBAP,VBRK,ZSD_TABL_ORDBANK,MARA,KONV.
    CONTROLS: TCL1 TYPE TABLEVIEW USING SCREEN 0200.
    DATA: ITAB LIKE ZSD_TABL_ORDBANK OCCURS 0 WITH HEADER LINE,
          WA_ITAB LIKE ZSD_TABL_ORDBANK,
          OK_CODE LIKE SY-UCOMM,
          SAVE_OK_CODE LIKE SY-UCOMM,
          UPD_OK_CODE LIKE SY-UCOMM,
          ANSWER TYPE C,
          I LIKE SY-LOOPC ,
          J LIKE SY-LOOPC,
          V_LINES LIKE SY-LOOPC,
          LINE_COUNT LIKE SY-LOOPC,
          STS  TYPE N,
          EMGRP LIKE MARA-EXTWG,
          QTY LIKE ZSD_TABL_ORDBANK-QTY,
          UPRICE LIKE ZSD_TABL_ORDBANK-UPRICE,
          TOT LIKE ZSD_TABL_ORDBANK-TOT,
          INO LIKE VBAP-POSNR,
          COL TYPE CXTAB_COLUMN,
          COPIED_ONCE ,
          FLDNAME(100),HELP(100).
    FIELD-SYMBOLS:
         <FS_ITAB> LIKE LINE OF ITAB,
         <FS_TCL1> LIKE LINE OF TCL1-COLS.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
      SELECT-OPTIONS: S_CCODE FOR ZSD_TABL_ORDBANK-CCODE
                              NO INTERVALS NO-EXTENSION  OBLIGATORY,
                      S_SORG  FOR ZSD_TABL_ORDBANK-SORG
                              NO INTERVALS NO-EXTENSION  OBLIGATORY,
                      S_DCHAN FOR ZSD_TABL_ORDBANK-DISTCHAN,
                      S_DIV FOR ZSD_TABL_ORDBANK-DIV,
                      S_MATNO FOR ZSD_TABL_ORDBANK-MATNO,
                      S_CUSTNO FOR ZSD_TABL_ORDBANK-CUSTNO ,
                      S_QTNO FOR ZSD_TABL_ORDBANK-QTNO,
                      S_QTDAT FOR ZSD_TABL_ORDBANK-QTDAT,
                      S_QTVDAT FOR ZSD_TABL_ORDBANK-QTVALDAT,
                      S_SONO   FOR ZSD_TABL_ORDBANK-SONO.
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN.
       SELECT * FROM  ZSD_TABL_ORDBANK
                   INTO  TABLE ITAB
                   WHERE CCODE IN S_CCODE
                     AND SORG IN  S_SORG
                     AND DISTCHAN IN  S_DCHAN
                     AND DIV IN S_DIV
                     AND MATNO IN  S_MATNO
                     AND CUSTNO IN  S_CUSTNO
                     AND QTNO IN  S_QTNO
                     AND QTDAT IN  S_QTDAT
                     AND QTVALDAT IN  S_QTVDAT
                     AND SONO IN  S_SONO .
          IF SY-SUBRC EQ 0.
             REFRESH ITAB.
             CLEAR COPIED_ONCE.
             CALL SCREEN 0200.
          ELSE.
             MESSAGE E012(ZQOTBANK) .
          ENDIF.
    *&      Module  SET_STATUS  OUTPUT
          text
    MODULE SET_STATUS OUTPUT.
      SET PF-STATUS '0200'.
      SET TITLEBAR '0200'.
        IF COPIED_ONCE IS INITIAL.
          SELECT * FROM  ZSD_TABL_ORDBANK
                   INTO  TABLE ITAB
                   WHERE CCODE IN S_CCODE
                     AND SORG IN  S_SORG
                     AND DISTCHAN IN  S_DCHAN
                     AND DIV IN S_DIV
                     AND MATNO IN  S_MATNO
                     AND CUSTNO IN  S_CUSTNO
                     AND QTNO IN  S_QTNO
                     AND QTDAT IN  S_QTDAT
                     AND QTVALDAT IN  S_QTVDAT
                     AND SONO IN  S_SONO .
          IF SY-SUBRC EQ 0.
            DESCRIBE TABLE ITAB LINES V_LINES.
            TCL1-LINES = V_LINES.
          ENDIF.
          COPIED_ONCE = 'X'.
          REFRESH CONTROL 'TCL1' FROM SCREEN '0200'.
       ENDIF.
          LOOP AT ITAB.
             QTY = ITAB-QTY.
             UPRICE  = ITAB-UPRICE.
             TOT = QTY * UPRICE .
             ITAB-TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-CGL_QTY.
             UPRICE  = ITAB-CGL_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-CGL_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-BHEL_QTY.
             UPRICE  = ITAB-BHEL_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-BHEL_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-ALSTOM_QTY.
             UPRICE  = ITAB-ALSTOM_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-ALSTOM_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-SIEMENS_QTY.
             UPRICE  = ITAB-SIEMENS_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-SIEMENS_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-TELK_QTY.
             UPRICE  = ITAB-TELK_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-TELK_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             QTY = ITAB-OTH_QTY.
             UPRICE  = ITAB-OTH_UPRICE.
             TOT = QTY * UPRICE .
             ITAB-OTH_TOT = TOT .
             CLEAR: QTY, UPRICE, TOT.
             MODIFY ITAB.
          ENDLOOP.
    ENDMODULE.                 " SET_STATUS  OUTPUT
    *&      Module  SET_LINE_COUNT  INPUT
          text
    MODULE SET_LINE_COUNT OUTPUT.
      LINE_COUNT = SY-LOOPC.
    ENDMODULE.                 " SET_LINE_COUNT  INPUT
    *&      Module  GET_OK_CODE  INPUT
          text
    MODULE GET_OK_CODE INPUT.
      IF OK_CODE = 'SAVE'.
         UPD_OK_CODE = OK_CODE.
      ENDIF.
    ENDMODULE.                 " GET_OK_CODE  INPUT
    *&      Module  EXIT_COMAND  INPUT
          text
    MODULE EXIT_COMAND INPUT.
    SAVE_OK_CODE = OK_CODE.
    CLEAR OK_CODE.
    CASE SAVE_OK_CODE.
        WHEN 'BACK'.
          CALL FUNCTION 'POPUP_TO_CONFIRM'
            EXPORTING
              TITLEBAR       = 'Order Bank Entry'
              TEXT_QUESTION  = 'Do you want to Go BacK ?'
              TEXT_BUTTON_1  = 'Yes'
              TEXT_BUTTON_2  = 'No'
              DEFAULT_BUTTON = '2'
            IMPORTING
              ANSWER         = ANSWER.
          IF ANSWER = '1'.
            LEAVE TO SCREEN 0.
          ELSE.
          ENDIF.
        WHEN '%EX'.
          CALL FUNCTION 'POPUP_TO_CONFIRM'
            EXPORTING
              TITLEBAR       = 'Order Bank Entry'
              TEXT_QUESTION  = 'Do you want to Exit ?'
              TEXT_BUTTON_1  = 'Yes'
              TEXT_BUTTON_2  = 'No'
              DEFAULT_BUTTON = '2'
            IMPORTING
              ANSWER         = ANSWER.
          IF ANSWER = '1'.
            LEAVE TO SCREEN 0.
          ELSE.
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " EXIT_COMAND  INPUT
    *&      Module SCROLL INPUT
          text
    MODULE SCROLL_SORT INPUT.
    SAVE_OK_CODE = OK_CODE.
    CLEAR OK_CODE.
    CASE SAVE_OK_CODE.
      WHEN 'P--'.
          TCL1-TOP_LINE = 1.
      WHEN 'P-'.
          TCL1-TOP_LINE = TCL1-TOP_LINE - LINE_COUNT.
          IF TCL1-TOP_LINE LE 0.
             TCL1-TOP_LINE = 1.
          ENDIF.
      WHEN 'P+'.
          I = TCL1-TOP_LINE + LINE_COUNT.
          J = TCL1-LINES - LINE_COUNT + 1.
          IF J LE 0.
             J = 1.
          ENDIF.
          IF I LE J.
             TCL1-TOP_LINE = I.
          ELSE.
             TCL1-TOP_LINE = J.
          ENDIF.
      WHEN 'P++'.
          TCL1-TOP_LINE = TCL1-LINES - LINE_COUNT + 1.
          IF TCL1-TOP_LINE LE 0.
              TCL1-TOP_LINE = 1.
          ENDIF.
      WHEN 'SORTUP'.
          READ TABLE TCL1-COLS ASSIGNING <FS_TCL1> WITH KEY SELECTED = 'X'.
          IF SY-SUBRC = 0.
              SPLIT <FS_TCL1>-SCREEN-NAME AT '-' INTO HELP FLDNAME.
              SORT ITAB ASCENDING BY (FLDNAME).
          ENDIF.
      WHEN 'SORTDN'.
          READ TABLE TCL1-COLS ASSIGNING <FS_TCL1> WITH KEY SELECTED = 'X'.
          IF SY-SUBRC = 0.
              SPLIT <FS_TCL1>-SCREEN-NAME AT '-' INTO HELP FLDNAME.
              SORT ITAB DESCENDING BY (FLDNAME).
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND  INPUT
    *&      Module  UPDATE_MOD  INPUT
          text
    MODULE UPDATE_MOD INPUT.
    CASE UPD_OK_CODE.
    WHEN 'SAVE'.
          UPDATE ZSD_TABL_ORDBANK FROM ITAB .
          STS = SY-SUBRC .
          IF STS NE 0.
               MESSAGE E003(ZQOTBANK) .
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " UPDATE_MOD  INPUT
    Thnx
    Moni
    Message was edited by: md monirujjaman

    PROCESS BEFORE OUTPUT.
    MODULE SET_STATUS.
    LOOP AT      ITAB
          WITH    CONTROL TCL1
          CURSOR  TCL1-CURRENT_LINE .
       MODULE SET_LINE_COUNT .
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE GET_OK_CODE .
    MODULE EXIT_COMAND AT EXIT-COMMAND.
    MODULE SCROLL_SORT.
    LOOP AT ITAB.
          MODULE UPDATE_ITAB.
    ENDLOOP.
          MODULE UPDATE_TABLE.
    changed modules are ......
    *&      Module  UPDATE_MOD  INPUT
          text
    MODULE UPDATE_ITAB INPUT.
        MODIFY TABLE ITAB FROM ITAB.
    ENDMODULE.                 " UPDATE_MOD  INPUT
    *&      Module  TABL_UPD  INPUT
          text
      MODULE UPDATE_TABLE INPUT.
       CASE UPD_OK_CODE.
       WHEN 'SAVE'.
        UPDATE ZSD_TABL_ORDBANK FROM TABLE ITAB .
        IF SY-SUBRC NE 0.
             MESSAGE E003(ZQOTBANK) .
        ENDIF.
       ENDCASE.
      ENDMODULE.                 " TABL_UPD  INPUT
    now i m able 2 get the latest edited values from user immediately i press enter button and getting saved by pressing SAVE button but further problems are, i have one dropdown button for status 1 field , and  1 date field are not getting updated .
    So further help plz.

  • Problem in the BDC Table Control for the T.Code VA01

    Hi,
      I faced probelm in the BDC of the VA01. In the Table Control
    the records are entered upto 12 line items. after 13th line item overwrites the first record. How to solve the Problem.
    Please help me.

    or use this
    Internal table definition *
    data : begin of bdcdata occurs 0.
            include structure bdcdata.
    data : end of bdcdata.
    data: begin of messtab occurs 0.
            include structure bdcmsgcoll.
    data: end of messtab.
    data: v_chr_opengrp type c,
          r_matnr like mara-matnr,                       "variable for material conversion
          r_werks like marc-werks,                       "variable for plant
          v_str_fname   type string.
    data: begin of count2,
          inrec(9) type n,                               " input I_MATERIAL count
          create(9) type n,                              " create count
          error(9) type n,                               " error count
          bdc(9) type n,                                 " count of BDC creates
          end of count2.
    types: begin of ty_source,
    partn_numb(10) type n ,"Customer Number 1
    ref(035),
    sales_org(4) , "Sales Organization
    distr_chan(2) , "Distribution Channel
    division(002), "DIVISION
    doc_type(4) , "Sales Document Type
    purch_no(020), "Purchase order
    material like vbap-matnr,
    reqqty(018),
    reqdate(010),
    end of ty_source,
    begin of ty_header ,
    partn_numb(10) ,"Customer Number 1
    ref(035),
    sales_org(4) , "Sales Organization
    distr_chan(2) , "Distribution Channel
    division(002), "DIVISION
    doc_type(4) , "Sales Document Type
    purch_no(020), "Purchase order
    end of ty_header,
    begin of ty_item,
    partn_numb(10) ,"Customer Number 1
    ref(035),
    material like vbap-matnr,
    reqqty(018),
    reqdate(010),
    end of ty_item.
    data : msg(240) type c, " Return Message
    e_rec(8) type c, " Error Records Counter
    rec_no(8) type c, " Records Number Indicator
    s_rec(8) type c, " Successful Records Counter
    t_rec(8) type c, " Total Records Counter
    v_matnr like mara-matnr.
    data: val(2) type n value 01.
    data : begin of bdc_itab occurs 0.
            include structure bdcdata.
    data : end of bdc_itab.
    data : t_source type standard table of ty_source   with header line,
    t_header type standard table of ty_header initial size 1,
    t_item type standard table of ty_item initial size 1,
    t_target type standard table of bdcdata initial size 1.
    data : w_source type ty_source,
    w_source1 type ty_source,
    w_header type ty_header,
    w_item type ty_item,
    w_target type bdcdata,
    count type i,
    count1 type n.
    Variable Declaration
    data: w_fname type string,
    fnam(20),
    date1(10),
    i(2) type n,
    v_count type i,
    v_group type apqi-groupid.
    *& selection screen
    selection-screen :begin of block bl1 with frame title  text-001.
    parameters : p_fname type rlgrap-filename,                         "Input file
                 p_update(1) default 'N',                              "Input for update mode
                 p_bdcgrp(12) default 'SD_ORDERS'.                     "Input for session name
    selection-screen end of block bl1.
    **&SELECTION SCREEN VALIDATIONS
    at selection-screen on value-request for p_fname.
      call function 'KD_GET_FILENAME_ON_F4'
        exporting
          program_name  = 'ZMATERIAL'
          dynpro_number = '1000'
          field_name    = 'P_FNAME'
        changing
          file_name     = p_fname.
    *& Start of selection
    start-of-selection.
      if  p_fname is initial.
        message i016(rp) with 'Please enter a file name'.
        leave list-processing.
      else.
        move p_fname to  v_str_fname.
      endif.
      call function 'GUI_UPLOAD'
        exporting
          filetype                = 'ASC'
          filename                = v_str_fname
          has_field_separator     = 'X'
        tables
          data_tab                = t_source
        exceptions
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          others                  = 17.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
      sort t_source by ref partn_numb.
      loop at t_source into w_source.
        add 1 to count2-inrec.
        w_source1 = w_source.
       AT NEW PARTN_NUMB.  "10/31 KVB
        at new ref.
          w_header-doc_type = w_source1-doc_type..
          w_header-sales_org = w_source1-sales_org .            "'0001'
          w_header-distr_chan = w_source1-distr_chan.           "'01'
          w_header-division = w_source1-division.               " '01'
          w_header-purch_no = w_source1-purch_no.
          w_header-partn_numb = w_source1-partn_numb.
          w_header-ref = w_source1-ref.
          append w_header to t_header.
        endat.
        w_item-partn_numb = w_source1-partn_numb.
        w_item-material = w_source1-material.
        w_item-reqqty = w_source1-reqqty.
        w_item-ref = w_source1-ref.
        w_item-reqdate = w_source1-reqdate.
        append w_item to t_item.
        clear :w_item,w_header.
      endloop.
      loop at t_header into w_header.
        perform bdc_dynpro      using         'SAPMV45A'                  '0101'       .
        perform bdc_field       using         'BDC_CURSOR'                'VBAK-SPART'.
        perform bdc_field       using         'BDC_OKCODE'                '/00'.
        perform bdc_field       using         'VBAK-AUART'                w_header-doc_type.
        perform bdc_field       using         'VBAK-VKORG'                w_header-sales_org.
        perform bdc_field       using         'VBAK-VTWEG'                w_header-distr_chan.
        perform bdc_field       using         'VBAK-SPART'                w_header-division.
        perform bdc_dynpro      using         'SAPMV45A'                  '4001'     .
        perform bdc_field       using         'BDC_OKCODE'                '/00'.
        perform bdc_field       using         'BDC_CURSOR'               'VBKD-BSTKD'.
        perform bdc_field       using         'VBKD-BSTKD'                w_header-purch_no.
        perform bdc_field       using         'KUWEV-KUNNR'               w_header-partn_numb.
        i = 1.
        loop at t_item into w_item where partn_numb = w_header-partn_numb
                                         and ref = w_header-ref.
          at new partn_numb.
            clear count1.
            count = 0.
          endat.
          count = count + 1.
          if count gt 5.
            clear i.
            i = 2.
            perform bdc_dynpro      using 'SAPMV45A' '4001'      .
            perform bdc_field       using 'BDC_OKCODE' '=POAN'.
          endif.
          count1 = count1 + 1.
          concatenate 'VBAP-POSNR(' i ')' into fnam.
          perform bdc_field       using  fnam
                                        count1.
          concatenate 'RV45A-MABNR(' i ')' into fnam.
          perform bdc_field    using fnam                            w_item-material.
          concatenate 'RV45A-KWMENG(' i ')' into fnam.
          perform bdc_field       using  fnam                        w_item-reqqty..
          concatenate 'RV45A-ETDAT(' i ')' into fnam.
          perform bdc_field       using  fnam                         w_item-reqdate.
          concatenate 'VBKD-BSTKD_E(' i ')' into fnam.
          perform bdc_field       using  fnam                         w_item-ref.
          i = i + 1.
          clear:  w_item.
        endloop.
        clear w_header.
        perform bdc_dynpro      using 'SAPMV45A' '4001'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=SICH'.
        perform post_transaction.
        refresh bdc_itab.
        clear   bdc_itab.
      endloop.
    *endloop.
    end-of-selection.
      perform finalization.
           Start new screen                                              *
    form bdc_dynpro using program dynpro.
      clear bdc_itab.
      bdc_itab-program  = program.
      bdc_itab-dynpro   = dynpro.
      bdc_itab-dynbegin = 'X'.
      append bdc_itab.
    endform.                    "bdc_dynpro
           Insert field                                                  *
    form bdc_field using fnam fval.
      if fval <> ''.
        clear bdc_itab.
        bdc_itab-fnam = fnam.
        bdc_itab-fval = fval.
        append bdc_itab.
      endif.
    endform.                    "bdc_field
    **&      Form  get_filename
          text
    -->  p1        text
    <--  p2        text
    *form get_filename .
    *call function 'WS_FILENAME_GET'
       exporting
         def_filename     = space
         def_path         = file
         mask             = ',.,..'
         mode             = 'N'
         title            = text-015
       importing
         filename         = file
       exceptions
         inv_winsys       = 1
         no_batch         = 2
         selection_cancel = 3
         selection_error  = 4
         others           = 5.
    *endform.                    " get_filename
    *&      Form  post_transaction
          text
    -->  p1        text
    <--  p2        text
    form post_transaction .
      refresh messtab.
      clear   messtab.
      call transaction  'VA01' using bdc_itab
                  mode   p_update
                update  'S'
              messages into messtab.
      read table messtab with key msgtyp = 'E'.
      if sy-subrc eq 0.
        perform process_error_messages.
        add 1 to count2-bdc.
        if v_chr_opengrp is initial.
          perform bdc_open_group.
        endif.
        call function 'BDC_INSERT'
          exporting
            tcode          = 'VA01'
          tables
            dynprotab      = bdc_itab
          exceptions
            internal_error = 1
            not_open       = 2
            queue_error    = 3
            tcode_invalid  = 4
            others         = 5.
        if sy-subrc <> 0.
          case sy-subrc.
            when 1.
              write: / 'Internal error'.
            when 2.
              write: / 'Not open error'.
            when 3.
              write: / 'queue error'.
            when 4.
              write: / 'tcode invalid error'.
            when others.
              write: / 'other error'.
          endcase.
        endif.
      else.
        add +1 to count2-create.
        format intensified off.
        format color col_normal.
        format color col_normal off.
      endif.
      clear   bdc_itab.
      refresh bdc_itab.
    endform.                    " post_transaction
    *&      Form  finalization
          text
    -->  p1        text
    <--  p2        text
    form finalization .
      if v_chr_opengrp = 'X'.
        call function 'BDC_CLOSE_GROUP'
          exceptions
            not_open    = 1
            queue_error = 2
            others      = 3.
      endif.
      get time.
      skip 2.
      write: / 'Time', sy-uzeit.
      skip.
      format color col_total on.
      write: / 'Total Records: ',           40 count2-inrec.
      write: / 'PERNR not of Emp Group 6 ', 40 count2-error.
      write: / 'Records Created: ',         40 count2-create.
      write: / 'BDC Create in group: ',     40 count2-bdc.
      if v_chr_opengrp = 'X'.
        skip 1.
        format intensified on.
        format color col_negative on.
        write: / 'PLEASE USE TRANSACTION "SM35" ',
                 'TO PROCESS THE GENERATED BDC SESSION ... ',
                 p_bdcgrp.
      endif.
    endform.                    " finalization
    *&      Form  bdc_open_group
          text
    -->  p1        text
    <--  p2        text
    form bdc_open_group .
      call function 'BDC_OPEN_GROUP'
        exporting
          client              = sy-mandt
          group               = p_bdcgrp
          holddate            = sy-datum
          keep                = 'X'
          user                = sy-uname
        exceptions
          client_invalid      = 1
          destination_invalid = 2
          group_invalid       = 3
          group_is_locked     = 4
          holddate_invalid    = 5
          internal_error      = 6
          queue_error         = 7
          running             = 8
          system_lock_error   = 9
          user_invalid        = 10
          others              = 11.
      if sy-subrc eq 0.
        v_chr_opengrp = 'X'.
      endif.
    endform.                    " bdc_open_group
    *&      Form  process_error_messages
          text
    -->  p1        text
    <--  p2        text
    form process_error_messages .
      data: begin of loc_aux_message.
              include structure message.
      data: end of loc_aux_message.
      data : msgno type sy-msgno.
      loop at messtab.
        move messtab-msgnr to msgno.
        call function 'WRITE_MESSAGE'
          exporting
            msgid  = messtab-msgid
            msgno  = msgno
            msgty  = messtab-msgtyp
            msgv1  = messtab-msgv1
            msgv2  = messtab-msgv2
            msgv3  = messtab-msgv3
            msgv4  = messtab-msgv4
          importing
            messg  = loc_aux_message
          exceptions
            others = 1.
        if sy-subrc eq 0.
          format color col_negative on.
          write: /10 loc_aux_message.
          format color col_negative off.
        else.
          format color col_negative on.
          write: /10 t_source-partn_numb.
          write: / 'Error creating message'.
          format color col_negative off.
          exit.
        endif.
      endloop.
    endform.                    " process_error_messages

  • Problem in bdc for table control for line items

    Hi experts,
    I am runnig a bdc for ME52.
    i am just entering PR number, in the second screen i have got all the line items. I need to select these line item 10 and double click or hit enter, it takes me to screen 3, there im just checking a checkbox and saving.
    Again i need to select the line item 20 and double click or hit enter. again the same process.
    Again repeat for all the line items.
    But my problem is it is updating everytime for only line item  10. for line item 20 and others it say "no chnge in the data".
    I am pasting my code here. please check and revert me back .plz.
    DATA: w_output LIKE LINE OF i_output.
      REFRESH I_ITAB[].
      SELECT * FROM EBAN
               INTO TABLE i_itab
               WHERE banfn in s_banfn AND
                     bsart in s_bsart AND
                     bstyp in s_bstyp AND
                     matnr in s_matnr AND
                     werks in s_werks AND
                     lfdat in s_lfdat AND
                     pstyp in s_pstyp AND
                     knttp in s_knttp AND
                     estkz in s_estkz AND
                     loekz eq ' '.
      IF sy-subrc = 0.
        CLEAR: w_itab,
                 i_poitab[].
        SORT i_itab by banfn.
        LOOP AT i_itab INTO w_itab where menge GT eban-bsmng.
          IF p_close = 'X' AND p_rep = 'X'.
            IF w_itab-ebakz = 'X'.
              w_itab-ebakz = ' '.
              APPEND w_itab to i_poitab.
            ENDIF.
          ELSEIF p_open = 'X' AND p_rep = 'X'.
            IF w_itab-ebakz = ' '.
              w_itab-ebakz = 'X'.
              APPEND w_itab to i_poitab.
            ENDIF.
          ELSEIF p_close = 'X' AND p_repw = 'X'.
            IF w_itab-ebakz = ' '.
              APPEND w_itab to i_poitab.
            ENDIF.
          ELSEIF p_open = 'X' AND p_repw = 'X'.
            IF w_itab-ebakz = 'X'.
              APPEND w_itab to i_poitab.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDIF.
      LOOP AT i_poitab into w_output.
        APPEND w_output to i_output.
       PERFORM CALL_BDC.
      endloop.
    IF p_rep = 'X'.
    PERFORM CALL_BDC.
    ENDIF.
    ENDFORM.                    " GET_DATA
    *&      Form  CALL_BDC
          text
    -->  p1        text
    <--  p2        text
    FORM CALL_BDC.
    DATA: seltab(5) TYPE N,
          seltab1(2) TYPE N,
          tempvar(30) TYPE N,
          cnt TYPE N.
    LOOP AT i_output.
    clear: seltab,
           seltab1.
    seltab = i_output-bnfpo.
    seltab1 = seltab+2(2).
    perform bdc_dynpro      using 'SAPMM06B' '0105'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EBAN-BANFN'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'EBAN-BANFN'
                                  i_output-banfn.
    perform bdc_dynpro      using 'SAPMM06B' '0106'.
    clear tempvar.
    *cnt = 1.
    concatenate 'EBAN-BNFPO(' seltab1 ')' into tempvar.
    perform bdc_field       using 'BDC_CURSOR'
                                 'EBAN-BNFPO(seltab1)'.
                                    tempvar.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=DETA'.
    perform bdc_field       using 'RM06B-BNFPO'
                                  i_output-bnfpo.
    perform bdc_field       using 'RM06B-TCSELFLAG(seltab1)'
                                 'X'.
    perform bdc_dynpro      using 'SAPMM06B' '0102'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EBAN-EBAKZ'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    perform bdc_field       using 'EBAN-EBAKZ'
                                  i_output-ebakz.
    CALL TRANSACTION 'ME52' USING bdc_data MODE 'A'
                                   MESSAGES INTO i_bdcmsg.
        COMMIT WORK AND WAIT.
    ENDLOOP.
    ENDFORM.                    " CALL_BDC
    *&      Form  bdc_dynpro
          text
         -->P_0686   text
         -->P_0687   text
    FORM bdc_dynpro USING    program dynpro.
    CLEAR bdc_data.
      bdc_data-program  = program.
      bdc_data-dynpro   = dynpro.
      bdc_data-dynbegin = 'X'.
      APPEND bdc_data.
      CLEAR bdc_data.
    ENDFORM.   
    thanks,
    N

    Looks like table control logic is wrong -- do compare with below program...
    only table contril area
    REPORT ZPadmam
    NO STANDARD PAGE HEADING LINE-SIZE 255.
    DATA : BEGIN OF itab OCCURS 0,
    i1 TYPE i,
    lifnr LIKE rf02k-lifnr,
    bukrs LIKE rf02k-bukrs,
    ekorg LIKE rf02k-ekorg,
    ktokk LIKE rf02k-ktokk,
    anred LIKE lfa1-anred,
    name1 LIKE lfa1-name1,
    sortl LIKE lfa1-sortl,
    land1 LIKE lfa1-land1,
    akont LIKE lfb1-akont,
    fdgrv LIKE lfb1-fdgrv,
    waers LIKE lfm1-waers,
    END OF itab.
    DATA : BEGIN OF jtab OCCURS 0,
    j1 TYPE i,
    banks LIKE lfbk-banks,
    bankl LIKE lfbk-bankl,
    bankn LIKE lfbk-bankn,
    END OF jtab.
    DATA : cnt(4) TYPE n.
    DATA : fdt(20) TYPE c.
    DATA : c TYPE i.
    INCLUDE bdcrecx1.
    START-OF-SELECTION.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:\first1.txt'
    filetype = 'DAT'
    TABLES
    data_tab = itab.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:\second.txt'
    filetype = 'DAT'
    TABLES
    data_tab = jtab.
    LOOP AT itab.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-KTOKK'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'RF02K-LIFNR'
    itab-lifnr.
    PERFORM bdc_field USING 'RF02K-BUKRS'
    itab-bukrs.
    PERFORM bdc_field USING 'RF02K-EKORG'
    itab-ekorg.
    PERFORM bdc_field USING 'RF02K-KTOKK'
    itab-ktokk.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-LAND1'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFA1-ANRED'
    itab-anred.
    PERFORM bdc_field USING 'LFA1-NAME1'
    itab-name1.
    PERFORM bdc_field USING 'LFA1-SORTL'
    itab-sortl.
    PERFORM bdc_field USING 'LFA1-LAND1'
    itab-land1.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-KUNNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    cnt = 0.
    LOOP AT jtab WHERE j1 = itab-i1.
    cnt = cnt + 1.
    CONCATENATE 'LFBK-BANKS(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-banks.
    CONCATENATE 'LFBK-BANKL(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankl.
    CONCATENATE 'LFBK-BANKN(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankn.
    IF cnt = 5.
    cnt = 0.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=P+'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(02)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    ENDIF.
    ENDLOOP.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0210'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB1-FDGRV'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFB1-AKONT'
    itab-akont.
    PERFORM bdc_field USING 'LFB1-FDGRV'
    itab-fdgrv.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0215'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB1-ZTERM'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0220'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB5-MAHNA'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0310'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFM1-WAERS'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFM1-WAERS'
    itab-waers.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-LIFNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=YES'.
    PERFORM bdc_transaction USING 'XK01'.
    ENDLOOP.
    PERFORM close_group.
    Thanks
    Seshu

  • Table Control Dropdown List Problem

    Hi,
    I have this problem with my table control.
    I now have an input field (with input help) called: Reference Table, as well as a table control.
    What i need is to select the table names (select from the Reference table input help) and the field names will be populated inside the table control (according to the field names inside the respective tables) as a dropdown list.
    Refer to this diagram if unclear: http://img166.imageshack.us/img166/1066/tablecontrolwt4.png
    Please give me sample codes as i really need help.
    Will reward marks if useful.
    thanks a lot.
    Below is my codes:
    *& Report  ZHERA_TABLE3
    REPORT  ZHERA_TABLE3_EVONNE.
    DATA: P_HERA TYPE DNTAB-TABNAME VALUE 'Z07P4_REF',
           ITAB_HERA TYPE TABLE OF Z07P4_REF,
           FIELD_COUNT TYPE I,
           WA_HERA LIKE LINE OF ITAB_HERA.
    SELECT * INTO TABLE ITAB_HERA FROM Z07P4_REF.
    START-OF-SELECTION.
    CALL SCREEN 3000.
    MODULE STATUS_3000 OUTPUT.
      SET PF-STATUS 'UI'.
      SET TITLEBAR 'TITLE'.
    ENDMODULE.                    "STATUS_8000 OUTPUT
    MODULE USER_COMMAND_8000 INPUT
    MODULE USER_COMMAND_3000 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK' OR 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'SAVE'.
          PERFORM UPDATE_TABLE.
      ENDCASE.
    ENDMODULE.                    "USER_COMMAND_8000 INPUT
    *&SPWIZARD: DECLARATION OF TABLECONTROL 'ZTABLE' ITSELF
    CONTROLS: ZTABLE TYPE TABLEVIEW USING SCREEN 3000.
    *&SPWIZARD: LINES OF TABLECONTROL 'ZTABLE'
    DATA:     G_ZTABLE_LINES  LIKE SY-LOOPC.
    DATA:     OK_CODE LIKE SY-UCOMM.
    *&SPWIZARD: OUTPUT MODULE FOR TC 'ZTABLE'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: UPDATE LINES FOR EQUIVALENT SCROLLBAR
    MODULE ZTABLE_CHANGE_TC_ATTR OUTPUT.
      DESCRIBE TABLE ITAB_HERA LINES ZTABLE-lines.
    ENDMODULE.
    *&SPWIZARD: OUTPUT MODULE FOR TC 'ZTABLE'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: GET LINES OF TABLECONTROL
    MODULE ZTABLE_GET_LINES OUTPUT.
      G_ZTABLE_LINES = SY-LOOPC.
    ENDMODULE.
    *&SPWIZARD: INPUT MODULE FOR TC 'ZTABLE'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: MODIFY TABLE
    MODULE ZTABLE_MODIFY INPUT.
      MODIFY ITAB_HERA
        FROM WA_HERA
        INDEX ZTABLE-CURRENT_LINE.
    ENDMODULE.
    *&SPWIZARD: INPUT MODULE FOR TC 'ZTABLE'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: PROCESS USER COMMAND
    MODULE ZTABLE_USER_COMMAND INPUT.
      OK_CODE = SY-UCOMM.
      PERFORM USER_OK_TC USING    'ZTABLE'
                                  'ITAB_HERA'
                         CHANGING OK_CODE.
      SY-UCOMM = OK_CODE.
    ENDMODULE.
      INCLUDE TABLECONTROL_FORMS                                         *
    *&      Form  USER_OK_TC                                               *
    FORM USER_OK_TC USING    P_TC_NAME TYPE DYNFNAM
                              P_TABLE_NAME
                              P_MARK_NAME
                     CHANGING P_OK      LIKE SY-UCOMM.
    &SPWIZARD: BEGIN OF LOCAL DATA----
       DATA: L_OK              TYPE SY-UCOMM,
             L_OFFSET          TYPE I.
    &SPWIZARD: END OF LOCAL DATA----
    *&SPWIZARD: Table control specific operations                          *
    *&SPWIZARD: evaluate TC name and operations                            *
       SEARCH P_OK FOR P_TC_NAME.
       IF SY-SUBRC <> 0.
         EXIT.
       ENDIF.
       L_OFFSET = STRLEN( P_TC_NAME ) + 1.
       L_OK = P_OK+L_OFFSET.
    *&SPWIZARD: execute general and TC specific operations                 *
       CASE L_OK.
         WHEN 'INSR'.                      "insert row
           PERFORM FCODE_INSERT_ROW USING    P_TC_NAME
                                             P_TABLE_NAME.
           CLEAR P_OK.
         WHEN 'DELE'.                      "delete row
           PERFORM FCODE_DELETE_ROW USING    P_TC_NAME
                                             P_TABLE_NAME
                                             P_MARK_NAME.
           CLEAR P_OK.
         WHEN 'P--' OR                     "top of list
              'P-'  OR                     "previous page
              'P+'  OR                     "next page
              'P++'.                       "bottom of list
           PERFORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
                                                 L_OK.
           CLEAR P_OK.
        WHEN 'L--'.                       "total left
          PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.
        WHEN 'L-'.                        "column left
          PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.
        WHEN 'R+'.                        "column right
          PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.
        WHEN 'R++'.                       "total right
          PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.
         WHEN 'MARK'.                      "mark all filled lines
           PERFORM FCODE_TC_MARK_LINES USING P_TC_NAME
                                             P_TABLE_NAME
                                             P_MARK_NAME   .
           CLEAR P_OK.
         WHEN 'DMRK'.                      "demark all filled lines
           PERFORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
                                               P_TABLE_NAME
                                               P_MARK_NAME .
           CLEAR P_OK.
        WHEN 'SASCEND'   OR
             'SDESCEND'.                  "sort column
          PERFORM FCODE_SORT_TC USING P_TC_NAME
                                      l_ok.
       ENDCASE.
    ENDFORM.                              " USER_OK_TC
    *&      Form  FCODE_INSERT_ROW                                         *
    FORM fcode_insert_row
                   USING    P_TC_NAME           TYPE DYNFNAM
                            P_TABLE_NAME             .
    &SPWIZARD: BEGIN OF LOCAL DATA----
       DATA L_LINES_NAME       LIKE FELD-NAME.
       DATA L_SELLINE          LIKE SY-STEPL.
       DATA L_LASTLINE         TYPE I.
       DATA L_LINE             TYPE I.
       DATA L_TABLE_NAME       LIKE FELD-NAME.
       FIELD-SYMBOLS <TC>                 TYPE CXTAB_CONTROL.
       FIELD-SYMBOLS <TABLE>              TYPE STANDARD TABLE.
       FIELD-SYMBOLS <LINES>              TYPE I.
    &SPWIZARD: END OF LOCAL DATA----
       ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
       CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
       ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: get looplines of TableControl                              *
       CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_LINES_NAME.
       ASSIGN (L_LINES_NAME) TO <LINES>.
    *&SPWIZARD: get current line                                           *
       GET CURSOR LINE L_SELLINE.
       IF SY-SUBRC <> 0.                   " append line to table
         L_SELLINE = <TC>-LINES + 1.
    *&SPWIZARD: set top line                                               *
         IF L_SELLINE > <LINES>.
           <TC>-TOP_LINE = L_SELLINE - <LINES> + 1 .
         ELSE.
           <TC>-TOP_LINE = 1.
         ENDIF.
       ELSE.                               " insert line into table
         L_SELLINE = <TC>-TOP_LINE + L_SELLINE - 1.
         L_LASTLINE = <TC>-TOP_LINE + <LINES> - 1.
       ENDIF.
    *&SPWIZARD: set new cursor line                                        *
       L_LINE = L_SELLINE - <TC>-TOP_LINE + 1.
    *&SPWIZARD: insert initial line                                        *
       INSERT INITIAL LINE INTO <TABLE> INDEX L_SELLINE.
       <TC>-LINES = <TC>-LINES + 1.
    *&SPWIZARD: set cursor                                                 *
       SET CURSOR LINE L_LINE.
    ENDFORM.                              " FCODE_INSERT_ROW
    *&      Form  FCODE_DELETE_ROW                                         *
    FORM fcode_delete_row
                   USING    P_TC_NAME           TYPE DYNFNAM
                            P_TABLE_NAME
                            P_MARK_NAME   .
    &SPWIZARD: BEGIN OF LOCAL DATA----
       DATA L_TABLE_NAME       LIKE FELD-NAME.
       FIELD-SYMBOLS <TC>         TYPE cxtab_control.
       FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
       FIELD-SYMBOLS <WA>.
       FIELD-SYMBOLS <MARK_FIELD>.
    &SPWIZARD: END OF LOCAL DATA----
       ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
       CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
       ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: delete marked lines                                        *
       DESCRIBE TABLE <TABLE> LINES <TC>-LINES.
       LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
         ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
         IF <MARK_FIELD> = 'X'.
           DELETE <TABLE> INDEX SYST-TABIX.
           IF SY-SUBRC = 0.
             <TC>-LINES = <TC>-LINES - 1.
           ENDIF.
         ENDIF.
       ENDLOOP.
    ENDFORM.                              " FCODE_DELETE_ROW
    *&      Form  COMPUTE_SCROLLING_IN_TC
          text
         -->P_TC_NAME  name of tablecontrol
         -->P_OK       ok code
    FORM COMPUTE_SCROLLING_IN_TC USING    P_TC_NAME
                                           P_OK.
    &SPWIZARD: BEGIN OF LOCAL DATA----
       DATA L_TC_NEW_TOP_LINE     TYPE I.
       DATA L_TC_NAME             LIKE FELD-NAME.
       DATA L_TC_LINES_NAME       LIKE FELD-NAME.
       DATA L_TC_FIELD_NAME       LIKE FELD-NAME.
       FIELD-SYMBOLS <TC>         TYPE cxtab_control.
       FIELD-SYMBOLS <LINES>      TYPE I.
    &SPWIZARD: END OF LOCAL DATA----
       ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get looplines of TableControl                              *
       CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_TC_LINES_NAME.
       ASSIGN (L_TC_LINES_NAME) TO <LINES>.
    *&SPWIZARD: is no line filled?                                         *
       IF <TC>-LINES = 0.
    *&SPWIZARD: yes, ...                                                   *
         L_TC_NEW_TOP_LINE = 1.
       ELSE.
    *&SPWIZARD: no, ...                                                    *
         CALL FUNCTION 'SCROLLING_IN_TABLE'
              EXPORTING
                   ENTRY_ACT             = <TC>-TOP_LINE
                   ENTRY_FROM            = 1
                   ENTRY_TO              = <TC>-LINES
                   LAST_PAGE_FULL        = 'X'
                   LOOPS                 = <LINES>
                   OK_CODE               = P_OK
                   OVERLAPPING           = 'X'
              IMPORTING
                   ENTRY_NEW             = L_TC_NEW_TOP_LINE
              EXCEPTIONS
                 NO_ENTRY_OR_PAGE_ACT  = 01
                 NO_ENTRY_TO           = 02
                 NO_OK_CODE_OR_PAGE_GO = 03
                   OTHERS                = 0.
       ENDIF.
    *&SPWIZARD: get actual tc and column                                   *
       GET CURSOR FIELD L_TC_FIELD_NAME
                  AREA  L_TC_NAME.
       IF SYST-SUBRC = 0.
         IF L_TC_NAME = P_TC_NAME.
    *&SPWIZARD: et actual column                                           *
           SET CURSOR FIELD L_TC_FIELD_NAME LINE 1.
         ENDIF.
       ENDIF.
    *&SPWIZARD: set the new top line                                       *
       <TC>-TOP_LINE = L_TC_NEW_TOP_LINE.
    ENDFORM.                              " COMPUTE_SCROLLING_IN_TC
    *&      Form  FCODE_TC_MARK_LINES
          marks all TableControl lines
         -->P_TC_NAME  name of tablecontrol
    FORM FCODE_TC_MARK_LINES USING P_TC_NAME
                                   P_TABLE_NAME
                                   P_MARK_NAME.
    &SPWIZARD: EGIN OF LOCAL DATA----
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE cxtab_control.
      FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <WA>.
      FIELD-SYMBOLS <MARK_FIELD>.
    &SPWIZARD: END OF LOCAL DATA----
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
       CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
       ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: mark all filled lines                                      *
      LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
         ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
         <MARK_FIELD> = 'X'.
      ENDLOOP.
    ENDFORM.                                          "fcode_tc_mark_lines
    *&      Form  FCODE_TC_DEMARK_LINES
          demarks all TableControl lines
         -->P_TC_NAME  name of tablecontrol
    FORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
                                     P_TABLE_NAME
                                     P_MARK_NAME .
    &SPWIZARD: BEGIN OF LOCAL DATA----
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE cxtab_control.
      FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <WA>.
      FIELD-SYMBOLS <MARK_FIELD>.
    &SPWIZARD: END OF LOCAL DATA----
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
       CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
       ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: demark all filled lines                                    *
      LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
         ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
         <MARK_FIELD> = SPACE.
      ENDLOOP.
    ENDFORM.                                          "fcode_tc_mark_lines
    FORM UPDATE_TABLE.
      "Update physical database table
      UPDATE Z07P4_REF FROM TABLE ITAB_HERA.
    ENDFORM.                    "UPDATE_TABLE
    Edited by: Evonne Gow on Jan 4, 2008 2:52 AM

    hey gary help me lei...
    Edited by: Evonne Gow on Jan 4, 2008 2:55 AM

  • Problem in SCROLLING  of TABLE CONTROL which is designed using WIZARD

    Hello Friends ,
                              I have designed a entry screen by using table control with wizard.  My table control layout  has 11 rows. I have used all 3 facilities i.e. SCROLLING , INSERT/DELETE  & SELECT/DESELECT by cheking ( ticking ) check boxes while designing table control with wizard.  
      Now i have 3 problems.
    1> In my entry screen , if 11 entries are entered , they are displayed in entry screen and are saved correctly in DB.
         But when  i copy a file of suppose 15 entries into entry screen then it displays only 11 entries in entry screen and after that  if  i click/move  VERTICAL SCROLL BAR to see remaining/next 4 entries  then it does not display  12th 13th 14th &15th entry in entry screen. So the problem is i am unable to display remaining/next 4 entries  in entry screen & also to save them DB.
    2>  At the same time when i click/move  VERTICAL SCROLL BAR to see remaining/next 4 entries  then  earlier 11 entries  are disappeared/ get cleared from entry screen.
    3> The FIRST PAGE, PREVIOUS PAGE , NEXT PAGE , LAST PAGE and INSERT , DELETE push buttons are dispalyed in my entry screen . But they are not working or doing their opertions on table control though there is system generated code for them written in module pool program and  PBO & PAI OF SCREEN 100 on which table control is present.
       So eagerly waiting for POSITIVE replies  &  Correct solutions from all ABAP techies.
    THANKS & REGARDS,
      Ashish.

    Hi friend,
                         I have visited the link u have given . But it is a report program .it is available in ABAPDOCU tcode.
    ABAPDOCU----
    >ABAP User Dialogs -
    >Screens -
    >Complex Screen Elements -
    >Table Control with Scrolling .
    It is a REPORT program. and not a module pool program. plz check this in ur link also.
    REPORT demo_dynpro_tabcont_loop.    &
    *SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.* -
    > this statement is used only in report program and system does not allow us to use in module pool program.
    Second thing here data is retrived from spfli table where as my data will be whatever enduser enters it may be 15 lines , may be 50 lines or may be 200 lines and it shold be displayed on entry screen before clicking SAVE or any other user action.
    My main problem is that I am unable to enter more than 11 entries in my entry screen. I want dynaamic table. Mean whichever enteries are entered they should be displayed on entry screen as well as can be scrolled up & down before saving and get saved after clicking SAVE button. here table control design is not imp because entry data depends on table control layout rows & which has limit. It can not be extended beyond certain level. i think max will be 20 Or 25 rows in layout. How to make it dynamic so that we can get any no. of entries in entry screen hiich canbe scrolled up & down.
    Anyways thanks for ur reply And send some other soln.
    Thanks & regards,
    Ashish

Maybe you are looking for

  • Calculate depreciation start date based on user defined field in asset

    Hi, I have a specific scenario where the start of depreciation date for asset needs to be calculated on user-specific logic.There is a additional field "installation date" in asset master screens.The requirement is that for depreciation areas 10 and

  • Using iPad2 to fill PDF forms with calculating cells

    I currently have the PDF Expert app. installed.  I have created a PDF form with calculating cells and cells with multiple selections using Adobe Acrobat X Pro.  It works on my PC on 2 different PDF reader apps, however when I load it in PDF Expert on

  • Photoshop cs4 Graphic Card Requirements!!

    Hello Guyz!!  I wanted to learn Photoshop CS4 on my Dell Precision 670 Intel Xeon 2.8 Ghz × 2.8 Ghz With 2Gb of Ram and Graphic Card Radeon X300/X550/X1050 Series of 128 MB n I am using Windows 7 Ultimate!! Now, I can't "Enable OpenGL Drawing" in Pho

  • XPOS,YPOS in Sap Script

    Hi, I want to know that how to do display the columns data into rows and what is the functionality of  XPOS,YPOS in the sapscript ?

  • Oracle Automatically creates some indexes.

    Hi, In my database on several table on some non indexed columns , oracle automatically creates indexes which start with naming convention 'XIF'. what are this indexes? and what is benefit with it? is there any way to stop this? Thanks