Table control Dialog program

I am Using table control wizard.once user click on button data will be populated in Table control from datatabase table
once after getting data the lines which doesnot have data are disabled but
user should be allowed to  enter and Update and delete data once after clicking
ENTER Key  that data should be updated in the data base table.
i am sending my program.
SCREEN DESIGN .
PROCESS BEFORE OUTPUT.
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TAB1'
  MODULE TAB1_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TAB1_CHANGE_COL_ATTR.
  LOOP AT   IT_TAB3
       INTO WA_TAB3
       WITH CONTROL TAB1
       CURSOR TAB1-CURRENT_LINE.
    MODULE TAB1_GET_LINES.
*&SPWIZARD:   MODULE TAB1_CHANGE_FIELD_ATTR
  ENDLOOP.
* MODULE STATUS_1002.
PROCESS AFTER INPUT.
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TAB1'
  LOOP AT IT_TAB3.
    CHAIN.
      FIELD WA_TAB3-VBELN.
      FIELD WA_TAB3-POSNR.
      MODULE TAB1_MODIFY ON CHAIN-REQUEST.
    endchain.
    FIELD WA_TAB3-SP1
      MODULE TAB1_MARK ON REQUEST.
  ENDLOOP.
*  MODULE TAB1_BUTTON.
  MODULE TAB1_BUTTONIP.
  MODULE TAB1_USER_COMMAND.
*&SPWIZARD: MODULE TAB1_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TAB1_CHANGE_COL_ATTR.
* MODULE USER_COMMAND_1002.
PROGRAM  Z_VI_TABL2.
TYPES: BEGIN OF TY_TAB3,
       SP1(2) TYPE C,
       VBELN TYPE VBELN_VL,
       POSNR TYPE POSNR_VL,
       END OF TY_TAB3.
TYPES: BEGIN OF TY_FILL,
       OBJKY TYPE OBJKY,
       END OF TY_FILL.
DATA : IT_TAB3 TYPE STANDARD TABLE OF TY_TAB3,
       WA_TAB3 TYPE TY_TAB3,
       IT_FILL TYPE STANDARD TABLE OF TY_FILL,
       WA_FILL TYPE TY_FILL,
       G_VBELN TYPE VBELN_VL,
       G_POSNR TYPE POSNR_VL.
*&SPWIZARD: DECLARATION OF TABLECONTROL 'TAB1' ITSELF
CONTROLS: TAB1 TYPE TABLEVIEW USING SCREEN 1002.
*&SPWIZARD: LINES OF TABLECONTROL 'TAB1'
DATA:     G_TAB1_LINES  LIKE SY-LOOPC.
DATA:     OK_CODE LIKE SY-UCOMM.
*&SPWIZARD: OUTPUT MODULE FOR TC 'TAB1'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: UPDATE LINES FOR EQUIVALENT SCROLLBAR
MODULE TAB1_CHANGE_TC_ATTR OUTPUT.
  DESCRIBE TABLE IT_TAB3 LINES TAB1-lines.
ENDMODULE.                    "TAB1_CHANGE_TC_ATTR OUTPUT
*&SPWIZARD: OUTPUT MODULE FOR TC 'TAB1'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: GET LINES OF TABLECONTROL
MODULE TAB1_GET_LINES OUTPUT.
  G_TAB1_LINES = SY-LOOPC.
ENDMODULE.                    "TAB1_GET_LINES OUTPUT
*&SPWIZARD: INPUT MODULE FOR TC 'TAB1'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: MODIFY TABLE
MODULE TAB1_MODIFY INPUT.
*  MODIFY IT_TAB3
*    FROM WA_TAB3
*    INDEX TAB1-CURRENT_LINE.
  WA_TAB3-POSNR = 10.
  APPEND WA_TAB3 TO IT_TAB3.
