‎2009 Jul 20 10:14 AM
Hello Guys,
I have a problem on screen dynpro. In the screen, i have a table control and i set all the field can be input.
But i have 2 t-code where 1 of the t-code can edited the data and another one only display.
So in screen status, i insert this code.
IF sy-tcode = 'ZDLKWPP3'.
LOOP AT SCREEN.
IF screen-group1 = 'ZKP'.
screen-input = 0.
screen-output = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
but when i execute, the screen still can be input. can anyone help me please...!!!!
‎2009 Jul 20 10:24 AM
Hi,
Try this
IF sy-tcode = 'ZDLKWPP3'.
LOOP AT SCREEN.
IF screen-group1 = 'ZKP'.
screen-invisible = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
Rgds
Siva
‎2009 Jul 20 10:26 AM
Hi,
Check this way..
IF sy-tcode = 'ZDLKWPP3'.
LOOP AT SCREEN.
IF screen-group1 CS 'ZKP'.
screen-input = '0'.
screen-output = '1'.
MODIFY SCREEN.
CLEAR SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
‎2009 Jul 20 10:35 AM
Hi,
If you are talking about disabling the table control fields, then where exactly have you written this code? Inside the LOOP...ENDLOOP of the table control or inside a module outside of the table control? You gotto write this inside the LOOP...ENDLOOP of the table control.
Otherwise try what Avinash has suggested.
Edited by: Nitwick on Jul 20, 2009 3:05 PM
‎2009 Jul 20 10:55 AM
Hi Bob,
First of all, write the code in PBO, not PAI ( I am sure you must have already done that )
Secondly, try to combine all the screen modification operations in a single IF ... ELSEIF ... ENDIF structure.
Lastly, also mention the condition explicitly for the other T-Code as well.
Check this code:
IF sy-tcode = 'ZDLKWPP3'.
LOOP AT SCREEN.
IF screen-group1 = 'ZKP'.
screen-input = 0.
ELSEIF screen-group1 = 'XYZ'.
<enter code here>
ELSEIF ....
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF sy-tcode = 'ZXYZ123' "Other T-code
LOOP AT SCREEN.
IF screen-group1 = 'ZKP'.
screen-input = 1.
ELSEIF screen-group1 = 'XYZ'.
<enter code here>
ELSEIF ....
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
Hope this helps!
Cheers,
Shailesh.
‎2009 Jul 20 11:04 AM
That coding i put it in "MODULE STATUS 0300." Those are the coding for the screen and the module status.
*************--code for the screen----******************
PROCESS BEFORE OUTPUT.
MODULE STATUS_0300.
*&spwizard: pbo flow logic for tablecontrol 'TBL_KWPP'
module TBL_KWPP_init.
*&spwizard: module TBL_KWPP_change_tc_attr.
*&spwizard: module TBL_KWPP_change_col_attr.
module TBL_KWPP_change_tc_attr.
loop at g_TBL_KWPP_itab
into g_TBL_KWPP_wa
with control TBL_KWPP
cursor TBL_KWPP-current_line.
*&spwizard: module TBL_KWPP_change_field_attr
module TBL_KWPP_move.
module TBL_KWPP_get_lines.
endloop.
module cal_sum2.
*
PROCESS AFTER INPUT.
MODULE returnexit AT EXIT-COMMAND.
*&spwizard: pai flow logic for tablecontrol 'TBL_KWPP'
loop at g_TBL_KWPP_itab.
chain.
field ZLMDL015A-ZRUMJEN.
field ZLMDL015A-ZRUMFAED.
field ZLMDL015A-ZRUMULA.
field ZLMDL015A-ZRUMAKH.
field ZLMDL015A-ZRUMAMB.
field ZLMDL015A-ZRUMTERIMA.
field ZLMDL015A-ZRUMBAYARAN.
field ZLMDL015A-ZRUMAMNOM.
field G_TBL_KWPP_WA-FLAG
MODULE tab_vot_mark1 ON REQUEST.
MODULE TBL_KWPP_modify ON CHAIN-REQUEST.
endchain.
endloop.
module TBL_KWPP_user_command.
*&spwizard: module TBL_KWPP_change_tc_attr.
*&spwizard: module TBL_KWPP_change_col_attr.
MODULE USER_COMMAND_0300.
*******---code for the module status---**********
MODULE STATUS_0300 OUTPUT.
SET PF-STATUS '0300'.
* SET TITLEBAR 'TITLE3' WITH 'Wujud/Kemaskini'.
* zlmfl030-zlmtkhlaras = w_ztksej.
*
perform set_tarikh.
* perform find_data.
IF sy-tcode = 'ZDLKWPP1'.
SET TITLEBAR 'TITLE' WITH 'Wujud/Kemaskini'.
SET PF-STATUS '0300'.
ELSE.
SET TITLEBAR 'TITLE' WITH 'Papar'.
SET PF-STATUS '0300' EXCLUDING 'SAVE'.
endif.
IF sy-tcode = 'ZDLKWPP3'.
LOOP AT SCREEN.
IF screen-group1 CS 'ZKP'.
screen-input = 0.
screen-output = 1.
MODIFY SCREEN.
CLEAR SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDMODULE. " STATUS_0300 OUTPUT
and as you can see i try ashavind code, it still not working.
‎2009 Jul 20 11:58 AM
Hi BobKur,
Try this way.
<li> Check the demo program demo_dynpro_tabcont_loop_at.
I hope that it solves your problem.
Thanks
Venkat.O
"Define cols internal table like below
DATA: cols LIKE LINE OF tbl_kwpp-cols.
"Use below code to change screen elements dynamically when you use Table control
IF sy-tcode = 'ZDLKWPP3'.
LOOP AT tbl_kwpp-cols INTO cols.
IF screen-group1 CS 'ZKP'.
cols-screen-input = 0.
MODIFY tbl_kwpp-cols FROM cols INDEX sy-tabix.
ENDIF.
ENDLOOP.
ENDIF.
‎2009 Jul 20 12:04 PM
Hi,
Try putting the portion of code to disable the fields inside the LOOP...ENDLOOP of the table control in the PBO.
‎2009 Jul 21 3:18 AM
Venkat.O, i already check on the demo program DEMO_DYNPRO_TABCONT_LOOP_AT. But the in that screen, it already make those field to output only. The field in my table control i make it that it can input too. That program have 2 t-code. T-code = 'ZDLKWPP1' user can input to the screen and another t-code = 'ZDLKWPP3' need to make those field for output only.
So i now trying to make 1 screen that can accept input and be output only according to the t-code.
Venkat.O, i also try to do with you coding, but it still doesn't work.
Nickwit, do u mean that to put the code into the Loop in the coding screen? it is still not waorking....
‎2009 Jul 21 3:20 AM
DId you add the screen group in the element list of the screen.
‎2009 Jul 21 3:31 AM
Yes i already add screen gorup of the field in the element list. I also forget to tell you guys that the field of the screen i make it 'Input is possible' at the element list.
‎2009 Jul 21 3:52 AM
Hi BobKur,
Try this.
<li> It should work now.
<li>Put break-point on LOOP AT tbl_kwpp-cols statement and check whether it has your table control fields or not.
Thanks
Venkat.O
DATA: cols LIKE LINE OF tbl_kwpp-cols.
"Use below code to change screen elements dynamically when you use Table control
IF sy-tcode = 'ZDLKWPP3'. "For Display only
LOOP AT tbl_kwpp-cols INTO cols.
cols-screen-input = '0'.
MODIFY tbl_kwpp-cols FROM cols INDEX sy-tabix.
ENDLOOP.
ELSE. "For Input only
LOOP AT tbl_kwpp-cols INTO cols.
cols-screen-input = '1'.
MODIFY tbl_kwpp-cols FROM cols INDEX sy-tabix.
ENDLOOP.
ENDIF.
‎2009 Jul 21 5:07 AM
hey guys i already found the anwer. the only thing is i need to move the module status to bottom of the PBO. then it will work. by the way thanks to all that really helping me on it.
Thank You..