Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to make line disable in table control at runtime...?

former_member502730
Participant
0 Kudos

Dear All,

I am using table control in my program.

My requirenment is, in my ITAB there are default 3-4 records, those line in table control I want as input disable and for new line i have given add line button and that new added line are input enable.

How to perform it...?

Regards,

Dharmesh Vyas

7 REPLIES 7

raymond_giuseppi
Active Contributor
0 Kudos

Look at

Regards

Former Member
0 Kudos

here is a reference code for table control

************************************************************************

  • Tables

************************************************************************

TABLES: z000k_dfm. " DFM Master table

************************************************************************

  • CONSTANTS *

************************************************************************

CONSTANTS:

c_x TYPE c VALUE 'X'. " Value X

************************************************************************

  • CONTROLS *

************************************************************************

*Table control

CONTROLS:

tc_dfmacc TYPE TABLEVIEW USING SCREEN 9000.

************************************************************************

  • VARIABLE DECLARATION *

************************************************************************

DATA:

v_position TYPE i, " Position

v_okcode LIKE sy-ucomm, " OK Code

v_lines TYPE i, " No of Table control lines

v_err_flag TYPE c, " Error Flag variable

v_confirm_ind TYPE c, " Indicator for confirm window

v_insert_flag TYPE c, " Flag variable

v_modify_flag TYPE c, " Flag variable

v_tabix LIKE sy-tabix, " Index variable

v_chgind_flag TYPE c. " Change indicator variable

************************************************************************

  • INTERNAL TABLES *

************************************************************************

  • Internal table to fetch data from table.

DATA:

BEGIN OF fs_z000k_dfm .

INCLUDE STRUCTURE z000k_dfm.

DATA:

sel TYPE c, " To identify selected row

ins TYPE c, " To identify inserted row

END OF fs_z000k_dfm.

DATA:i_z000k_dfm LIKE STANDARD TABLE OF fs_z000k_dfm.

  • Internal table used for validation.

DATA:

BEGIN OF i_z000k_dfm_out OCCURS 0.

INCLUDE STRUCTURE z000k_dfm.

DATA:

sel TYPE c, " To identify selected row

ins TYPE c, " To identify inserted row

END OF i_z000k_dfm_out.

  • Working Internal table used to store newly enterd date for validation.

DATA:

BEGIN OF i_z000k_dfm_tmp OCCURS 0.

INCLUDE STRUCTURE z000k_dfm.

DATA:

sel TYPE c, " To identify selected row

ins TYPE c, " To identify inserted row

END OF i_z000k_dfm_tmp.

  • Internal table to store ok_codes

DATA:

BEGIN OF i_okcodes OCCURS 0,

func_code LIKE sy-ucomm,

END OF i_okcodes.

  • Work area to hold table control data

DATA:

v_dfm LIKE LINE OF " Work area for table control

tc_dfmacc-cols. " COLS struct TC_ZVC0_SALESINFO

************************************************************************

  • Start Of Selection *

************************************************************************

START-OF-SELECTION.

*Populate internal table with table entries

PERFORM f_get_table_data.

*Call Screen to maintain table Z000K_DFM via table control.

CALL SCREEN 9000.

&----


*& Form F_GET_TABLE_DATA *

&----


*This subroutine populates internal table from table Z000K_DFM *

----


*No interface parameters are passed to this subroutine *

----


FORM f_get_table_data.

CLEAR :

v_insert_flag,

v_err_flag,

v_modify_flag.

REFRESH

i_z000k_dfm[].

  • Get all the data from table

SELECT *

FROM z000k_dfm

INTO TABLE i_z000k_dfm.

IF sy-subrc EQ 0.

  • Do Nothing

ENDIF. " IF sy-subrc EQ 0

ENDFORM. " F_GET_TABLE_DATA

&----


*& Module STATUS_9000 OUTPUT *

&----


  • PBO of the screen 9000 *

----


MODULE status_9000 OUTPUT.

SET PF-STATUS 'SCREEN_9000'.

SET TITLEBAR 'TITLE'.