ENDMODULE.                    "TAB1_MODIFY INPUT
*&SPWIZARD: INPUT MODUL FOR TC 'TAB1'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: MARK TABLE
MODULE TAB1_MARK INPUT.
  DATA: g_TAB1_wa2 like line of IT_TAB3.
  if TAB1-line_sel_mode = 1
  and WA_TAB3-SP1 = 'X'.
    loop at IT_TAB3 into g_TAB1_wa2
      where SP1 = 'X'.
      g_TAB1_wa2-SP1 = ''.
      modify IT_TAB3
        from g_TAB1_wa2
        transporting SP1.
    endloop.
  endif.
  MODIFY IT_TAB3
    FROM WA_TAB3
    INDEX TAB1-CURRENT_LINE.
*    TRANSPORTING SP1.
ENDMODULE.                    "TAB1_MARK INPUT
*&SPWIZARD: INPUT MODULE FOR TC 'TAB1'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: PROCESS USER COMMAND
MODULE TAB1_USER_COMMAND INPUT.
  OK_CODE = SY-UCOMM.
  PERFORM USER_OK_TC USING    'TAB1'
                              'IT_TAB3'
                              'SP1'
                     CHANGING OK_CODE.
  SY-UCOMM = OK_CODE.
ENDMODULE.                    "TAB1_USER_COMMAND INPUT
*   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
*&      Module  TAB1_BUTTON  INPUT
*       text
MODULE TAB1_BUTTONIP.
  CASE SY-UCOMM.
    WHEN 'DELI'.
      REFRESH IT_TAB3.
      SELECT OBJKY
             INTO TABLE IT_FILL
             FROM DRAD
             WHERE DOKNR = 'T-F122' AND
                   DOKOB = 'LIPS'.
      IF SY-SUBRC = 0.
        LOOP AT IT_FILL INTO WA_FILL.
          wa_tab3-vbeln = WA_FILL-OBJKY+0(10).
          wa_tab3-posnr = WA_FILL-OBJKY+10(4).
          APPEND wa_tab3 TO IT_TAB3.
        ENDLOOP.
        DELETE ADJACENT DUPLICATES FROM IT_TAB3.
     ENDIF.
  ENDCASE.

hi Sonarali,
this FM is of no use to you.
in your PAI you have to loop at the table control table and put a method here you read the lines and save it.
if you use wizard to create a table control it will automatically give the code to you...

