Application Development and Automation 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: 
Read only

Reg : Module pool Table control - disabling and enabling row wise

Former Member
0 Likes
2,275

Dear Techies,

I have a Table control, I want to made some part of Row should be grayed out (Disable) and the other is Enable.

let say in my Table control I have 5 records.

each record has 10 columns and the first 4 fields I want to disable and the other 6 will be enable mode.

here the example

SNO PR No PR Item-no Quantity Price "asume this is the Table control

1 100001 10 5 500/-

2 100002 10 7 1600/-

3 100002 20 3 1500/-

I will enter PR no, PR-item, Qty and Price and if saved it one Unique no is generating through SNRO.

Once it is saved I want to grayed out PR No, PR Item-no and the rest of two fields are enable mode.

also I can able to add 4 th row, 5 th row and so on.

I have assigned a Group for the above fields in Screen and I loop that screen in PBO also I made Screen-input = 0.

first I have read those inputs in in PAI and I used like DESCRIBE TABLE ITAB lines lv_var.

if lv_var is not initial.

tablecontrolname-lines = lv_var.

endif.

clear lv_var.

In the above case I can able to disable all remining empty lines other than what I entered but I want to disable some portion of line should be disable and the other will be enable.

Please suggest and Tnks in advance.

Regards

valluru

5 REPLIES 5
Read only

Kiran_Valluru
Active Contributor
0 Likes
1,228

Hi,

try this,


*data declaration
controls tbc type tableview using screen 100.  " tbc is table control name
data cols like line of tbc-cols.

*PAI
module user_command_0100 input.
    IF  sy-ucomm = ' '.   " ok code for enter.
      LOOP AT tbc-cols into cols where index le 2.   " here index le 2 means how many columns you want to make display 
" if you want to make first 4 columns display mode then use index le 4. 
" check if the column value is not initial
         cols-screen-input = '0'. 
           MODIFY tbc-cols FROM cols INDEX sy-tabix.
      ENDLOOP.

    ENDIF.

    endmodule.

hope this helps u.,

Thanks & Regards,

Kiran

Read only

0 Likes
1,228

Hi Kiran tnks for the inputs,

I have tried like what you said, but it is not working. I think the Enabling and Disabling will come in PBO instead of PAI. anyhow I have checked in both.

I have written code as below

if gv_code = ' '.

if lifnr is NOT INITIAL.

loop at tbc_9001-cols into cols where index le 2.

IF COLS-SCREEN-GROUP2 = 'GP2'.

COLS-SCREEN-input = '0'.

MODIFY tbc_9001-COLS FROM COLS INDEX SY-TABIX.

ENDIF.

ENDLOOP.

endif.

endif.

Can U suggest any other ways.

@ Nabheet tnks for valid inputs,

If I used ur code it will disabling complete column, but I need what ever the lines User is entering those lines has to be Disabled and also he can able to enter further inputs in the same column.

let me know if U have any idea to meat my requirement. tnks in advance.

Regards,

valluru

Edited by: vallurukishore on Dec 12, 2011 2:20 PM

Read only

0 Likes
1,228

Hi,

no need to use this statement.,

IF COLS-SCREEN-GROUP2 = 'GP2'.

also put a break point and check..

i guess it is not if lifnr is not initial.. put a break point there and check..

hope this helps u.,

Thanks & Regards,

Kiran

Read only

Former Member
0 Likes
1,228

Hi Kishore,

Assign group name to the fields in your table control columns and then based on your requirement write screen logic using screen group

place code between

loop at <itab> with control <table control>.

module screen.

end loop.

module screen.

loop at screen.

endloop.

endmodule.

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,228

Hi

do as follow.Put a module inPBO inside loop endloopof table contorl.

As table control will loop for each record you can now modify individual cells and rows. Let say i want display only 1 to 4 columns rest input enabled

LOOP AT SCREEN.
IF SCREEN-NAME EQ 'COL1'
OR SCREEN-NAME EQ 'COL2'
OR SCREEN-NAME EQ 'COL3'
OR SCREEN-NAME EQ 'COL4'
SCREEN-INPUT  = 0.
ELSE.
SCREEN-INPUT = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.

Use the above logic to control your display.

Nabheet