DESCRIBE TABLE i_z000k_dfm LINES v_lines.

tc_dfmacc-lines = v_lines.

  • Put delete and modify buttons only when there are more entries

IF v_lines EQ 0.

REFRESH i_okcodes.

i_okcodes-func_code = 'MODIFY'.

APPEND i_okcodes.

i_okcodes-func_code = 'DELETE'.

APPEND i_okcodes.

i_okcodes-func_code = 'SELECTALL'.

APPEND i_okcodes.

i_okcodes-func_code = 'DESELECT'.

APPEND i_okcodes.

i_okcodes-func_code = 'EXPORT'.

APPEND i_okcodes.

SET PF-STATUS 'SCREEN_9000' EXCLUDING i_okcodes IMMEDIATELY.

ELSE.

REFRESH i_okcodes.

SET PF-STATUS 'SCREEN_9000' EXCLUDING i_okcodes IMMEDIATELY.

ENDIF. " IF v_lines EQ 0

  • To display the data in display mode.

LOOP AT tc_dfmacc-cols INTO v_dfm.

v_dfm-screen-input = '0'.

MODIFY tc_dfmacc-cols FROM

v_dfm INDEX sy-tabix.

ENDLOOP. " LOOP AT TC_TMPL_LWEIGHT-COLS

ENDMODULE. " STATUS_9000 OUTPUT

&----


*& Module USER_COMMAND_9000 INPUT *

&----


  • PAI of the screen 9000 *

----


MODULE user_command_9000 INPUT.

CASE v_okcode.

WHEN 'ENTR'.

IF sy-datar EQ c_x.

v_chgind_flag = c_x.

ENDIF. " IF sy-datar = 'X'.

  • This perform inserts records.

WHEN 'INSERT'.

CLEAR v_modify_flag.

PERFORM f_insertrows.

  • This perform is to update/insert the data.

WHEN 'SAVE'.

IF v_modify_flag = c_x.

IF sy-datar = c_x OR v_chgind_flag EQ c_x.

PERFORM f_dbchange.

ENDIF. " IF SY-DATAR = 'X'.

ELSEIF v_insert_flag = c_x.

PERFORM f_dbsave.

ENDIF. " IF v_modify_flag = c_x.

  • This perform modifys the existing data .

WHEN 'MODIFY'.

PERFORM f_modification.

  • Selects all the entries in control

WHEN 'SELECTALL'.

CLEAR fs_z000k_dfm.

LOOP AT i_z000k_dfm INTO fs_z000k_dfm.

fs_z000k_dfm-sel = c_x.

MODIFY i_z000k_dfm FROM fs_z000k_dfm

TRANSPORTING sel.

ENDLOOP. " LOOP AT i_Z000K_DFM

  • Deselects all the selected records in control

WHEN 'DESELECT'.

CLEAR fs_z000k_dfm.

LOOP AT i_z000k_dfm INTO fs_z000k_dfm.

fs_z000k_dfm-sel = space.

MODIFY i_z000k_dfm FROM fs_z000k_dfm

TRANSPORTING sel.

ENDLOOP. " LOOP AT i_Z000K_DFM

  • Delete selected entries

WHEN 'DELETE'.

CLEAR:

v_modify_flag,

v_insert_flag.

PERFORM f_dbdelete.

  • Exit from program

WHEN 'EXIT'.

LEAVE PROGRAM.

  • Leaving to selection screen

WHEN 'CANCEL' OR 'BACK'.

v_confirm_ind = 'N'.

IF sy-datar EQ c_x.

v_chgind_flag = c_x.

ENDIF. " IF sy-datar EQ c_x

IF ( v_insert_flag EQ c_x AND ( sy-datar = c_x OR

v_chgind_flag EQ c_x ) )

OR

( v_modify_flag EQ c_x AND ( sy-datar = c_x OR

v_chgind_flag EQ c_x ) ).

CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'

EXPORTING

defaultoption = 'Y'

textline1 = text-001

titel = text-002

IMPORTING

answer = v_confirm_ind.

