How to freeze the selection column in the table control of the module pool.

hi ,
in my module pool there is a row selection field  <b>w/selcolumn</b> of the table control called as mark.
how to freeze the selection column where there is no record in the table control row.
or in other words where wa is initial.
thanks
ekta

Hi all,
in the PBO of the screen the following code is written.
say the selection column is MARK and is declared in the data as well.
thanks
ekta
*************************C O D E **************************************************
MODULE disp_tabctrl1 OUTPUT.
  IF flag_c = 1.
    READ TABLE it_create_data INTO wa_material_data
         INDEX tab_ctrl1-current_line.
  ELSE.
    READ TABLE it_material_data INTO wa_material_data
         INDEX tab_ctrl1-current_line.
    IF sy-subrc = 0.
      IF ok_code_0101 = '&SEL1'.
        mark = 'X'.
      ELSEIF ok_code_0101 = '&DSEL'.
        mark = ' '.
      ENDIF.
    ELSE.
      LOOP AT SCREEN.
        IF screen-name = 'MARK'.
          screen-input = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDIF.
  index_t = tab_ctrl1-top_line.
  index_d = tab_ctrl1-top_line + n.
ENDMODULE.                 " DISP_TABCTRL1  OUTPUT

Similar Messages

  • How to use selection column in a table control

    I have given the name of the selection column to be 'DEF_SEL',now i want to select rows in the table control using the 'selection column attribute' and maniupulate it programmatically so that i would transport the rows selected using selection coulmn to a different table control.How would i do this?

    Hi raja,
      Once you have the table cobtrol built using the extra field in the internal table, all the selected rows will have DEF_SEL = 'X'.
    Now you can loop your internal table and filter the records which were selected.
    in pai modules:
    loop at itab where DEF_SEL = 'X'.
    Move itab information inrto another internal table.
    append itab_new.
    endloop.
    have another table control which shows the data in the itab_new.
    regards,
    Ravi

  • How to Hide a entire column in a Table Control?

    Can we hide an entire column in a Table control? Plz give some hints in doing the same...

    Here is a sample, if you wish to do it programattically.   If you used the table control wizard, then you should have a module which is listed in the flow logic PBO of the screen.  Its probably commented out.
    itabcon_change_col_attr
    Uncomment it and create the module.  Then put the code that I have in the module below into your module.
    report zrich_0003 .
    *&spwizard: declaration of tablecontrol 'ITABCON' itself
    controls: itabcon type tableview using screen 0100.
    data: begin of itab occurs 0,
          fld1 type c,
          fld2 type c,
          end of itab.
    start-of-selection.
      call screen 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    module status_0100 output.
    *  SET PF-STATUS 'xxxxxxxx'.
    *  SET TITLEBAR 'xxx'.
    endmodule.                
    *&      Module  ITABCON_change_col_attr  OUTPUT
    *       text
    module itabcon_change_col_attr output.
    <b>  data: wa like line of itabcon-cols.
      loop at itabcon-cols into wa.
        if wa-screen-name = 'ITAB-FLD2'.
          wa-invisible = '1'.
          modify itabcon-cols from wa.
        endif.
      endloop.</b>
    endmodule.               
    Regards,
    Rich Heilman

  • How to Enable a Selected single record from Table control...

    Hi,
    I have 5 records in my table control and in screen Painter in Made all the fields in Table control as Output field.
    and  successfully all my Table control fields are disabled...
    Now Now i want to enable the record which i selected n rest all the 4 records should be in Disable.
    what i did is:
    in PBO.
    loop at itab into wa with contol TBC1 .
    Module XYZ.
    endloop.
    Module XYZ.
    loop at screen.
    if screen-group = 'x'.
    screen-input =  1.
    modify screen.
    endif.
    End Module.
    Please help me....
    Thanks,

    hi
    in the layout of the screen u might have dragged and dropped the table control
    double click on it u will get attributes screen in that u select MULTIPLE or SINGLE under Line-Selection
    under attributes tab based on ur requirement.
    table control declaration:
    controls : control type tableview using screen 8000.
    the internal table in table control must be like
    data : begin of itab occurs 0,
    empno type .......,
    empname......,
    empcity.....,
    check(1), " for tab selection"
    end of itab.
    data : itab1 like itab occurs 0 with header line.
    data : flag.
    data : wk_init type i.
    data : lines type i.
    in the attributes screen of the table control
    pass the value ITAB-CHECK to the field W/SELECTION
    in SE51
    PBO
    Module_status_0800
    loop with control table_control_name.
    module_fill_tcontrol.
    endloop.
    PAI
    Module_user_command_0800
    loop with control table_control_name.
    module_read_tcontrol.
    endloop.
    in se38
    Module_status_0800.
    describe table itab1 lines lines.
    control-lines = lines.
    endmodule.
    Module_fill_tcontrol.
    describe table itab1 lines wk_init.
      if wk_init is not initial.
        read table itab1 into itab index control-current_line.
      endif.
    for enabling a row in the table control:
    if sy-ucomm = 'EDIT'.
        loop at screen.
          if flag is initial.
            screen-input = 0.
          elseif ( flag eq 'Y' ).
            if  ( ( screen-name = 'ITAB-EMPNO' or
                    screen-name = 'ITAB-EMPNAME' or
                    screen-name = 'ITAB-EMPCITY' )   
              and control-line_selector eq itab-check
              and control-current_line le lines ).
              screen-input = 1.
            else.
            endif.
          endif.
          modify screen.
        endloop.
      endif.
    endmodule.
    Module_read_tcontrol.
    READ TABLE itab1 INDEX control-current_line.
    IF sy-subrc EQ 0.
    MODIFY itab1 FROM itab INDEX control-current_line.
    ELSE.
    MOVE-CORRESPONDING itab TO itab1.
    APPEND itab1.
    CLEAR itab1.
    ENDIF.
    endmodule.
    module_user_command.
    case sy-ucomm.
    when 'EDIT'. -
    > Function Code assigned to the pushbutton to enable the field 
          flag = 'Y'.
    endcase.
    endmodule.
    Regards
    Murali.M

  • 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.

  • How to capture a selected row in a table control in screen

    Hello,
        I have a table in a screen and hv data in it also from a table.Now i want if a user selects a row n clicks a display button , i should display the same fields in empty text fields created outside the table on the same screen.
    Rite now i m lookin for single selection but any help on multiple selection is also welcomed.
    I have given a line-selection element name as 'LSELECT1'  to the table in screen painter n have declared a variable also with the same name of type C(1) in my abap prog.But dont know wat to write in PAI now to caputure the selected row.
    THANKS

    Hi,
    Use ALV to display your table records from FM 'REUSE_ALV_GRID_DISPLAY'.
    In your internal table add a field with char1. This will show you the selected records by 'X' or ' '. Use this field in your layout like g_layout-box_fieldname = 'CHK'.
    Here i used CHK TYPE CHAR1 added to internal table to display. Now ur ALV will be showing u a column to select records. U can select multiple records also. Evry selected record will reflect into internal table by modifying value of CHK as 'X'. Add button to ALV by creating PF-STATUS and  add code its behavior when executed.
    DATA: BEGIN OF ls_ekko,
          ebeln TYPE ekko-ebeln, " this is my internal table showed in alv
          bukrs TYPE ekko-bukrs,
          bstyp TYPE ekko-bstyp,
          bsart TYPE ekko-bsart,
          lifnr TYPE ekko-lifnr,
          ekorg TYPE ekko-ekorg,
          ekgrp TYPE ekko-ekgrp,
          waers TYPE ekko-waers,
          chk(1)   TYPE c, " check field
          END OF ls_ekko.
    DATA it_ekko LIKE TABLE OF ls_ekko.
    DATA : gt_fcat    TYPE slis_t_fieldcat_alv WITH HEADER LINE,
           g_layout   TYPE slis_layout_alv,
           gt_fcat1    TYPE slis_t_fieldcat_alv WITH HEADER LINE,
           g_layout1   TYPE slis_layout_alv.
      g_layout-colwidth_optimize = 'X'.
      g_layout-box_fieldname = 'CHK'. " adding check field to alv
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
       i_callback_program                = sy-repid
       i_callback_pf_status_set          = 'PF_STATUS_ALV'
       i_callback_user_command           = 'USER_COMMAND_ALV'
      IT_EXCLUDING                      =
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
          is_layout          = g_layout
          it_fieldcat        = gt_fcat[]
          i_default          = 'X'
          i_save             = 'A'
        TABLES
          t_outtab           = it_ekko
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
    *&      Form  PF_STATUS_ALV
        Subroutine for PF status
         -->RT_EXTAB   text
    FORM pf_status_alv USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'SELOBJ' EXCLUDING rt_extab.
    ENDFORM.                    "PF_STATUS_ALV
    Hope this help

  • 'how to code for table control wizard in module pool program

    Hi Gurus,
    Please provide me a sample code of table control wizard...
    Thanks in advance!!!!
    Regards,
    Kranthi

    Hi Kranti,
    check this code... it should be helpful
    *& Module pool       Z_TABLE_CONTROL_WIZARD_DEMO                       *
    PROGRAM  z_table_control_wizard_demo             .
    DATA: BEGIN OF lt_vbak OCCURS 0,
           flag  TYPE c,
           vbeln TYPE vbeln_va,
           netwr TYPE netwr,
           kunnr TYPE kunnr,
          END OF lt_vbak.
    DATA: sfkunnr TYPE kunnr.
    *&spwizard: declaration of tablecontrol 'TCONTROL' itself
    CONTROLS: tcontrol TYPE TABLEVIEW USING SCREEN 9000.
    *&spwizard: lines of tablecontrol 'TCONTROL'
    DATA:     g_tcontrol_lines  LIKE sy-loopc.
    DATA:     ok_code LIKE sy-ucomm.
    *&spwizard: output module for tc 'TCONTROL'. do not change this line!
    *&spwizard: update lines for equivalent scrollbar
    MODULE tcontrol_change_tc_attr OUTPUT.
      DESCRIBE TABLE lt_vbak LINES tcontrol-lines.
    ENDMODULE.                    "TCONTROL_change_tc_attr OUTPUT
    *&spwizard: output module for tc 'TCONTROL'. do not change this line!
    *&spwizard: get lines of tablecontrol
    MODULE tcontrol_get_lines OUTPUT.
      g_tcontrol_lines = sy-loopc.
    ENDMODULE.                    "TCONTROL_get_lines OUTPUT
    *&spwizard: input module for tc 'TCONTROL'. do not change this line!
    *&spwizard: modify table
    MODULE tcontrol_modify INPUT.
      MODIFY lt_vbak
        INDEX tcontrol-current_line.
    ENDMODULE.                    "TCONTROL_modify INPUT
    *&spwizard: input modul for tc 'TCONTROL'. do not change this line!
    *&spwizard: mark table
    MODULE tcontrol_mark INPUT.
      DATA: g_tcontrol_wa2 LIKE LINE OF lt_vbak.
      IF tcontrol-line_sel_mode = 1.
        LOOP AT lt_vbak INTO g_tcontrol_wa2
          WHERE flag = 'X'.
          g_tcontrol_wa2-flag = ''.
          MODIFY lt_vbak
            FROM g_tcontrol_wa2
            TRANSPORTING flag.
        ENDLOOP.
      ENDIF.
      MODIFY lt_vbak
        INDEX tcontrol-current_line
        TRANSPORTING flag.
    ENDMODULE.                    "TCONTROL_mark INPUT
    *&spwizard: input module for tc 'TCONTROL'. do not change this line!
    *&spwizard: process user command
    MODULE tcontrol_user_command INPUT.
      ok_code = sy-ucomm.
      PERFORM user_ok_tc USING    'TCONTROL'
                                  'LT_VBAK'
                                  'FLAG'
                         CHANGING ok_code.
      sy-ucomm = ok_code.
    ENDMODULE.                    "TCONTROL_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  STATUS_9000  OUTPUT
    *       text
    MODULE status_9000 OUTPUT.
      SET PF-STATUS 'S9000'.
      SET TITLEBAR 'T9000'.
    ENDMODULE.                 " STATUS_9000  OUTPUT
    *&      Module  USER_COMMAND_9000  INPUT
    *       text
    MODULE user_command_9000 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
          LEAVE TO SCREEN 0.
        WHEN 'DISP'.
          SELECT vbeln netwr kunnr INTO CORRESPONDING FIELDS OF TABLE lt_vbak
          FROM vbak
          WHERE kunnr = sfkunnr.
    *    LEAVE TO LIST-PROCESSING [AND RETURN TO SCREEN <nnnn>].
    *    By default, the dialog processor returns to the PBO processing of
    *    the screen from which the list processor was called. The optional
    *    addition AND RETURN TO SCREEN allows you to specify a different
    *    screen in the current screen sequence at whose PBO event you want
    *    to resume processing.
        when 'LIST'.
        LEAVE TO LIST-PROCESSING.
        WRITE:/ 'Time  :', SY-UZEIT.
        LOOP AT LT_VBAK.
        WRITE:/ LT_VBAK-VBELN,
                LT_VBAK-NETWR,
                LT_VBAK-KUNNR.
        ENDLOOP.
        WHEN 'SUBM'.
    *& You can call executable programs from other ABAP programs using the
    *& following statement:
    *& SUBMIT <rep>|(<field>) [AND RETURN] [<options>].
          SUBMIT z_submit_report VIA SELECTION-SCREEN AND RETURN.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9000  INPUT
                                                     TABLE CONTROL WIZARD SE51 CODE
    PROCESS BEFORE OUTPUT.
    *&spwizard: pbo flow logic for tablecontrol 'TCONTROL'
      module TCONTROL_change_tc_attr.
    *&spwizard: module TCONTROL_change_col_attr.
      loop at   LT_VBAK
           with control TCONTROL
           cursor TCONTROL-current_line.
        module TCONTROL_get_lines.
    *&spwizard:   module TCONTROL_change_field_attr
      endloop.
    MODULE STATUS_9000.
    PROCESS AFTER INPUT.
    *&spwizard: pai flow logic for tablecontrol 'TCONTROL'
      loop at LT_VBAK.
        chain.
          field LT_VBAK-VBELN.
          field LT_VBAK-NETWR.
          field LT_VBAK-KUNNR.
          module TCONTROL_modify on chain-request.
        endchain.
        field LT_VBAK-FLAG
          module TCONTROL_mark on request.
      endloop.
      module TCONTROL_user_command.
    *&spwizard: module TCONTROL_change_tc_attr.
    *&spwizard: module TCONTROL_change_col_attr.
    MODULE USER_COMMAND_9000.
    regards
    padma

  • How to grey out one single column in a table control of TPMOE

    Hi Experts,
    Any body please tell me how to greyout a single column in a table control of TPMOE.
    Help needed ASAP.
    Thanks,
    sreenivas.

    lr_result      TYPE REF TO if_bol_bo_property_access
    lr_iterator TYPE REF TO if_bol_bo_col_iterator
          CALL METHOD lr_iterator->get_by_index
            EXPORTING
              iv_index  = index
            RECEIVING
              rv_result = lr_result.
          CALL METHOD lr_result->get_property_as_value
            EXPORTING
              iv_attr_name = 'TRANSFER_STATUS'
            IMPORTING
              ev_result    = lv_status.
    if  lv_status = x and component = cost_category.
    rv_disabled = true.
    else.
    call super.
    endif.
    INDEX will have the row number.
    Frame ur logic based on this.

  • How to find out the selected column in Table Control

    Hi all,
          How to find out the selected column in Table Control?
    Thanks & Regards,
    YJR

    Hi,
    Let your table control name in Screen painter be TC1.
    READ TABLE TC1-COLS INTO WA_COLS (some wok area)
                 WITH KEY SELECTED = 'X'.
            IF SY-SUBRC = 0.
              CLEAR: W_DUMMY, W_COL_NAME.
              SPLIT WA_COLS-SCREEN-NAME AT '-' INTO W_DUMMY
                                                   W_COL_NAME.
            endif.
    W_COL_NAME gives you the column name.
    Hope it helps.
    cheers
    sharmistha

  • How to select columns in a table by their column id and not the column name

    Hello,
    How do you select columns from a table based on their column_id.
    I have create a view
    but other than Select * , i cant now select one just one column from it
    the view as follow:
    create view count_student as
    select a.acode "acode",aname "Activity Name",count(ae.acode) "Number of student joined"
    from aenrol ae, activity a
    where a.acode= ae.acode
    group by a.acode,aname;

    The issue is that you have decided to use quoted column names. A pretty horrible idea (mostly for the reasons that you are now finding).
    Re-create the view and get rid of the silly double quotes.

  • How to use direct select and insert or load to speedup the process instead of cursur

    Hi friends,
    I have stored procedure .In SP i am using cursur to load data from Parent to several child table.
    I have attached the script with this message.
    And my problem is how to use direct select and insert or load to speedup the process instead of cursur.
    Can any one please suggest me how to change this scripts pls.
    USE [IconicMarketing]
    GO
    /****** Object: StoredProcedure [dbo].[SP_DMS_INVENTORY] Script Date: 3/6/2015 3:34:03 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author: <ARUN,NAGARAJ>
    -- Create date: <11/21/2014>
    -- Description: <STORED PROCEDURE FOR DMS_INVENTORY>
    -- =============================================
    ALTER PROCEDURE [dbo].[SP_DMS_INVENTORY]
    @Specific_Date varchar(20) ,
    @DealerNum Varchar(6),
    @Date_Daily varchar(50)
    AS
    BEGIN
    SET NOCOUNT ON;
    --==========================================================================
    -- INVENTORY_CURSUR
    --==========================================================================
    DECLARE
    @FileType varchar(50),
    @ACDealerID varchar(50),
    @ClientDealerID varchar(50),
    @DMSType varchar(50),
    @StockNumber varchar(50),
    @InventoryDate datetime ,
    @StockType varchar(100),
    @DMSStatus varchar(50),
    @InvoicePrice numeric(18, 2),
    @CostPack varchar(50),
    @SalesCost numeric(18, 2),
    @HoldbackAmount numeric(18, 2),
    @ListPrice numeric(18, 2),
    @MSRP varchar(max),
    @LotLocation varchar(50),
    @TagLine varchar(max),
    @Certification varchar(max),
    @CertificationNumber varchar(max),
    @VehicleVIN varchar(50),
    @VehicleYear bigint ,
    @VehicleMake varchar(50),
    @VehicleModel varchar(50),
    @VehicleModelCode varchar(50),
    @VehicleTrim varchar(50),
    @VehicleSubTrimLevel varchar(max),
    @Classification varchar(max),
    @TypeCode varchar(100),
    @VehicleMileage bigint ,
    @EngineCylinderCount varchar(10) ,
    @TransmissionType varchar(50),
    @VehicleExteriorColor varchar(50),
    @VehicleInteriorColor varchar(50),
    @CreatedDate datetime ,
    @LastModifiedDate datetime ,
    @ModifiedFlag varchar(max),
    @InteriorColorCode varchar(50),
    @ExteriorColorCode varchar(50),
    @PackageCode varchar(50),
    @CodedCost varchar(50),
    @Air varchar(100),
    @OrderType varchar(max),
    @AgeDays bigint ,
    @OutstandingRO varchar(50),
    @DlrAccessoryRetail varchar(50),
    @DlrAccessoryCost varchar(max),
    @DlrAccessoryDesc varchar(max),
    @ModelDesc varchar(50),
    @Memo1 varchar(1000),
    @Memo2 varchar(max),
    @Weight varchar(max),
    @FloorPlan numeric(18, 2),
    @Purchaser varchar(max),
    @PurchasedFrom varchar(max),
    @InternetPrice varchar(50),
    @InventoryAcctDollar numeric(18, 2),
    @VehicleType varchar(50),
    @DealerAccessoryCode varchar(50),
    @AllInventoryAcctDollar numeric(18, 2),
    @BestPrice varchar(50),
    @InStock bigint ,
    @AccountingMake varchar(50),
    @GasDiesel varchar(max),
    @BookValue varchar(10),
    @FactoryAccessoryDescription varchar(max),
    @TotalReturn varchar(10),
    @TotalCost varchar(10),
    @SS varchar(max),
    @VehicleBody varchar(max),
    @StandardEquipment varchar(max),
    @Account varchar(max),
    @CalculatedPrice varchar(10),
    @OriginalCost varchar(10),
    @AccessoryCore varchar(10),
    @OtherDollar varchar(10),
    @PrimaryBookValue varchar(10),
    @AmountDue varchar(10),
    @LicenseFee varchar(10),
    @ICompany varchar(max),
    @InvenAcct varchar(max),
    @Field23 varchar(max),
    @Field24 varchar(max),
    @SalesCode bigint,
    @BaseRetail varchar(10),
    @BaseInvAmt varchar(10),
    @CommPrice varchar(10),
    @Price1 varchar(10),
    @Price2 varchar(10),
    @StickerPrice varchar(10),
    @TotInvAmt varchar(10),
    @OptRetail varchar(max),
    @OptInvAmt varchar(10),
    @OptCost varchar(10),
    @Options1 varchar(max),
    @Category varchar(max),
    @Description varchar(max),
    @Engine varchar(max),
    @ModelType varchar(max),
    @FTCode varchar(max),
    @Wholesale varchar(max),
    @Retail varchar(max),
    @Draft varchar(max),
    @myerror varchar(500),
    @Inventoryid int,
    @errornumber int,
    @errorseverity varchar(500),
    @errortable varchar(50),
    @errorstate int,
    @errorprocedure varchar(500),
    @errorline varchar(50),
    @errormessage varchar(1000),
    @Invt_Id int,
    @flatfile_createddate datetime,
    @FtpDate date,
    @Inv_cur varchar(1000),
    @S_Year varchar(4),
    @S_Month varchar(2),
    @S_Date varchar(2),
    @Date_Specfic varchar(50),
    @Param_list nvarchar(max),
    @Daily_Date Varchar(50);
    --====================================================================================
    --DECLARE CURSUR FOR SPECIFIC DATE (OR) DEALER-ID WITH SPECIFIC DATE (OR) CURRENT DATE
    --====================================================================================
    set @Date_Specfic = Substring(@Specific_Date,1,4) +'-'+Substring(@Specific_Date,5,2)+'-'+Substring(@Specific_Date,7,2);
    set @Daily_Date = SUBSTRING(@Date_Daily,14,4) + '-' + SUBSTRING(@Date_Daily,18,2)+ '-' + SUBSTRING(@date_Daily,20,2)
    IF @Daily_Date IS NOT NULL
    BEGIN
    Delete From [dbo].[DMS_INVENTORY_DETAILS]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
    Delete From [dbo].[DMS_INVENTORY_AMOUNT]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
    Delete From [dbo].[ICONIC_INVENTORY_VEHICLE]
    Where DMSInventoryVehicleID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
    Delete From [dbo].[DMS_INVENTORY_VEHICLE]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
    Delete From [dbo].[ICONIC_EQUITY_INVENTORY_COMPARE]
    Where InventoryVehicleId in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
    Delete From [dbo].[DMS_INVENTORY]
    Where ID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
    DECLARE Inventory_Cursor CURSOR FOR
    SELECT * from [dbo].[FLATFILE_INVENTORY] where
    CONVERT (date,flatfile_createddate) = CONVERT (date,GETDATE()) order by flatfile_createddate;
    END
    Else
    BEGIN
    if (@Date_Specfic IS NOT NULL AND @DealerNum != '?????')
    BEGIN
    Delete From [dbo].[DMS_INVENTORY_DETAILS]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
    Delete From [dbo].[DMS_INVENTORY_AMOUNT]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
    Delete From [dbo].[ICONIC_INVENTORY_VEHICLE]
    Where DMSInventoryVehicleID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
    Delete From [dbo].[DMS_INVENTORY_VEHICLE]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
    Delete From [dbo].[ICONIC_EQUITY_INVENTORY_COMPARE]
    Where InventoryVehicleId in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
    Delete From [dbo].[DMS_INVENTORY]
    Where ID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
    DECLARE Inventory_Cursor CURSOR FOR
    SELECT * from [dbo].[FLATFILE_INVENTORY] where FtpDate=@Date_Specfic AND ACDealerID='ACTEST' + @DealerNum;
    END
    ELSE
    BEGIN
    Delete From [dbo].[DMS_INVENTORY_DETAILS]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
    Delete From [dbo].[DMS_INVENTORY_AMOUNT]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
    Delete From [dbo].[ICONIC_INVENTORY_VEHICLE]
    Where DMSInventoryVehicleID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
    Delete From [dbo].[DMS_INVENTORY_VEHICLE]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
    Delete From [dbo].[ICONIC_EQUITY_INVENTORY_COMPARE]
    Where InventoryVehicleId in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
    Delete From [dbo].[DMS_INVENTORY]
    Where ID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
    DECLARE Inventory_Cursor CURSOR FOR
    SELECT * from [dbo].[FLATFILE_INVENTORY] where FtpDate=@Date_Specfic;
    END
    END
    OPEN Inventory_Cursor
    FETCH NEXT FROM Inventory_Cursor
    INTO
    @FileType ,
    @ACDealerID ,
    @ClientDealerID ,
    @DMSType ,
    @StockNumber ,
    @InventoryDate ,
    @StockType ,
    @DMSStatus ,
    @InvoicePrice ,
    @CostPack ,
    @SalesCost ,
    @HoldbackAmount ,
    @ListPrice ,
    @MSRP ,
    @LotLocation ,
    @TagLine ,
    @Certification ,
    @CertificationNumber ,
    @VehicleVIN ,
    @VehicleYear ,
    @VehicleMake ,
    @VehicleModel ,
    @VehicleModelCode ,
    @VehicleTrim ,
    @VehicleSubTrimLevel ,
    @Classification ,
    @TypeCode ,
    @VehicleMileage ,
    @EngineCylinderCount ,
    @TransmissionType ,
    @VehicleExteriorColor ,
    @VehicleInteriorColor ,
    @CreatedDate ,
    @LastModifiedDate ,
    @ModifiedFlag ,
    @InteriorColorCode ,
    @ExteriorColorCode ,
    @PackageCode ,
    @CodedCost ,
    @Air ,
    @OrderType ,
    @AgeDays ,
    @OutstandingRO ,
    @DlrAccessoryRetail ,
    @DlrAccessoryCost ,
    @DlrAccessoryDesc ,
    @ModelDesc ,
    @Memo1 ,
    @Memo2 ,
    @Weight ,
    @FloorPlan ,
    @Purchaser ,
    @PurchasedFrom ,
    @InternetPrice ,
    @InventoryAcctDollar ,
    @VehicleType ,
    @DealerAccessoryCode ,
    @AllInventoryAcctDollar ,
    @BestPrice ,
    @InStock ,
    @AccountingMake ,
    @GasDiesel ,
    @BookValue ,
    @FactoryAccessoryDescription ,
    @TotalReturn ,
    @TotalCost ,
    @SS ,
    @VehicleBody ,
    @StandardEquipment ,
    @Account ,
    @CalculatedPrice ,
    @OriginalCost ,
    @AccessoryCore ,
    @OtherDollar ,
    @PrimaryBookValue ,
    @AmountDue ,
    @LicenseFee ,
    @ICompany ,
    @InvenAcct ,
    @Field23 ,
    @Field24 ,
    @SalesCode ,
    @BaseRetail ,
    @BaseInvAmt ,
    @CommPrice ,
    @Price1 ,
    @Price2 ,
    @StickerPrice ,
    @TotInvAmt ,
    @OptRetail ,
    @OptInvAmt ,
    @OptCost ,
    @Options1 ,
    @Category ,
    @Description ,
    @Engine ,
    @ModelType ,
    @FTCode ,
    @Wholesale ,
    @Retail ,
    @Draft ,
    @flatfile_createddate,
    @FtpDate;
    WHILE @@FETCH_STATUS = 0
    BEGIN
    --==========================================================================
    -- INSERT INTO INVENTORY (PARENT TABLE)
    --==========================================================================
    BEGIN TRY
    INSERT INTO [dbo].[DMS_INVENTORY]
    DMSDealerID,
    StockNumber,
    DMSType,
    InventoryDate,
    FtpDate
    VALUES (@ClientDealerID,@StockNumber,@DMSType,@InventoryDate,@FtpDate);
    END TRY
    BEGIN CATCH
    SELECT
    @errornumber = ERROR_NUMBER(),
    @errorseverity = ERROR_SEVERITY(),
    @errortable = 'DMS_INVENTORY',
    @errorstate = ERROR_STATE(),
    @errorprocedure = ERROR_PROCEDURE(),
    @errorline = ERROR_LINE(),
    @errormessage = ERROR_MESSAGE();
    --==========================================================================
    -- INSERT ERRORS INTO DMSLOG_INVENTORY_ERROR
    --==========================================================================
    EXEC [SP_DMS_INVENTORY_ERROR] @FileType,@ACDealerID,@ClientDealerID,@DMSType,@StockNumber,@InventoryDate,@StockType,@DMSStatus,@InvoicePrice,@CostPack,
    @SalesCost,@HoldbackAmount,@ListPrice,@MSRP,@LotLocation,@TagLine,@Certification,@CertificationNumber,@VehicleVIN,@VehicleYear,@VehicleMake,@VehicleModel,@VehicleModelCode,
    @VehicleTrim,@VehicleSubTrimLevel,@Classification,@TypeCode,@VehicleMileage,@EngineCylinderCount,@TransmissionType,@VehicleExteriorColor,@VehicleInteriorColor,
    @CreatedDate,@LastModifiedDate,@ModifiedFlag,@InteriorColorCode,@ExteriorColorCode,@PackageCode,@CodedCost,@Air,@OrderType,@AgeDays,@OutstandingRO,
    @DlrAccessoryRetail,@DlrAccessoryCost,@DlrAccessoryDesc,@ModelDesc,@Memo1,@Memo2,@Weight,@FloorPlan,@Purchaser,@PurchasedFrom,@InternetPrice,
    @InventoryAcctDollar,@VehicleType,@DealerAccessoryCode,@AllInventoryAcctDollar,@BestPrice,@InStock,@AccountingMake,@GasDiesel,@BookValue,
    @FactoryAccessoryDescription,@TotalReturn,@TotalCost,@SS,@VehicleBody,@StandardEquipment,@Account,@CalculatedPrice,@OriginalCost,@AccessoryCore,
    @OtherDollar,@PrimaryBookValue,@AmountDue,@LicenseFee,@ICompany,@InvenAcct,@Field23,@Field24,@SalesCode,@BaseRetail,@BaseInvAmt,@CommPrice,@Price1,
    @Price2,@StickerPrice,@TotInvAmt,@OptRetail,@OptInvAmt,@OptCost,@Options1,@Category,@Description,@Engine,@ModelType,@FTCode,@Wholesale,@Retail,@Draft,
    @ERRORNUMBER,@ERRORSEVERITY,@ERRORTABLE,@ERRORSTATE,@ERRORPROCEDURE,@ERRORLINE,@errormessage,@FtpDate
    END CATCH
    -- PRINT @errornumber;
    -- PRINT @errorseverity;
    -- PRINT @errortable;
    -- PRINT @errorprocedure;
    -- PRINT @errorline;
    -- PRINT @errormessage;
    -- PRINT @errorstate;
    set @myerror = @@ERROR;
    -- This -- PRINT statement -- PRINTs 'Error = 0' because
    -- @@ERROR is reset in the IF statement above.
    -- PRINT N'Error = ' + @myerror;
    set @Inventoryid = scope_identity();
    -- PRINT @Inventoryid;
    --==========================================================================
    -- INSERT INTO DMS_INVENTORY_DETAILS (CHILD TABLE)
    --==========================================================================
    BEGIN TRY
    INSERT INTO [dbo].[DMS_INVENTORY_DETAILS]
    DMSInventoryID,
    StockType,
    DMSStatus,
    LotLocation,
    TagLine,
    Certification,
    CertificationNumber,
    CreatedDate,
    LastModifiedDate,
    ModifiedFlag,
    PackageCode,
    OrderType,
    AgeDays,
    OutstandingRO,
    Memo1,
    Memo2,
    Purchaser,
    PurchasedFrom,
    DealerAccessoryCode,
    InStock,
    AccountingMake,
    SS,
    Account,
    AccessoryCore,
    ICompany,
    InvenAcct,
    Field23,
    Field24,
    SalesCode,
    Draft,
    FTCode,
    FtpDate
    VALUES (
    @InventoryID,
    @StockType,
    @DMSStatus,
    @LotLocation,
    @TagLine,
    @Certification,
    @CertificationNumber,
    @CreatedDate,
    @LastModifiedDate,
    @ModifiedFlag,
    @PackageCode,
    @OrderType,
    @AgeDays,
    @OutstandingRO,
    @Memo1,
    @Memo2,
    @Purchaser,
    @PurchasedFrom,
    @DealerAccessoryCode,
    @InStock,
    @AccountingMake,
    @SS,
    @Account,
    @AccessoryCore,
    @ICompany,
    @InvenAcct,
    @Field23,
    @Field24,
    @SalesCode,
    @Draft,
    @FTCode,
    @FtpDate
    END TRY
    BEGIN CATCH
    SELECT
    @errornumber = ERROR_NUMBER(),
    @errorseverity = ERROR_SEVERITY(),
    @errorstate = ERROR_STATE(),
    @errortable = 'DMS_INVENTORY_DETAILS',
    @errorprocedure = ERROR_PROCEDURE(),
    @errorline = ERROR_LINE(),
    @errormessage = ERROR_MESSAGE();
    --==========================================================================
    -- INSERT ERRORS INTO DMSLOG_INVENTORY_ERROR
    --==========================================================================
    EXECUTE [SP_DMS_INVENTORY_ERROR] @FileType,@ACDealerID,@ClientDealerID,@DMSType,@StockNumber,@InventoryDate,@StockType,@DMSStatus,@InvoicePrice,@CostPack,
    @SalesCost,@HoldbackAmount,@ListPrice,@MSRP,@LotLocation,@TagLine,@Certification,@CertificationNumber,@VehicleVIN,@VehicleYear,@VehicleMake,@VehicleModel,@VehicleModelCode,
    @VehicleTrim,@VehicleSubTrimLevel,@Classification,@TypeCode,@VehicleMileage,@EngineCylinderCount,@TransmissionType,@VehicleExteriorColor,@VehicleInteriorColor,
    @CreatedDate,@LastModifiedDate,@ModifiedFlag,@InteriorColorCode,@ExteriorColorCode,@PackageCode,@CodedCost,@Air,@OrderType,@AgeDays,@OutstandingRO,
    @DlrAccessoryRetail,@DlrAccessoryCost,@DlrAccessoryDesc,@ModelDesc,@Memo1,@Memo2,@Weight,@FloorPlan,@Purchaser,@PurchasedFrom,@InternetPrice,
    @InventoryAcctDollar,@VehicleType,@DealerAccessoryCode,@AllInventoryAcctDollar,@BestPrice,@InStock,@AccountingMake,@GasDiesel,@BookValue,
    @FactoryAccessoryDescription,@TotalReturn,@TotalCost,@SS,@VehicleBody,@StandardEquipment,@Account,@CalculatedPrice,@OriginalCost,@AccessoryCore,
    @OtherDollar,@PrimaryBookValue,@AmountDue,@LicenseFee,@ICompany,@InvenAcct,@Field23,@Field24,@SalesCode,@BaseRetail,@BaseInvAmt,@CommPrice,@Price1,
    @Price2,@StickerPrice,@TotInvAmt,@OptRetail,@OptInvAmt,@OptCost,@Options1,@Category,@Description,@Engine,@ModelType,@FTCode,@Wholesale,@Retail,@Draft,
    @ERRORNUMBER,@ERRORSEVERITY,@ERRORTABLE,@ERRORSTATE,@ERRORPROCEDURE,@ERRORLINE,@errormessage,@FtpDate
    END CATCH
    --==========================================================================
    -- INSERT INTO DMS_INVENTORY_AMOUNT (CHILD TABLE)
    --==========================================================================
    BEGIN TRY
    INSERT INTO [dbo].[DMS_INVENTORY_AMOUNT]
    DMSInventoryID,
    AllInventoryAcctDollar,
    OtherDollar,
    PrimaryBookValue,
    AmountDue,
    LicenseFee,
    CalculatedPrice,
    OriginalCost,
    BookValue,
    TotalReturn,
    TotalCost,
    DlrAccessoryRetail,
    DlrAccessoryCost,
    DlrAccessoryDesc,
    InternetPrice,
    InventoryAcctDollar,
    BestPrice,
    Weight,
    FloorPlan,
    CodedCost,
    InvoicePrice,
    CostPack,
    SalesCost,
    HoldbackAmount,
    ListPrice,
    MSRP,
    BaseRetail,
    BaseInvAmt,
    CommPrice,
    Price1,
    Price2,
    StickerPrice,
    TotInvAmt,
    OptRetail,
    OptInvAmt,
    OptCost,
    Wholesale,
    Retail,
    FtpDate
    VALUES (
    @InventoryID,
    @AllInventoryAcctDollar,
    @OtherDollar,
    @PrimaryBookValue,
    @AmountDue,
    @LicenseFee,
    @CalculatedPrice,
    @OriginalCost,
    @BookValue,
    @TotalReturn,
    @TotalCost,
    @DlrAccessoryRetail,
    @DlrAccessoryCost,
    @DlrAccessoryDesc,
    @InternetPrice,
    @InventoryAcctDollar,
    @BestPrice,
    @Weight,
    @FloorPlan,
    @CodedCost,
    @InvoicePrice,
    @CostPack,
    @SalesCost,
    @HoldbackAmount,
    @ListPrice,
    @MSRP,
    @BaseRetail,
    @BaseInvAmt,
    @CommPrice,
    @Price1,
    @Price2,
    @StickerPrice,
    @TotInvAmt,
    @OptRetail,
    @OptInvAmt,
    @OptCost,
    @Wholesale,
    @Retail,
    @FtpDate
    END TRY
    BEGIN CATCH
    SELECT
    @errornumber = ERROR_NUMBER(),
    @errorseverity = ERROR_SEVERITY(),
    @errortable = 'DMS_INVENTORY_AMOUNT',
    @errorstate = ERROR_STATE(),
    @errorprocedure = ERROR_PROCEDURE(),
    @errorline = ERROR_LINE(),
    @errormessage = ERROR_MESSAGE();
    --==========================================================================
    -- INSERT ERRORS INTO DMSLOG_INVENTORY_ERROR
    --==========================================================================
    EXEC [SP_DMS_INVENTORY_ERROR] @FileType,@ACDealerID,@ClientDealerID,@DMSType,@StockNumber,@InventoryDate,@StockType,@DMSStatus,@InvoicePrice,@CostPack,
    @SalesCost,@HoldbackAmount,@ListPrice,@MSRP,@LotLocation,@TagLine,@Certification,@CertificationNumber,@VehicleVIN,@VehicleYear,@VehicleMake,@VehicleModel,@VehicleModelCode,
    @VehicleTrim,@VehicleSubTrimLevel,@Classification,@TypeCode,@VehicleMileage,@EngineCylinderCount,@TransmissionType,@VehicleExteriorColor,@VehicleInteriorColor,
    @CreatedDate,@LastModifiedDate,@ModifiedFlag,@InteriorColorCode,@ExteriorColorCode,@PackageCode,@CodedCost,@Air,@OrderType,@AgeDays,@OutstandingRO,
    @DlrAccessoryRetail,@DlrAccessoryCost,@DlrAccessoryDesc,@ModelDesc,@Memo1,@Memo2,@Weight,@FloorPlan,@Purchaser,@PurchasedFrom,@InternetPrice,
    @InventoryAcctDollar,@VehicleType,@DealerAccessoryCode,@AllInventoryAcctDollar,@BestPrice,@InStock,@AccountingMake,@GasDiesel,@BookValue,
    @FactoryAccessoryDescription,@TotalReturn,@TotalCost,@SS,@VehicleBody,@StandardEquipment,@Account,@CalculatedPrice,@OriginalCost,@AccessoryCore,
    @OtherDollar,@PrimaryBookValue,@AmountDue,@LicenseFee,@ICompany,@InvenAcct,@Field23,@Field24,@SalesCode,@BaseRetail,@BaseInvAmt,@CommPrice,@Price1,
    @Price2,@StickerPrice,@TotInvAmt,@OptRetail,@OptInvAmt,@OptCost,@Options1,@Category,@Description,@Engine,@ModelType,@FTCode,@Wholesale,@Retail,@Draft,
    @ERRORNUMBER,@ERRORSEVERITY,@ERRORTABLE,@ERRORSTATE,@ERRORPROCEDURE,@ERRORLINE,@errormessage,@FtpDate
    END CATCH
    --==========================================================================
    -- INSERT INTO DMS_INVENTORY_VEHICLE (CHILD TABLE)
    --==========================================================================
    BEGIN TRY
    INSERT INTO [dbo].[DMS_INVENTORY_VEHICLE]
    DMSInventoryID,
    InteriorColorCode,
    ExteriorColorCode,
    Air,
    ModelDesc,
    VehicleType,
    VehicleVIN,
    VehicleYear,
    VehicleMake,
    VehicleModel,
    VehicleModelCode,
    VehicleTrim,
    VehicleSubTrimLevel,
    Classification,
    TypeCode,
    VehicleMileage,
    FtpDate,
    EngineCylinderCount
    VALUES (
    @InventoryID,
    @InteriorColorCode,
    @ExteriorColorCode,
    @Air,
    @ModelDesc,
    @VehicleType,
    @VehicleVIN,
    @VehicleYear,
    @VehicleMake,
    @VehicleModel,
    @VehicleModelCode,
    @VehicleTrim,
    @VehicleSubTrimLevel,
    @Classification,
    @TypeCode,
    @VehicleMileage,
    @FtpDate,
    @EngineCylinderCount
    END TRY
    BEGIN CATCH
    SELECT
    @errornumber = ERROR_NUMBER(),
    @errorseverity = ERROR_SEVERITY(),
    @errortable = 'DMS_INVENTORY_VEHICLE',
    @errorstate = ERROR_STATE(),
    @errorprocedure = ERROR_PROCEDURE(),
    @errorline = ERROR_LINE(),
    @errormessage = ERROR_MESSAGE();
    --==========================================================================
    -- INSERT ERRORS INTO DMSLOG_INVENTORY_ERROR
    --==========================================================================
    EXEC [SP_DMS_INVENTORY_ERROR] @FileType,@ACDealerID,@ClientDealerID,@DMSType,@StockNumber,@InventoryDate,@StockType,@DMSStatus,@InvoicePrice,@CostPack,
    @SalesCost,@HoldbackAmount,@ListPrice,@MSRP,@LotLocation,@TagLine,@Certification,@CertificationNumber,@VehicleVIN,@VehicleYear,@VehicleMake,@VehicleModel,@VehicleModelCode,
    @VehicleTrim,@VehicleSubTrimLevel,@Classification,@TypeCode,@VehicleMileage,@EngineCylinderCount,@TransmissionType,@VehicleExteriorColor,@VehicleInteriorColor,
    @CreatedDate,@LastModifiedDate,@ModifiedFlag,@InteriorColorCode,@ExteriorColorCode,@PackageCode,@CodedCost,@Air,@OrderType,@AgeDays,@OutstandingRO,
    @DlrAccessoryRetail,@DlrAccessoryCost,@DlrAccessoryDesc,@ModelDesc,@Memo1,@Memo2,@Weight,@FloorPlan,@Purchaser,@PurchasedFrom,@InternetPrice,
    @InventoryAcctDollar,@VehicleType,@DealerAccessoryCode,@AllInventoryAcctDollar,@BestPrice,@InStock,@AccountingMake,@GasDiesel,@BookValue,
    @FactoryAccessoryDescription,@TotalReturn,@TotalCost,@SS,@VehicleBody,@StandardEquipment,@Account,@CalculatedPrice,@OriginalCost,@AccessoryCore,
    @OtherDollar,@PrimaryBookValue,@AmountDue,@LicenseFee,@ICompany,@InvenAcct,@Field23,@Field24,@SalesCode,@BaseRetail,@BaseInvAmt,@CommPrice,@Price1,
    @Price2,@StickerPrice,@TotInvAmt,@OptRetail,@OptInvAmt,@OptCost,@Options1,@Category,@Description,@Engine,@ModelType,@FTCode,@Wholesale,@Retail,@Draft,
    @ERRORNUMBER,@ERRORSEVERITY,@ERRORTABLE,@ERRORSTATE,@ERRORPROCEDURE,@ERRORLINE,@errormessage,@FtpDate
    END CATCH
    --==========================================================================
    -- MOVE CURSUR TO NEXT RECORD
    --==========================================================================
    FETCH NEXT FROM Inventory_Cursor
    INTO @FileType ,
    @ACDealerID ,
    @ClientDealerID ,
    @DMSType ,
    @StockNumber ,
    @InventoryDate ,
    @StockType ,
    @DMSStatus ,
    @InvoicePrice ,
    @CostPack ,
    @SalesCost ,
    @HoldbackAmount ,
    @ListPrice ,
    @MSRP ,
    @LotLocation ,
    @TagLine ,
    @Certification ,
    @CertificationNumber ,
    @VehicleVIN ,
    @VehicleYear ,
    @VehicleMake ,
    @VehicleModel ,
    @VehicleModelCode ,
    @VehicleTrim ,
    @VehicleSubTrimLevel ,
    @Classification ,
    @TypeCode ,
    @VehicleMileage ,
    @EngineCylinderCount ,
    @TransmissionType ,
    @VehicleExteriorColor ,
    @VehicleInteriorColor ,
    @CreatedDate ,
    @LastModifiedDate ,
    @ModifiedFlag ,
    @InteriorColorCode ,
    @ExteriorColorCode ,
    @PackageCode ,
    @CodedCost ,
    @Air ,
    @OrderType ,
    @AgeDays ,
    @OutstandingRO ,
    @DlrAccessoryRetail ,
    @DlrAccessoryCost ,
    @DlrAccessoryDesc ,
    @ModelDesc ,
    @Memo1 ,
    @Memo2 ,
    @Weight ,
    @FloorPlan ,
    @Purchaser ,
    @PurchasedFrom ,
    @InternetPrice ,
    @InventoryAcctDollar ,
    @VehicleType ,
    @DealerAccessoryCode ,
    @AllInventoryAcctDollar ,
    @BestPrice ,
    @InStock ,
    @AccountingMake ,
    @GasDiesel ,
    @BookValue ,
    @FactoryAccessoryDescription ,
    @TotalReturn ,
    @TotalCost ,
    @SS ,
    @VehicleBody ,
    @StandardEquipment ,
    @Account ,
    @CalculatedPrice ,
    @OriginalCost ,
    @AccessoryCore ,
    @OtherDollar ,
    @PrimaryBookValue ,
    @AmountDue ,
    @LicenseFee ,
    @ICompany ,
    @InvenAcct ,
    @Field23 ,
    @Field24 ,
    @SalesCode ,
    @BaseRetail ,
    @BaseInvAmt ,
    @CommPrice ,
    @Price1 ,
    @Price2 ,
    @StickerPrice ,
    @TotInvAmt ,
    @OptRetail ,
    @OptInvAmt ,
    @OptCost ,
    @Options1 ,
    @Category ,
    @Description ,
    @Engine ,
    @ModelType ,
    @FTCode ,
    @Wholesale ,
    @Retail ,
    @Draft ,
    @flatfile_createddate,
    @FtpDate;
    END
    CLOSE Inventory_Cursor;
    DEALLOCATE Inventory_Cursor;
    SET ANSI_PADDING OFF
    END
    Arunraj Kumar

    Thank you.
    And another question if the data is already there in the child table if i try to load alone it must delete the old data in the child tablee and need to get load the new data and 
    How to do this ?
    Arunraj Kumar
    You can do that with an IF EXISTS condition
    IF EXISTS (SELECT 1
    FROM YourChildTable c
    INNER JOIn @temptable t
    ON c.Bkey1 = t.Bkey1
    AND c.Bkey2 = t.Bkey2
    DELETE t
    FROM YourChildTable c
    INNER JOIn @temptable t
    ON c.Bkey1 = t.Bkey1
    AND c.Bkey2 = t.Bkey2
    INSERT INTO YourChildTable
    where Bkey1,Bkey2 etc forms the business key of the table
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How do you "Unsort" a column to get it back to the way it was when you opened it?

    How do you "Unsort" a column to get it back to the way it was when you opened it?
    I like to sort by price or alphabetical etc but then I want to return the cells to where they were and I can't figure out a way to do that.
    For instance, the rows that don't matter so much like the ones that just describe what date is the follow are now all together and I want it back the way it was when I opened the document without losing any changes I've met to other things in the doc since I sorted.
    Can anyone help with this?
    Thanks.
    Tim

    Hi fl2,
    Adding to replies from Wayne and Barry. After you open that Numbers document, insert another column into a table before you sort it. The column can be anywhere in that table. Here is Column A (labelled "Original") that I inserted. It has numbers in sequence (1, 2, 3...)
    As Barry said, these must be numbers, not the results of a formula.
    Now you can sort by any column to your heart's delight and always go back to the original order by sorting that table by column A.
    Regards,
    Ian.

  • How to identify the source column and source table for a measure

    Does anyone have a query that I can use to positively identify the source column and source table for a cube measure in an SSAS cube?  Visual Studio shows ID, Name, and Source, but it is nearly worthless in a large cube and database.
    Also - the same for a dimension would be great.
    If no query exists for this, can someone please explain how to find the source column/table for a measure and for a dimension?
    Thanks.

    DMVs don’t expose the DataSourceView content. AMO is much better suited for object model operations like
    this than the DMVs. PowerShell is also sometimes an option, but in this case C# code would be much easier because analyzing the contents of the DataSourceView is much easier using the .Net DataSet class.
    Hope this helps.
    Reeves
    Denver, CO

  • How do I turn off the curvature tool in CC, I chose the selection tool to create a box and the middle selector that allows you to adjust the size has disappeared?

    How do I turn off the curvature tool in CC, I chose the selection tool to create a box and the middle selector that allows you to adjust the size has disappeared? My coworker discovered making ti a compound path by right clicking it and selecting it. All I want to do is adjust the size of a box. please advise.

    You should post questions about using applications in the specific application's forum(s).
    Here is a link to a page that has links to all Adobe forums...
    Forum links page:
    https://forums.adobe.com/welcome

  • How to insert the select query result into table?

    How to insert the select query result into table?
    SELECT  top 20 creation_time  
            ,last_execution_time 
            ,total_physical_reads
            ,total_logical_reads  
            ,total_logical_writes
            , execution_count 
            , total_worker_time
            , total_elapsed_time 
            , total_elapsed_time / execution_count avg_elapsed_time
            ,SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
             ((CASE statement_end_offset 
              WHEN -1 THEN DATALENGTH(st.text)
              ELSE qs.statement_end_offset END 
                - qs.statement_start_offset)/2) + 1) AS statement_text
    FROM sys.dm_exec_query_stats AS qs
    CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
    ORDER BY total_elapsed_time / execution_count DESC;
    Thanks,
    Tirumala

    1. SELECT INTO
    Below method will create table when data is inserted from one table to another table. Its useful when you need exactly same datatype as source table.
    Use AdventureWorks2008R2;
    Go
    ---Insert data using SELECT INTO
    SELECT AddressLine1, City
    INTO BothellAddresses
    FROM Person.Address
    where City = 'Bothell';
    GO
    ---VERIFY DATA
    Select AddressLine1, City
    FROM BothellAddresses
    ---DROP TABLE
    DROP TABLE BothellAddresses
    GO
    2. INSERT INTO SELECT
    Below method will need table to be created prior to inserting data. Its really useful when table is already created and you want insert data from
    another table.
    Use AdventureWorks2008R2;
    Go
    ---Create Table
    CREATE TABLE BothellAddresses (AddressLine1 NVARCHAR(60), City NVARCHAR(30))
    ---Insert into above table using SELECT
    INSERT INTO BothellAddresses(AddressLine1, City)
    SELECT AddressLine1, City
    FROM Person.Address
    where City = 'Bothell';
    ---VERIFY DATA
    Select AddressLine1, City
    FROM BothellAddresses
    ---DROP TABLE
    DROP TABLE BothellAddresses
    GO
    Regards,
    Vishal Patel
    Blog: http://vspatel.co.uk
    Site: http://lehrity.com

Maybe you are looking for

  • How to set a background image in javafx?

    Hi everyone, I draw FXML GUI,it includes labels and ProgressBar,load it in JavaFX, this is a snippet. root = FXMLLoader.load(getClass().getResource("StartMenuFXML.fxml")); label1=(Label)root.lookup("#label"); label2=(Label)root.lookup("#label"); prog

  • Printing from an Adobe product suddenly not working

    The latest security update for 10.5.5 seems to have messed up my printing ability. Printing from Adobe Illustrator or InDesign (CS3) my files are mysteriously reduced and rotated, or just reduced as if they were forced to fit smaller paper. The worka

  • Closed date of AR invoice.

    Hi Experts, How to find the Closed date of AR invoice. Invoice may be closed due to credit memo or incoming payment

  • VF01/VF04 Custom enhancement

    Dear Experts, We got requirement where in we have to copy VF04 selection screen (<b>SCREEN #1</b>), add additional fields and filter output based on the selection criteria. Out put of this selection will be ALV out put <b>SCREEN #2</b>) where all lin

  • Converting a file to PDF

    Thank you in advance for the help and Paul had been helpful with my other task. I have one more that I want to see if there is a solution using CFMX 7. I know how to do the following. Create a PDF file from a query and how to combines PDF files toget