Similar Messages

  • Dynamic header text in table control - Dialog programming

    Hi All,
    I have a table control on one of my dialog screens.  I need to dynamically change the column header texts on this control in my PBO.  Does anyone know how to do this?  I have found all kinds of ways to modify the other characteristics of the fields at run time in the PBO (active, input/output, invisible, etc.) - but not to change the header text!  Any help is appreciated.
    thanks,
    Matt

    Hi Hymavathi,
    I appreciate your help!  This didn't solve the issue, however,...I have used the method you'd mentioned before (many times) for setting it inside the loop at screen:
    %_<screenname>_%_APP_%-TEXT = <text something>.
    - but only in ABAP reports.  It doesn't seem to recogize it (the table control column header text) within a dialog program.  I keep getting a compile error. (saying that the %_<screenname>_%_APP_%-TEXT doesn't exist.
    I tried the suggestion that you stated below (from lateesh) - yet it only let me place i/o field in title text area (not the column header text).  Am still searching...

  • Regarding Table controls dialog programming

    Hello Experts-
    I have a requirement in which I need to identity the record selected on the table control.This is similar to At line slection.Can anyone help me out.Thanks in advance.
    With regards,
    Swarna..

    Hi Swarna,
    Make   use of  CRIT_TABCNTRL-current_line to get the current line of the table control where  CRIT_TABCNTRL is table control name.
    Have A Good Day
    Chaitanya.

  • Hide The Table in Table-Control Dialogue Programming

    Hi all,
    How to hide the TABLE itself (not the columns only but the whole table completely) in table-control in dialog-programming.can any one please help me.....
    Regards,
    Biswajit

    Hi,
    use the screen table.
    delclare as a "table" for the  group properties of that table element.
      LOOP AT SCREEN.
    if screen-goupt1 = "table"
       if the pushbutton = 'HIDE'  
            screen-required = 0.                            
            screen-invsible   = 0.                         
            screen-input    = 0.                          
            MODIFY SCREEN.
       ELSEIF  the pushbutton = 'SHOW'
            screen-required = 0.                           
            screen-invsible  = 1.                            
            screen-input    = 0.                           
            MODIFY SCREEN.
         ENDIF.
    endif.
        ENDLOOP.
    it solves your problme.
    Thanks

  • Sale Order Item : Custom Field : Table Control

    I have added two fields to sale order item table control in program SAPMV45A screen no . 4900. Now the field which i have added are working fine while creating sale order but while changing those fields are not changing.
    condition is like this: the custom field are automatically filled by some logic and if the user want to change those field he will able to do. Now 1st condition is fine and when i change those field they will show the previous saved value inspite of changed value. 
    I have also added those field in additional data b tab in screen 8459 , there they are working fine but here the problem remains the same.

    Hi,
    u can use BAPI_SALESORDER_CHANGE to update the values of those fields. for that u need to extend few tables and coding that u can get from the BAPI documentation. If not getting reply back. i can help u..
    regards,
    pavan.

  • Change The title of table control

    I have Table Control on Screen 102 called TABCTRL_102.
    General attributes of TABCTRL_102 has
    <b>With title</b> checked and
    <b>Title element name</b>  TXT003
    Now I want to Change The title of my table control through program. Is there a way out.

    Hi Flora,
    Declare a global variable in your TOP Include like,
    DATA: gv_text_tc_102(30).
    Then replace TXT003 in screen painter with GV_TEXT_TC_102
    and mark it as 'Output Only'.
    Then you can fill this variable in one of the PBO Modules of the screen 102 like,
    MODULE <your PBO Module Name>.
    ***Other Code
    gv_text_tc_102 = 'My Text'. "Better use a text symbol
    ENDMODULE.
    Hope this helps..
    Sri
    Message was edited by: Srikanth Pinnamaneni

  • Dynamic Hide column in table control

    I want to hide colum of table control in program, and then it can invisible,but others is visible.
    how should i do?

    Hello All,
    I am trying to implement the above solution. I am facing some issues.
    I have used a table maintenance generator. So Depending on the Fields I have choosed, screen is automatically generated with table control : TCTRL_FSH_SOFN_V.
    Now, I have to declare a work area to store the values of the above type.
    How do i do it??
    The highlighted portion gives an syntax error as the table control is not defined.
    data: wa_FSH_SOFN_V_cols type LINE OF TCTRL_FSH_SOFN_V-COLS.
    loop at TCTRL_FSH_SOFN_V-COLS to wa_FSH_SOFN_V_cols."into .
       if sytabix = 4.
         wa_FSH_SOFN_V_cols-INVISIBLE = 1.
         MODify TCTRL_FSH_SOFN_V-COLS from wa_FSH_SOFN_V_cols.
        endif.
        endloop.

  • Reg: Dialog Programming

    Dear All,
    I'm new to this group.
    Now i'm learning ABAp.
    I need a small Help.
    I want to insert/Update the data into master tables using Dialog Programming.
    How can i do that.
    I'm using RF(Radio frequency)devices,which can access the SAP Screens in Character Based Format and from those devices i want to update/recieve the Data in the database.
    Please send me the procedure/Code.
    Thanks  & Regards,
    Adi.

    Hai Sateesh,
    Thanks for your reply.
    I'm using RF Hand Held Devices & Barcode Technology for stores Automation.
    I want the dialog programming as when ever the user scan the barcode of the particular material,the system will automatically check the Databse and need to show the details of that Particular Material.
    For issuing & reciveing & for stock verification i want the dialog programming.
    In this How to use BDC's /BAPI's. what isa the advantage of using BDC's/BAPI's?
    i don't know much about BAPI Programming.
    I devloped one small Dialog Program...
    The code look like this.
      Delaration of Tables.
      Internal table Declaration.
      In the PAI Event.
      Case sy-ucomm.
      when 'save'.
      insert mara.
      when 'disp'.
      select * from mara where matnr = itab-matnr.
      endselect.
      when 'exit'.
       leave program.
      endcase.
      in the PBI Event
      Move-correspondin itab to mara.
      with this code i'm able to get the values what ever i entered,and i'm able to save.
    What is use of BAPI's & what is the Advantage?
    Please Reply me.
    Regards,
    Adinarayana.B

  • Developing table control...

    hi,
    i have read posts on creating the table control by program rather than using the wizard. i want to try that.. can anyone point me to some good material or let me know the steps or sampl code ??
    all i need is
    1. a table control to display data from my internal table.
    2. user must be able to select/deselect multiple rows
    3. there can be a button to sort in ascending and descending order, but then which column ?? can he choose the column ?
    4. i need scrollbars in that table control.
    5. provision to validate those selected lines. if they dont match the criteria then they must be allowed to select to deselect the rows again !!
    pretty much a simple expectation...any help ? thks

    hey,
    one question..how are the table control's columns built ??
    i have dragged a table control on my screen. how do i speciy the columns it has to display ??
    i am not able to follow the logic to populate the table. any help ?
    in table control wizard we will have a link between the ITAB and the table control automatically. here how do i do that manually ?
    thks

  • Write the syntax for declaring table control in dialog programming?

    1) Write the syntax for declaring table control in dialog programming?
    2) Write the syntax to call a selection screen in a modal dialog box?

    hi,
    check this code for table control.
    DIALOG PROGRAMMING
    TABLE CONTROL
    IN SE51
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    LOOP AT ITVBAK WITH CONTROL TABCTRL. ##  TABLE CONTROL NAME
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.
    LOOP AT ITVBAK.
    ENDLOOP.
    IN PAI FLOW LOGIC
    PROGRAM YMODULE_PR4 .
    TABLES : KNA1, VBAK.
    DATA : BEGIN OF ITVBAK OCCURS 0,
           VBELN LIKE VBAK-VBELN,
           ERDAT LIKE VBAK-ERDAT,
           ERNAM LIKE VBAK-ERNAM,
           NETWR LIKE VBAK-NETWR,
           END OF ITVBAK.
    CONTROLS : TABCTRL TYPE TABLEVIEW USING SCREEN '0100'.
    TO ACTIVATE SCROLL BAR
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN SPACE.
          SELECT VBELN ERDAT ERNAM NETWR
            FROM VBAK
            INTO TABLE ITVBAK
           WHERE KUNNR = KNA1-KUNNR.
          TABCTRL-LINES = SY-DBCNT.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT

  • How to move the selected rows from a  table control in dialog programming

    hiiiiiiii Every1
    I have to update some fields for a slected row in table control on click of a button and save it in database.
    Regards
    Sachin Dhingra

    see below example, I have added INSERT option after DELETE option, you can use same table or you can use differnt table by populating into that table and insert into the db table. If you want to use same internal table then use below code
    LOOP AT itab INTO demo_conn WHERE mark = 'X'.
    insert into table from itab.
    ENDLOOP.
    REPORT demo_dynpro_tabcont_loop_at.
    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
    DATA cols LIKE LINE OF flights-cols.
    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 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'.
    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.
    WHEN 'INSERT'.
    READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
    IF sy-subrc = 0.
    LOOP AT itab INTO demo_conn WHERE mark = 'X'.
    itab1 = itab.
    modify itab1.
    ENDLOOP.
    ENDIF.
    if not itab1 is initial.
    INSERT dbtab FROM TABLE itab1.
    endif.
    ENDCASE.
    ENDMODULE.

  • Table control in dialog programming

    why we are using loops in pbo and pai events?

    Hi
    First have to know the concept of Table control
    The main purpose of table control is to display multiple records in a table like format.
    so when to wants to display the multiple records, the internal table from which the table control has to be populated has to be kept in loop both in PAI and PBO.
    see the doc
    Check the below link:
    http://wiki.ittoolbox.com/index.php/FAQ:What_is_module_pool_program_in_abap%3F
    http://help.sap.com/saphelp_46c/helpdata/en/35/26b1aaafab52b9e10000009b38f974/content.htm
    http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm
    http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
    You can also check the transaction ABAPDOCU which gives you lot of sample programs.
    Also you can see the below examples...
    Go to se38 and give demodynpro and press F4.
    YOu will get a list of demo module pool programs.
    One more T-Code is ABAPDOCU.
    YOu can find more examples there.
    See the prgrams:
    DEMO_DYNPRO_TABLE_CONTROL_1 Table Control with LOOP Statement
    DEMO_DYNPRO_TABLE_CONTROL_2 Table Control with LOOP AT ITAB
    http://www.geocities.com/ZSAPcHAT
    http://www.allsaplinks.com/files/using_table_in_screen.pdf
    reward points if useful
    regards
    Anji

  • How to save the selected records from Table control in dialog programming

    Hiiiiiiii Every1
    Actually the problem is like this:-
    I have to select some records from table control and then want to save the selected records in DB table.
    Example
    I have some rows having inforamtion bout employees...
    Now what i want is that when i click on 'SAVE' button then these selected rows should be moved into DB table.
    Sachin Dhingra

    see below example, I have added INSERT option after DELETE option.
    REPORT demo_dynpro_tabcont_loop_at.
    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
    DATA cols LIKE LINE OF flights-cols.
    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 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'.
    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.
        WHEN 'INSERT'.
          READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              itab1 = itab.
              modify itab1.
            ENDLOOP.
          ENDIF.
          if not itab1 is initial.
            INSERT dbtab FROM TABLE itab1.
          endif.
      ENDCASE.
    ENDMODULE.

  • Strange issue with table control in dialog programming! Please help!

    Hello everyone:
                I have a table control on screen painter and I have atleast 10 rows on display when user calls the screen. If I have 15 columns then ofcourse user has to scroll down to see extra rows. I have line selection set to "single" for table control so that user can select only one row at a time. This works fine when user does not have to scroll to see extra rows. It is tough for me to explain i.e., if the table control displays 10 rows when the screen opens up then they can only select single row at a time (rows 1 -10). For example user selected row 7 and now they scroll down to see extra rows (for example 13) then it lets them select row 13 also even though I set line selection to "single" in the properties for table control! They should be able to select only one row at a time. Is this some limitation with table control in SAP? Please give me any information you have.
    Thanks.
    Mithun

    Hi,
    As you suspected, this is a limitation in the table control.  You need to take care of the single-selection functionality yourself except for the rows that are actually being displayed.  See [Note 588284|https://service.sap.com/sap/support/notes/588284] for the official SAP explanation.
    Regards,
    Jamie

  • Question on line selection in table control in dialog programming....

    Hello,
    I have a internal table displayed on a screen using Table control wizard. Now, when user selects a particular line and double clicks it, I want to write a query based on the line user selected. How can this be achieved ?
    Regards,
    Rajesh.

    Assign a function code to F2 in your status and do the coding:
    PROCESS PAI.
    LOOP AT ITAB.
    MODULE GET_CURSOR.
    ENDLOOP.
    MODULE USER_COMMAND.
    MODULE GET_CURSOR.
    GET CURSOR FIELD ws_field LINE ws_line.
    ENDMODULE.
    MODULE USER_COMMAND.
    CASE OK_CODE.
    WHEN 'PICK'.
    WS_LINE = <TABLE CONTROL>-TOP_LINE + WS_LINE - 1.
    READ TABLE ITAB INDEX WS_LINE.
    ---> Show details
    ENDMODULE.

Maybe you are looking for

  • Crystal Report in an iFrame redirect problem

    Hi! I have built a page with a only Crystal Report on it, which I display in an iFrame on another page. I have a hyperlink on the page that is used to redirect the iFrame by assigning the iFrame a name and setting the target of the hyperlink to the i

  • Workflow Notification Issue r12

    Hi I have two issues with Workflow notification in r12. 1. Users get notification with a file attached called notification.html. This is not required. How can I stop workflow attaching this file when sending emails. 2. How can I unanimously change no

  • JDBC Sender Adapter - SQL-Statement

    Hi, I'm using the JDBC-Sender-Adapter and need to use a SQL-Statement like this: SELECT * FROM myTable WHERE myDate = <current_date> Is such a dynamic-sql possible, or can I only use static sql-statements. And if yes how can I solve this problem. man

  • Screen is black, fan is blowing, can't restart!

    I was doing some work on my iMac, walked away for 5 minutes and when I came back the screen was black and the fan is going full speed. If I hold down he power button it will turn off, but every time I try to start it up it stays black and only the fa

  • Data from Two database

    Is it possible to get data in one report from two different database(Oracle,Sybase) Thank You