ENDIF. " IF ( v_insert_flag EQ c_x

IF v_confirm_ind EQ 'A'.

CLEAR v_modify_flag.

ELSEIF v_confirm_ind EQ 'N'.

LEAVE TO SCREEN 0.

ENDIF. " IF v_confirm_ind EQ 'A'.

  • Insert/modify the data.

IF v_confirm_ind = 'J'.

IF v_modify_flag = c_x.

PERFORM f_dbchange.

ELSE.

PERFORM f_dbsave.

ENDIF. " IF v_modify_flag = c_x.

ENDIF. " IF v_confirm_ind = 'J'.

  • Export to Excel

WHEN 'EXPORT'.

PERFORM f_export.

ENDCASE. " CASE v_okcode.

CLEAR v_okcode.

ENDMODULE. " USER_COMMAND_9000 INPUT

&----


*& Form F_VALIDATION *

&----


  • Validate the data of new or modified entries *

----


  • There are no interface parameters to be passed to this subroutine *

----


FORM f_validation.

DATA:

l_dfmacc LIKE z000k_dfm-dfmaccount." DFM Account

REFRESH:

i_z000k_dfm_out,

i_z000k_dfm_tmp.

CLEAR:

i_z000k_dfm_out,

i_z000k_dfm_tmp.

  • Populate enterd data in internal table i_Z000K_DFM_TMP

LOOP AT i_z000k_dfm INTO fs_z000k_dfm WHERE ins EQ c_x.

i_z000k_dfm_tmp = fs_z000k_dfm.

APPEND i_z000k_dfm_tmp.

ENDLOOP. " LOOP AT i_Z000K_DFM

IF v_modify_flag EQ c_x.

  • Populate enterd data in internal table i_Z000K_DFM_TMP

LOOP AT i_z000k_dfm INTO fs_z000k_dfm WHERE sel EQ c_x.

i_z000k_dfm_tmp = fs_z000k_dfm.

APPEND i_z000k_dfm_tmp.

ENDLOOP. " LOOP AT i_Z000K_DFM

ENDIF. " IF v_modify_flag EQ c_x

i_z000k_dfm_out[] = i_z000k_dfm[].

DELETE i_z000k_dfm_out WHERE ins EQ c_x.

IF v_modify_flag EQ c_x.

DELETE i_z000k_dfm_out WHERE sel EQ c_x.

ENDIF. " IF v_modify_flag EQ c_x

SORT:

i_z000k_dfm_tmp BY dfmaccount,

i_z000k_dfm_out BY dfmaccount.

IF v_modify_flag EQ c_x OR v_insert_flag EQ c_x.

LOOP AT i_z000k_dfm_tmp.

IF l_dfmacc EQ i_z000k_dfm_tmp-dfmaccount.

v_err_flag = c_x.

MESSAGE i002(8a) WITH i_z000k_dfm_tmp-dfmaccount.

EXIT.

ENDIF. " IF lv_dfmacc EQ..

l_dfmacc = i_z000k_dfm_tmp-dfmaccount.

READ TABLE i_z000k_dfm_out WITH KEY dfmaccount =

i_z000k_dfm_tmp-dfmaccount.

IF sy-subrc EQ 0.

v_err_flag = c_x.

MESSAGE i002(8a) WITH i_z000k_dfm_tmp-dfmaccount.

EXIT.

ENDIF. " IF SY-SUBRC EQ 0

ENDLOOP. " LOOP AT i_Z000K_DFM_TMP

ENDIF. " IF v_modify_flag EQ c_x

IF v_err_flag NE c_x.

  • Check all mandatory fields are entered

PERFORM f_mand_fields.

ENDIF. " IF v_err_flag NE c_x

IF v_err_flag NE c_x.

LOOP AT i_z000k_dfm_tmp.

IF v_err_flag NE c_x.

APPEND i_z000k_dfm_tmp TO i_z000k_dfm_out.

ELSE.

EXIT.

ENDIF. " IF v_err_flag NE c_x

ENDLOOP. " LOOP AT i_Z000K_DFM_tmp

