10-23-2010 11:40 AM
Hi experts,
I have written a module pool program. I have provided a drop down list say field name is 'Name'.
and the first column is ID.
if id occurs for four consecutive times then and if i am selecting names for the same id i.e. for 1 then it sould allow to select from drop down list.
if i am selecting names again in second row for the same id i.e. 1 then it sould not allow to select from drop down list.
if am selecting different than previous name for same id then it should aloow to change.
id Name
1 XYZ
1 " FOR SECOND ROW IT SHOULD NOT ALLOW TO SELECT
1
1
2 ABC if i want to change this, then it should aloow me to change
2
2
2
plz help.
Your response will be highly appreciated.
Regards,
Ashmita
10-24-2010 6:50 AM
hi,
I hope my query is clear...
Is there anybody who can provide the solution.
Tel me if there is any standard program for such requirement.
thnks n regards,
Ashmita
10-24-2010 6:50 AM
hi,
I hope my query is clear...
Is there anybody who can provide the solution.
Tel me if there is any standard program for such requirement.
thnks n regards,
Ashmita
10-25-2010 5:18 AM
Hi Ashmita,
If you assigned the FCODE for the dropdown ? If yes then do this in the field validation i.e in flow logic
" This code in flow logic
Loop at it.
field : name module validate_name on request.
ENDloop
" This is in the module
module validate_name.
data : wa like it.
Read table it into wa with key id = it-id
name = it-name.
if sy-subrc eq 0.
message e000(8i) with 'Same name not allowed'.
endif.
endmodule.
Regards,
Madhukar Shetty
10-25-2010 9:33 AM
Hi Madhukar,
thnks a lot,
but how wuold i restrict user not to select another entry say in next three row for same id?
User may change first row name but should not be able to select entries in next rows for same id.
Regards,
Ashmita?
10-25-2010 12:58 PM
Hi Ashmita,
Try this code make changes according to ur program by follow my logic , hope it helps you
"" This is in Flow logic
PROCESS BEFORE OUTPUT.
* MODULE STATUS_0500.
*
LOOP AT it_tc WITH CONTROL tc CURSOR tc-current_line.
MODULE screen_change. " Add this module
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT it_tc.
field it_tc-mat. " This the field of list box assgn FCODE fr this in screen painter
MODULE modify.
ENDLOOP.
MODULE validate. " Add this module
MODULE user_command_0500.
This is code for Module
MODULE validate INPUT.
DATA : wa LIKE it_tc,
* wmatnr LIKE it_tc-matnr,
flag.
BREAK-POINT.
SORT it_tc BY matnr.
LOOP AT it_tc INTO wa .
AT NEW matnr.
IF wa-mat IS NOT INITIAL.
flag = 'X'.
ENDIF.
ENDAT.
IF flag EQ 'X'.
CLEAR flag.
ELSE.
it_tc-screen = 'X'.
clear it_tc-mat.
MODIFY it_tc TRANSPORTING mat screen. "Add this SCREEN field in ur internal table to identify which row to be eabled and disbaled
ENDIF.
ENDLOOP.
ENDMODULE. " VALIDATE INPUT
MODULE screen_change OUTPUT.
IF it_tc-screen = 'X'.
LOOP AT SCREEN.
IF screen-name EQ 'IT_TC-MAT'.
" change the field of NAME to display mode
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDMODULE. " SCREEN_CHANGE OUTPUT
Regards,
Madhukar Shetty
10-27-2010 8:24 AM