Table control problem

Dear Friends!
   How are you,
          I am having one doubt to ask. I have developed one table control application, With the help of table control I am changing the record of table, and saves it to the internal table this what i am supposed to do.
what  I am doing is:
I have fiil the table control from the internal table like this way:
name  -
number
abc           23423
efg            56456
jgf             64564
now i want to change the number column and save it again to internal table this way:
name -
number <- on save event or ok_code = save.
abc           22222
efg            55555
jgf             66666
i have dont this flow logic programing.
process before output.
*&spwizard: pbo flow logic for tablecontrol 'MY_TAB'
  module my_tab_change_tc_attr.
*&spwizard: module MY_TAB_change_col_attr.
  loop at   it_item
       into wa_item
       with control my_tab
       cursor my_tab-current_line.
    module my_tab_get_lines.
*&spwizard:   module MY_TAB_change_field_attr
  endloop.
  module status_0100.
  module set_curson.
  module get_date.
  module ok_code.
process after input.
*&spwizard: pai flow logic for tablecontrol 'MY_TAB'
  loop at it_item.
    chain.
      field wa_item-item_no.
      field wa_item-material_code.
      field wa_item-description.
      field wa_item-unit_of_measure.
      field wa_item-quantity.
      field wa_item-rflag.
      module my_tab_modify on chain-request.
    endchain.
    endloop.
  module my_tab_user_command.
*&spwizard: module MY_TAB_change_tc_attr.
*&spwizard: module MY_TAB_change_col_attr.
  module user_command_0100.
  module get_vendor_name.
  module move_data_from_table.  <----- here i m copying the data from table control to internal table.
process on value-request.
field mseg-mblnr module get_mat_doc.
module move_data_from_table input. <---PAI code.
to move the data from the table control to internal table.
it_item-name = my_tab-name.
it_item-number = my_tab-number.
append it_name.
clear it_name.
endmodule.                 " move_data_from_table  INPUT
now i m receiving the error.. data object my_tab doesnot have the componet called it_item.
here my_tab is table control name.
apparently my code is not perfect as i dont know how to do processes over Table control please help me to develop such application
Any help would be appreciated.
Regards
Naeem

Hi,
Your code should be in loop endloop of PAI
MODIFY <internal table> INDEX <table control>-CURRENT_LINE.