ENDIF. " IF v_err_flag NE

ENDFORM. " F_VALIDATION

&----


*& Form F_MAND_FIELDS *

&----


  • Check all the required fields are populated or not *

----


  • There are no interface parameters to be passed to this subroutine *

----


FORM f_mand_fields.

LOOP AT i_z000k_dfm_tmp.

IF i_z000k_dfm_tmp-dfmaccount IS INITIAL

OR i_z000k_dfm_tmp-dfmaccdesc IS INITIAL.

v_err_flag = c_x.

MESSAGE i055(00).

EXIT.

ENDIF. " IF i_Z000K_DFM_TMP-DFMACCOUNT

ENDLOOP. " Loop at i_Z000K_DFM_TMP

ENDFORM. " F_MAND_FIELDS

----


  • Form F_INSERTROWS *

----


  • To insert row in the internal Table i_Z000K_DFM *

----


  • There are no interface parameters to be passed to this subroutine *

----


FORM f_insertrows .

DESCRIBE TABLE i_z000k_dfm LINES v_tabix.

v_tabix = v_tabix + 1.

v_insert_flag = c_x.

tc_dfmacc-lines = tc_dfmacc-lines + 1.

CLEAR fs_z000k_dfm.

fs_z000k_dfm-ins = c_x.

INSERT fs_z000k_dfm INTO i_z000k_dfm INDEX v_tabix.

ENDFORM. " F_INSERTROWS

&----


*& Form F_DBCHANGE *

&----


  • Updates the data into zvc0_salesinfo from table control *

----


  • There are no interface parameters to be passed to this subroutine *

----


FORM f_dbchange .

  • To validate the enterd data with the other entered

  • data & with existing data

PERFORM f_validation.

IF v_err_flag NE c_x.

MODIFY z000k_dfm FROM TABLE i_z000k_dfm_tmp.

IF sy-subrc EQ 0.

MESSAGE s000(15).

CLEAR:

v_modify_flag,

v_insert_flag,

v_err_flag,

v_chgind_flag.

LOOP AT i_z000k_dfm INTO fs_z000k_dfm.

fs_z000k_dfm-sel = space.

fs_z000k_dfm-ins = space.

MODIFY i_z000k_dfm FROM fs_z000k_dfm

TRANSPORTING sel ins.

ENDLOOP. " LOOP AT i_Z000K_DFM

ELSE.

MESSAGE e531(0u) WITH text-011.

ENDIF. " IF sy-subrc EQ 0.

ENDIF. " IF v_error_flag NE c_x.

ENDFORM. " F_DBCHANGE

&----


*& Form F_DBSAVE *

&----


  • Performs validations before saving the records *

----


  • There are no interface parameters to be passed to this subroutine *

----


FORM f_dbsave .

  • To validate the enterd data with the other entered

  • data & with existing data

PERFORM f_validation.

IF v_err_flag NE c_x.

  • To insert data in database if the entered data is valid.

PERFORM f_dbupdate.

ENDIF. " IF v_err_flag NE c_x.

ENDFORM. " F_DBSAVE

----


  • Form F_DBUPDATE *

----


  • To insert or update data in database. *

----


  • There are no interface parameters to be passed to this subroutine *

----


FORM f_dbupdate .

INSERT z000k_dfm FROM TABLE i_z000k_dfm_tmp.

IF sy-subrc EQ 0.

MESSAGE s531(0u) WITH text-003.

CLEAR:

v_insert_flag,

v_err_flag.

LOOP AT i_z000k_dfm INTO fs_z000k_dfm.

fs_z000k_dfm-sel = space.

fs_z000k_dfm-ins = space.

MODIFY i_z000k_dfm FROM fs_z000k_dfm

TRANSPORTING sel ins.

ENDLOOP. " LOOP AT i_Z000K_DFM

ELSE.

MESSAGE e811(clmm) WITH text-013.

ENDIF. " IF sy-subrc EQ 0.

ENDFORM. " F_DBUPDATE

&----


*& Form F_MODIFICATION *

&----


  • To check the authority and check for the selection of record before *

  • modification *

----


  • There are no interface parameters to be passed to this subroutine *

----


FORM f_modification.

READ TABLE i_z000k_dfm INTO fs_z000k_dfm

WITH KEY sel = c_x.

IF sy-subrc NE 0.

MESSAGE s609(00).

ELSE.

CLEAR v_err_flag.

REFRESH i_z000k_dfm_out.

LOOP AT i_z000k_dfm INTO fs_z000k_dfm

WHERE sel = c_x.

i_z000k_dfm_out = fs_z000k_dfm.

APPEND i_z000k_dfm_out.

ENDLOOP. " LOOP AT i_z000k_dfm

IF v_err_flag NE c_x.

v_modify_flag = c_x.

ENDIF. " IF v_ERR_FLAG NE c_x.

ENDIF. " IF sy-subrc NE 0.

ENDFORM. " F_MODIFICATION

----


  • Form F_DBDELETE *

----


  • To delete the selected row *

----


  • There are no interface parameters to be passed to this subroutine *

----


FORM f_dbdelete .

  • DATA:

  • i_z000k_pc_dfm LIKE z000k_pc_dfm OCCURS 0

  • WITH HEADER LINE.

READ TABLE i_z000k_dfm INTO fs_z000k_dfm

WITH KEY sel = c_x.

IF sy-subrc NE 0.

MESSAGE s609(00).

ELSE.

CLEAR v_err_flag.

REFRESH i_z000k_dfm_out.

LOOP AT i_z000k_dfm INTO fs_z000k_dfm

WHERE sel = c_x.

i_z000k_dfm_out = fs_z000k_dfm.

APPEND i_z000k_dfm_out.

ENDLOOP. " LOOP AT i_z000k_dfm

  • IF NOT i_z000k_dfm_out[] IS INITIAL.

  • SORT i_z000k_dfm_out BY dfmaccount.

  • SELECT *

  • FROM z000k_pc_dfm

  • INTO TABLE i_z000k_pc_dfm

  • FOR ALL ENTRIES IN i_z000k_dfm_out

  • WHERE dfmaccount EQ i_z000k_dfm_out-dfmaccount.

*

  • IF sy-subrc EQ 0.

  • SORT i_z000k_pc_dfm BY dfmaccount.

  • LOOP AT i_z000k_dfm_out INTO fs_z000k_dfm.

  • READ TABLE i_z000k_pc_dfm WITH KEY dfmaccount =

  • fs_z000k_dfm-dfmaccount BINARY SEARCH.

  • IF sy-subrc EQ 0.

  • DELETE i_z000k_dfm_out WHERE dfmaccount =

  • fs_z000k_dfm-dfmaccount.

  • fs_z000k_dfm-sel = ''.

  • APPEND fs_z000k_dfm TO i_z000k_dfm .

  • ENDIF. " IF SY-SUBRC EQ 0

  • ENDLOOP. " LOOP AT ..

  • ENDIF. " IF SY-SUBRC EQ 0

  • ENDIF. " IF SY-SUBRC EQ 0

IF i_z000k_dfm_out[] IS INITIAL.

SORT i_z000k_dfm BY dfmaccount.

DELETE ADJACENT DUPLICATES FROM i_z000k_dfm

comparing dfmaccount.

MESSAGE e001(seudependency).

CLEAR i_z000k_dfm_out.

ELSE.

CLEAR v_confirm_ind.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = 'Warning'(010)

text_question = text-009

text_button_1 = 'Yes'

icon_button_1 = 'ICON_OKAY'

text_button_2 = 'No'

icon_button_2 = 'ICON_CANCEL'

default_button = '2'

display_cancel_button = ' '

start_column = 25

start_row = 6

popup_type = 'ICON_MESSAGE_WARNING'

IMPORTING

answer = v_confirm_ind.

IF v_confirm_ind = '1'.

DELETE z000k_dfm FROM TABLE i_z000k_dfm_out[].

IF sy-subrc EQ 0.

DELETE i_z000k_dfm WHERE sel = c_x.