Similar Messages

  • Screen painter or table control problem

    Hi All,
    I have created two maintenance views for two custom tables , and two views has been created .
    in one view when i excuting sm54 and display i could able to see all the fields in the table control ,
    but in the other view i could see only one field very in the table control.
    Is this the problem of screen painter with table control , shall i need to intall screen painter again
    i am using  4,7 version  os sap ,
    Regards
    subba

    Hi  Chandra,
    Thanks for yorr prompt reply  and i tried so many times , can i go that particular screen and change
    the screen and include all the fields , actually the system proposes the screen when we are creating
    the table maintenance generator.
    i selected one step and screen proposed by sap in the overview screen as  1 and i have created table maintenance.
    Regards
    subba

  • Multiple selection column in table control problem

    Hi, all.
    My issue now is I have a table control on a screen that can let user select multiple records, and then click a button to process those selected record just now. But after I select some records and scroll down the screen, i found out that those record which are selected just now is disappear, and i have to select again.
    So, may i know how to fix those records in a table control which i selected earlier during i scroll up and down the table control on the screen?
    Thanks in advance.

    Hi,
    Once you scroll down the item selected above gets deselected this is natural thing in SAP Module Pool.
    You can do one thing to avoid such thing is by increasing your screen size where you are displaying the contents.
    hope this will solve your problem.
    Regards,
    Suvendu.

  • Lines of a table control are more than one table control problem.

    Hi All,
       I'm writing a screen which includes a table control and below is my code:
    PROCESS AFTER INPUT.
      LOOP AT gt_blds.
        CHAIN.
          FIELD gw_bld-ebeln.
          FIELD gw_bld-ebelp.
          FIELD gw_bld-quanty.
          MODULE get_item ON CHAIN-INPUT.
        ENDCHAIN.
    endloop.
    The get_item was used to summary the total quanty of each PO item.
    The problem is that once the lines of gt_blds is 16 and my table control lines is 14, the  get_item module will only calculate from line 1 to line14, the last 2 lines was lost...
    Can anyone help me?

    Hi,
    PROCESS AFTER INPUT.
      LOOP AT gt_blds.
        CHAIN.
          FIELD gw_bld-ebeln.
          FIELD gw_bld-ebelp.
          FIELD gw_bld-quanty.
          MODULE get_item ON CHAIN-INPUT.
        ENDCHAIN.
    **add one more module.
    module modify_tabcontrol
    endloop.
    in program.
    module modify_tabcontrol.
    describe table itab lines tc-lines.
    if tc-current_line > tc-lines.
    append itab.
    else.
    modify itab index tc-current_line.
    endmodule.
    even you cannot acheive this.
    add one more module after the loop statement
    module count_qty.
    in program
    module count_qty.
    *here you sum up or whatever you want
    endmodule.
    Regards
    Ramchander Rao.K

  • 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

  • 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

  • Problem with table control

    Hi all,
    I am able to loop two items for the sales order using table control.But I am not able to populate more than 2 items. Can anybody explain what exactly is the problem.
    I am including my code below.
    DATA: BEGIN OF ITAB OCCURS 0,
          KUNNR(255) TYPE C,
       END OF ITAB.
    DATA :BEGIN OF ITAB1 OCCURS 0,
          KUNNR1(10) TYPE C,
          KUNNR2(10) TYPE C,
          KETDAT(8) TYPE C,
          DWERK(4) TYPE C,
          ZTERM(4) TYPE C,
          INCO1(3) TYPE C,
          INCO2(16) TYPE C,
          AUDAT(8) TYPE C,
          VKBUR(4) TYPE C,
          BZIRK(3) TYPE C,
          END OF ITAB1.
    DATA : BEGIN OF ITAB2 OCCURS 0,
           KUNNR1(10) TYPE C,
           MABNR(8) TYPE C,
           KWMENG(1) TYPE C,
          END OF ITAB2.
    include bdcrecx1.
    PARAMETERS PATH(128) DEFAULT 'C:\SALES1.TXT'.
    DATA : FNAM(20) TYPE C,
           IDX      TYPE C.
    start-of-selection.
      CALL FUNCTION 'WS_UPLOAD'
       EXPORTING
         FILENAME                      = PATH
         FILETYPE                      = 'ASC'
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      LOOP AT ITAB.
       itab1-kunnr1 = itab2-kunnr1.
        ITAB1-KUNNR1 = ITAB-KUNNR+0(10).
        ITAB1-KUNNR2 = ITAB-KUNNR+10(10).
        ITAB1-KETDAT = ITAB-KUNNR+20(8).
        ITAB1-DWERK = ITAB-KUNNR+28(4).
        ITAB1-ZTERM = ITAB-KUNNR+32(4).
        ITAB1-INCO1 = ITAB-KUNNR+36(3).
        ITAB1-INCO2 = ITAB-KUNNR+39(16).
        ITAB1-AUDAT = ITAB-KUNNR+55(8).
        ITAB1-VKBUR = ITAB-KUNNR+63(4).
        ITAB1-BZIRK = ITAB-KUNNR+67(3).
       ITAB2-KUNNR1 = ITAB-KUNNR+0(10).
        ITAB2-MABNR = ITAB-KUNNR+70(8).
        ITAB2-KWMENG = ITAB-KUNNR+78(1).
        APPEND ITAB1.
        CLEAR ITAB1.
        APPEND ITAB2.
        CLEAR ITAB2.
      ENDLOOP.
      perform open_group.
      loop at itab1.
        perform bdc_dynpro      using 'SAPMV45A' '0101'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'VBAK-AUART'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
        perform bdc_field       using 'VBAK-AUART'
                                      'ZOR'.
        perform bdc_field       using 'VBAK-VKORG'
                                      '1000'.
        perform bdc_field       using 'VBAK-VTWEG'
                                      '10'.
        perform bdc_field       using 'VBAK-SPART'
                                      '10'.
        perform bdc_dynpro      using 'SAPMV45A' '4001'.
        perform bdc_field       using 'BDC_OKCODE'
                                      'KKAU'.
        perform bdc_field       using 'KUAGV-KUNNR'
                                       itab1-kunnr1.
        perform bdc_field       using 'KUWEV-KUNNR'
                                      itab1-kunnr2.
        perform bdc_field       using 'RV45A-KETDAT'
                                      itab1-ketdat.
        perform bdc_field       using 'RV45A-KPRGBZ'
                                      'D'.
        perform bdc_field       using 'VBKD-PRSDT'
                                      '11/21/2005'.
        perform bdc_field       using 'VBKD-ZTERM'
                                      itab1-zterm.
        perform bdc_field       using 'VBKD-INCO1'
                                      ITAB1-INCO1.
        perform bdc_field       using 'VBKD-INCO2'
                                      ITAB1-INCO2.
        perform bdc_dynpro      using 'SAPMV45A' '4002'.
        perform bdc_field       using 'BDC_OKCODE'
                                         '=T\05'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'VBKD-BZIRK'.
        perform bdc_field       using 'VBAK-AUDAT'
                                      ITAB1-AUDAT.
        perform bdc_field       using 'VBAK-VKBUR'
                                      ITAB1-VKBUR.
        perform bdc_field       using 'VBAK-WAERK'
                                      'USD'.
        perform bdc_field       using 'VBKD-PRSDT'
                                      '11/21/2005'.
        perform bdc_field       using 'VBKD-BZIRK'
                                      ITAB1-BZIRK.
        perform bdc_dynpro     using 'SAPLV60F' '4001'.
        perform bdc_field       using 'BDC_OKCODE'
                                     '=T\06'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'FPLT-AFDAT(05)'.
        perform bdc_field       using 'FPLA-BEDAT'
                                      '11/21/2005'.
        perform bdc_field       using 'FPLA-BEDAR'
                                      '01'.
        perform bdc_field       using 'FPLA-RFPLN'
                                      '0000000042'.
        perform bdc_field       using 'FPLT-AFDAT(01)'
                                      '11/21/2005'.
        perform bdc_field       using 'FPLT-AFDAT(02)'
                                      '11/21/2005'.
        perform bdc_field       using 'FPLT-AFDAT(03)'
                                      '11/21/2005'.
        perform bdc_field       using 'FPLT-AFDAT(04)'
                                      '11/21/2005'.
        perform bdc_field       using 'FPLT-AFDAT(05)'
                                      '11/21/2005'.
        perform bdc_dynpro      using 'SAPMV45A' '4002'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=T\09'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'VBKD-ZLSCH'.
        perform bdc_field       using 'VBKD-KTGRD'
                                      '01'.
        perform bdc_field       using 'VBKD-ZLSCH'
                                      'C'.
        perform bdc_field       using 'VBAK-ZUONR'
                                     'Open Sales order'.
        perform bdc_dynpro      using 'SAPMV45A' '4002'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=T\11'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'GVS_TC_DATA-REC-PARTNER(05)'.
        perform bdc_field       using 'GV_FILTER'
                                      'PARALL'.
        perform bdc_field       using 'GVS_TC_DATA-REC-PARTNER(05)'
                                      '3838'.
        perform bdc_dynpro      using 'SAPMV45A' '4002'.
        perform bdc_field       using 'BDC_OKCODE'
                                       '=T\14'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'VBKD-BSARK'.
        perform bdc_field       using 'VBKD-BSARK'
                                      'CU01'.
        perform bdc_field       using 'VBKD-IHREZ'
                                       '12134'.
        perform bdc_dynpro      using 'SAPMV45A' '4002'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/EBACK'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'VBAK-ZZLEAT'.
        perform bdc_field       using 'VBAK-ZZWARR'
                                      '12346C'.
        perform bdc_field       using 'VBAK-ZZFABW'
                                      'F14689'.
        perform bdc_field       using 'VBAK-ZZWARX'
                                      '12012005'.
        perform bdc_field       using 'VBAK-ZZLEAT'
                                      'CGUYFIU'.
        perform bdc_dynpro      using 'SAPMV45A' '4001'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=PKO1'.
        perform bdc_field       using 'KUAGV-KUNNR'
                                      itab1-kunnr1.
        perform bdc_field       using 'KUWEV-KUNNR'
                                      itab1-kunnr2.
        perform bdc_field       using 'RV45A-KETDAT'
                                      itab1-ketdat.
        perform bdc_field       using 'RV45A-KPRGBZ'
                                      'D'.
        perform bdc_field       using 'VBKD-PRSDT'
                                      '11/21/2005'.
        perform bdc_field       using 'VBKD-ZTERM'
                                      itab1-zterm.
        perform bdc_field       using 'VBKD-INCO1'
                                      ITAB1-INCO1.
        perform bdc_field       using 'VBKD-INCO2'
                                      ITAB1-INCO2.
    perform bdc_field       using 'BDC_CURSOR'
                                      'RV45A-ccode(idx)'.
      MOVE 1 TO IDX.
        LOOP AT ITAB2 WHERE KUNNR1 = ITAB2-KUNNR1.
          CONCATENATE 'RV45A-MABNR(' IDX ')' INTO FNAM.
          perform bdc_field       using FNAM
                                  ITAB2-MABNR.
          CONCATENATE 'RV45A-KWMENG(' IDX ')' INTO FNAM.
          perform bdc_field       using FNAM
                                  ITAB2-KWMENG.
          IDX = IDX + 1.
    ENDLOOP.
        perform bdc_dynpro      using 'SAPMV45A' '4001'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=PKO1'.
        perform bdc_field       using 'KUAGV-KUNNR'
                                      itab1-kunnr1.
        perform bdc_field       using 'KUWEV-KUNNR'
                                      itab1-kunnr2.
        perform bdc_field       using 'RV45A-KETDAT'
                                      itab1-ketdat.
        perform bdc_field       using 'RV45A-KPRGBZ'
                                      'D'.
        perform bdc_field       using 'VBKD-PRSDT'
                                      '11/21/2005'.
        perform bdc_field       using 'VBKD-ZTERM'
                                      itab1-zterm.
        perform bdc_field       using 'VBKD-INCO1'
                                      ITAB1-INCO1.
        perform bdc_field       using 'VBKD-INCO2'
                                      ITAB1-INCO2.
        perform bdc_field       using 'RV45A-VBAP_SELKZ(01)'
                                      'X'.
        perform bdc_dynpro      using 'SAPMV45A' '5003'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/EBACK'.
        perform bdc_dynpro      using 'SAPMV45A' '4001'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=SICH'.
        perform bdc_field       using 'KUAGV-KUNNR'
                                      itab1-kunnr1.
        perform bdc_field       using 'KUWEV-KUNNR'
                                      itab1-kunnr2.
        perform bdc_field       using 'RV45A-KETDAT'
                                      ITAB1-KETDAT.
        perform bdc_field       using 'RV45A-KPRGBZ'
                                      'D'.
        perform bdc_field       using 'VBKD-PRSDT'
                                      '11/21/2005'.
        perform bdc_field       using 'VBKD-ZTERM'
                                      ITAB1-ZTERM.
        perform bdc_field       using 'VBKD-INCO1'
                                       ITAB1-INCO1.
        perform bdc_field       using 'VBKD-INCO2'
                                      ITAB1-INCO2.
        perform bdc_field       using 'BDC_CURSOR'
                                        'RV45A-MABNR(idx)'.
        perform bdc_transaction using 'VA01'.
      endloop.
      Perform close_group.

    Answered the other post. 
    <i>
    I think i see the problem,
    LOOP AT ITAB2 WHERE KUNNR1 = <b>ITAB2</b>-KUNNR1.
    CONCATENATE 'RV45A-MABNR(' IDX ')' INTO FNAM.
    perform bdc_field using FNAM
    ITAB2-MABNR.
    CONCATENATE 'RV45A-KWMENG(' IDX ')' INTO FNAM.
    perform bdc_field using FNAM
    ITAB2-KWMENG.
    IDX = IDX + 1.
    ENDLOOP.
    I think that it should be .....
    LOOP AT ITAB2 WHERE KUNNR1 = <b>ITAB1</b>-KUNNR1.
    </i>
    Regards,
    Rich Heilman

  • Problem with a Table Control Scroll Down.

    Hi,
    I´m working with a table control in which I select one of the many lines the table contains and I move it into a structure, I delete the data of the table control internal table and I move the selected line back into the internal table to show only that record. My problem is the following:
    Whenever I have to scroll down to select a line, the selected line doesn´t appear afterwards. I believe that it´s because the scroll bar disappears and keeps on showing the line where the record I selected used to be and because the selected record is added in the fist line of the TC.
    Is there any way of avoiding the disappearrance of the vertical scroll bar? Or how can I show the record added in the first line if the TC only displays the position where the selected record used to be?
    This is the logic I use to show the single record.
      READ TABLE TI_ASIGLOT WITH KEY PUSH = 'X'.
      IF SY-SUBRC = 0.
        MOVE-CORRESPONDING TI_ASIGLOT TO ST_ASIG.
        CLEAR TI_ASIGLOT.
        REFRESH TI_ASIGLOT.
        MOVE-CORRESPONDING ST_ASIG TO TI_ASIGLOT.
        ST_ASIG-CPEND = ST_ASIG-GAMNG.
        MOVE ST_ASIG-CPEND TO TI_ASIGLOT-CPEND.
        APPEND TI_ASIGLOT.
    Thank´s and regards.
    Lucila

    Well, I´m going to anwser my own question. The problem was that in my TC the top field value was the line number of the record I've selected. So the only thing I had to do to fix it was to asign 1 to the field TC-top_line inside the form where I select the record.
      READ TABLE TI_ASIGLOT WITH KEY PUSH = 'X'.
      IF SY-SUBRC = 0.
        MOVE-CORRESPONDING TI_ASIGLOT TO ST_ASIG.
        CLEAR TI_ASIGLOT.
        REFRESH TI_ASIGLOT.
        MOVE-CORRESPONDING ST_ASIG TO TI_ASIGLOT.
        ST_ASIG-CPEND = ST_ASIG-GAMNG.
        MOVE ST_ASIG-CPEND TO TI_ASIGLOT-CPEND.
        APPEND TI_ASIGLOT.
        W_INI = 1.
      ELSE.
        MESSAGE I889(100) WITH TEXT-T07.
        EXIT.
      ENDIF.
    z_result-top_line = 1.
    (z_result is my TC )
    Best regards,
    Lucila

  • Problem with a table control

    Hi gurus,
    I´ve a problem with a table control. It has 3 columns which one is a checkbox.
    I can fill all fields but in the moment I mark the checkbox this line must be unwritable. How can I do it?
    Thanks for all
    Dani

    Assign a function code to the checkbox column....
    so when u check / uncheck any entry, PAI + PBO will be triggered....
    In the PBO during the loop of table control, check the checkbox field value. if it is 'X', make the row readonly
    by looping at screen and setting screen-input = 0 for rest of the columns.
    like ...
    LOOP AT tc_itab
           WITH CONTROL tc_test
           CURSOR tc_test-current_line.
       module set_row_readonly. " loop at screen and set input = '0' if checkbox is checked...
    ENDLOOP.

  • Screen resolution problem in table control

    when i was transfering data in BDC using table control,i got screen resolution problem.
    how to rectify the problem?

    Hi,
    Check this coding.
    WA_CTU_PARAMS type ctu_params.
    WA_CTU_PARAMS-DISMODE = 'N'. "no screen mode
    WA_CTU_PARAMS-UPDMODE = 'S'. "synchronous update
    WA_CTU_PARAMS-NOBINPT = 'X'.
    WA_CTU_PARAMS-NOBIEND = 'X'.
    WA_CTU_PARAMS-DEFSIZE = 'X'. "Default size
    CALL TRANSACTION 'VA01' USING it_bdcdata
    OPTIONS FROM WA_CTU_PARAMS
    MESSAGES INTO it_mesg.
    Default size will play good role in terms of resolution. in one system in table control you can see 10rows, but in others system it will show 20 records. it depends on resolution. but when you set the default size then it will take same (default screen size) in all the systems when you run BDC.
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

Maybe you are looking for

  • HOW TO GET ALL PURCHASES FROM ACCOUNT?

    I have been a customer for five years, and I have three computers, and 3(+) devices that I've used the purchased material on. How can I get everything that I've bought on one computer, once and for all? I've had Home Sharing enabled for everything fo

  • How to create an MenuBar that stays at the top of the browser windows?

    We are trying to develop a screen in WDA. It has a menu (UI element MenuBar) at the top. Based on the menu selection it calls a WDA to display below the menu. The requirement is to have the menu bar be stationary. The bottom container (TransparentCon

  • Pfirewall.log file not updating

    Hi, I configured Windows Firewall to allow logging in my DC Firewall GPO.  settings are Log dropped Packets -enabled Log successfull connections -enabled Log file path and Name: %systemroot%\system32\logfiles\firewall\pfirewall.log size limit  32767

  • Audigy SE Drivers for Vista 32 bit PLE

    GAH! I NEED SOUND! Please creative, I am begging you. Do you have any plans on releasing it's As in ever? even when the full version is out will you not have drivers?

  • Detecting if native iPhone application is installed on phone from a web app

    Hi... How can I detect if one particular iPhone native application is installed or not on th device from my web application... So if installed then user can launch it or the link will take him to th store to download it...