sort i_z000k_dfm by dfmaccount.

MESSAGE s531(0u) WITH text-012.

ENDIF. " IF sy-subrc EQ 0.

ENDIF. " IF v_confirm_ind = '1'.

ENDIF. " IF SY-SUBRC EQ 0

ENDIF. " IF sy-subrc NE 0.

ENDFORM. " F_DBDELETE

----


  • Module F_POPULATE_DATA OUTPUT *

----


  • To populate data *

----


  • There are no interface parameters to be passed to this subroutine *

----


MODULE f_populate_data OUTPUT.

CLEAR fs_z000k_dfm.

READ TABLE i_z000k_dfm INTO fs_z000k_dfm

INDEX tc_dfmacc-current_line.

ENDMODULE. " F_POPULATE_DATA OUTPUT

----


  • Module F_ENABLE_TC OUTPUT *

----


  • Make cols in edit mode while insertion & change. *

----


  • There are no interface parameters to be passed to this subroutine *

----


MODULE f_enable_tc OUTPUT.

LOOP AT SCREEN.

IF fs_z000k_dfm-ins EQ c_x .

screen-input = 1.

ELSEIF v_modify_flag EQ c_x AND

fs_z000k_dfm-sel EQ c_x.

IF screen-name EQ 'FS_Z000K_DFM-DFMACCDESC'.

screen-input = 1.

ELSE.

screen-input = 0.

ENDIF. " IF screen-name EQ 'I_ZVC0_S..

ENDIF. " IF I_ZVC0_SALESINFO-INS EQ ..

MODIFY SCREEN.

ENDLOOP. " LOOP AT SCREEN.

ENDMODULE. " F_ENABLE_TC OUTPUT

----


  • Module F_PROCESS_DATA INPUT *

----


  • Populating the I.T i_Z000K_DFM from Table control *

----


  • There are no interface parameters to be passed to this subroutine *

----


MODULE f_process_data INPUT.

CLEAR v_err_flag.

IF v_lines EQ 0.

v_insert_flag = c_x.

fs_z000k_dfm-ins = c_x.

INSERT fs_z000k_dfm INTO i_z000k_dfm

INDEX tc_dfmacc-current_line.

ENDIF. " IF v_lines EQ 0.

MODIFY i_z000k_dfm FROM fs_z000k_dfm

INDEX tc_dfmacc-current_line.

ENDMODULE. " F_PROCESS_DATA INPUT

&----


*& Module F_SET_CURSOR OUTPUT *

&----


  • This subroutine is used to place the cursor on invalid record *

----


  • There are no interface parameters to be passed to this subroutine *

----


MODULE f_set_cursor OUTPUT.

IF v_position NE 0 .

SET CURSOR LINE v_position.

CLEAR v_position.

ENDIF. " IF v_position NE 0

ENDMODULE. " F_PROCESS_DATA INPUT

&----


*& Form F_EXPORT *

&----


  • This subroutine is used to export the data to excel *

----


  • There are no interface parameters to be passed to this subroutine *

----


FORM f_export.

  • Internal table for DFM Accounts

DATA:

BEGIN OF li_export OCCURS 0,

dfmaccount LIKE " DFM Account

z000k_dfm-dfmaccount,

dfmaccdesc LIKE " DFM Account Desc

z000k_dfm-dfmaccdesc,

END OF li_export.

  • File Path

DATA:

l_file LIKE rlgrap-filename, " File Path

l_file1 TYPE string. " File Path

  • Select all the entries into internal table

SELECT dfmaccount " DFM Account

dfmaccdesc " DFM Acc Desc

FROM z000k_dfm

INTO TABLE li_export.

IF NOT li_export[] IS INITIAL.

li_export-dfmaccount = 'DFMAccount'(004).

li_export-dfmaccdesc = 'DFM Account Desc'(005).

INSERT li_export INDEX 1.

  • Pop Window to choose file name

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = l_file.

IF NOT l_file IS INITIAL.

l_file1 = l_file.

  • Validate File path

PERFORM f_validate_file USING l_file1.

  • Export to Excel

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = l_file1

filetype = 'ASC'

write_field_separator = 'X'

TABLES

data_tab = li_export[]

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22.

IF sy-subrc NE 0.

MESSAGE e815(td) WITH space.

ENDIF. " IF SY-SUBRC EQ 0

ELSE.

MESSAGE e143(xw).

EXIT.

ENDIF. " IF SY-SUBRC EQ 0

ELSE.

MESSAGE i531(0u) WITH text-014.

ENDIF. " IF SY-SUBRC EQ 0.

ENDFORM. " F_EXPORT

&----


*& Form F_VALIDATE_FILE *

&----


  • This subroutine is used to validate the existence of local file *

----


  • -->P_LV_FILE1 File path *

----


FORM f_validate_file USING p_lv_file1 TYPE string.

DATA:

l_file TYPE string, " File path

l_res TYPE c, " Result

l_ans TYPE c. " Answer

l_file = p_lv_file1.

*To Validate given file path

CALL METHOD cl_gui_frontend_services=>file_exist

EXPORTING

file = l_file

RECEIVING

result = l_res

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

wrong_parameter = 3

OTHERS = 5.

IF sy-subrc NE 0.

MESSAGE e005(tl).

ELSE.

IF NOT l_res IS INITIAL.

CALL FUNCTION 'POPUP_CONTINUE_YES_NO'

EXPORTING

defaultoption = 'Y'

textline1 = text-015

textline2 = text-016

titel = text-017

start_column = 25

start_row = 6

IMPORTING

answer = l_ans.

IF l_ans EQ 'N'.

MESSAGE e502(ctwf).

ENDIF. " IF l_ans EQ 'N'

ENDIF. " IF NOT l_res IS

ENDIF. " IF sy-subrc NE 0

ENDFORM. " F_VALIDATE_FILE

Define a scren and plca this code

  • Process Before Output

PROCESS BEFORE OUTPUT.

MODULE status_9000.

LOOP AT i_z000k_dfm

INTO fs_z000k_dfm

WITH CONTROL tc_dfmacc

CURSOR tc_dfmacc-current_line.

MODULE f_populate_data.

MODULE f_enable_tc.

ENDLOOP. " LOOP AT i_z000k_dfm

MODULE f_set_cursor.

  • Process After Input

PROCESS AFTER INPUT.

LOOP AT i_z000k_dfm.

MODULE f_process_data.

ENDLOOP. " LOOP AT i_z000k_dfm

MODULE user_command_9000.

Design the table control using wizard.

Former Member
0 Kudos

Hi Dharmesh Vyas,

code like this in or PBO of screen.

LOOP AT t_matdet " ur internal Table.

INTO wa_matdet

WITH CONTROL ztabcon " ur table control name.

CURSOR ztabcon-current_line.

MODULE ztabcon_disable.

endloop.

then double click that module ztabcon_diable.

then -->

inside that module , code like this.

if screen-name = 'ur screen names of table control'

screen-input = 0.

endif.

modify screen.

endloop.

endif.

Then ur table control will disable as u like.

Regards.

bgan.

0 Kudos

Hi bgan,

I dont have to disable whole table field, I have to only disable those lines of table control which data can display at first time. then after If i add new line that lines are in input enable mode.

Regards,

Dharmesh

0 Kudos

Hi,

For that do like this.

Write that Disable code in Loop at table control internal table

and only in Index by 1.

thanx

bgan

0 Kudos

Hi Bgan,

Thanks for replying to this problem. Your code is a life-saver.

I had the impression that to disable a column in a table control, it is done by screen-group1 - which is wrong. To disable a column, each record in the column should be disabled.

Thanks again. Take care.

Dodie Plata

Former Member
0 Kudos

hi dharmesh ,

i have a problem in table control ,

how u hav added button for inserting row in a table control ,

my requrment is that all my pre existing field in table control should come in disabled mode ..that is working

now i want to add some more reows in the same screen , for that it requre some insert button , can u help me how to do that.

Regards

Akash