‎2009 Aug 04 6:39 AM
Hi All,
I am developing a Modulepool screen in which i have 3 input fields. The data of these 3 fields has to be saved into a Ztable.
I have push buttons Add - to add new record.
Modify - to modify the record.
Display- to display the record in uneditable mode.
Here i am able to add a record into the Ztable but when i am trying to modify the record is not getting updated in the ztable.
can some one tell me how to modify the record in Modulepool and how to display a record in uneditable mode.
‎2009 Aug 04 6:54 AM
Hi,
If you are using MODIFY statement, it should work. please confirm. if still it is not working, please show me the code.
for making fields noneditable, giv mod. group 'G1' to all the 3 IO boxes.
then write the below code in a pbo module.
IF ok_code EQ 'DISPLAY.
LOOP AT SCREEN.
IF SCREEN-GROUP1 EQ 'G1'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
Edited by: Renjith Munnilath on Aug 4, 2009 7:55 AM
‎2009 Aug 04 6:49 AM
Hi,
You can update the database table by using MODIFY statement.
MODIFY Ztable FROM TABLE internal_table.first you need to check whether the record exists or not.
SELECT SINGLE empno
FROM ztable
INTO local_variable
WHERE empno = <screen_field_name_for_empno>.
IF sy-subc = 0. "record exists
update using MODIFY
ELSE.
insert new record.
ENDIF.To make the fields for output purpose (non editable) you need to select the output only box in the attributes window of the field.
Or in PBO
CASE sy-ucomm.
WHEN 'F_DISPLAY'.
LOOP AT SCREEN.
IF screen-group = 'G1'.
screen-input = 0.
MODIFY SCREEN.
ENDIF
ENDLOOP.
ENDCASE.Revert if you need further help.
Thanks,
Sri.
‎2009 Aug 04 6:54 AM
Hi,
If you are using MODIFY statement, it should work. please confirm. if still it is not working, please show me the code.
for making fields noneditable, giv mod. group 'G1' to all the 3 IO boxes.
then write the below code in a pbo module.
IF ok_code EQ 'DISPLAY.
LOOP AT SCREEN.
IF SCREEN-GROUP1 EQ 'G1'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
Edited by: Renjith Munnilath on Aug 4, 2009 7:55 AM
‎2009 Aug 04 7:02 AM
‎2009 Aug 04 7:12 AM
Hi,
case sy-ucomm.
when 'ADD'.
select single cyno
from zmp01
into i_cyno
where cyno = zmp01-cyno.
if sy-subrc = 0.
message e000(zmsg).
else.
MOVE zmp01-cyno TO wa-cyno.
MOVE zmp01-ipdate TO wa-ipdate.
MOVE zmp01-opdate TO wa-opdate.
INSERT zmp01 FROM wa. " here zmp01-cyno, zmp01-ipdate , zmp01-opdate are the screen field names
endif.
when 'DISPLAY'.
select single *
from zmp01
into local_variable
where cyno = zmp01-cyno.
if sy-subrc = 0.
Display.
endif.Thanks,
Sri.
‎2009 Aug 04 7:18 AM
Hi,
i guess cyno is the key in your table.
when 'MODIFY'.
select single cyno
from zmp01 into i_cyno
where cyno = zmp01-cyno.
if sy-subrc = 0.
modify zmp01 . "This should work
endif.
in MODULE STATUS_0100 OUTPUT, write the code i mentioned in the previous post.
Thanks,
Renjith.
‎2009 Aug 04 10:15 AM
Hi Renjith,
I am not able to make the fields uneditable when i click on display and i have one more problem when i press on modify the first 2 fileds i.e, cyno & ipdate should be uneditable only the field opdate should be allowed to enter.
‎2009 Aug 04 12:24 PM
Hi Sudhir,
I'm really for late reply.. i was offline for some time.
I guess Sri had already answered your doubt. If not.. let me try.
Please write this in your PBO module:
CASE OK_CODE.
WHEN 'DISPLAY'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 EQ 'G1'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
WHEN 'MODIFY'.
LOOP AT SCREEN.
IF SCREEN-NAME EQ 'ZMP01-IPDATE'. " Like this you can mention IF conditions for which ever screen field you want to make non editable.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Thanks,
Renjith.
NB:- Hi Sri.. good support.
‎2009 Aug 04 12:53 PM
‎2009 Aug 04 10:16 AM
‎2009 Aug 04 10:46 AM
Hi,
Copy paste this code. I hope it works.
As you have 3 buttons
Add, Modify and Display.
Let the function codes be F_ADD, F_MOD, F_DIS respectively and zmp01-cyno, zmp01-ipdate , zmp01-opdate be the screen field names.
In PAI
data : i_cyno TYPE zmp01-cyno.
CASE sy-ucomm.
WHEN 'F_ADD'.
select single cyno
from zmp01
into i_cyno
where cyno = zmp01-cyno.
if sy-subrc EQ 0.
message 'cyno already exists' TYPE 'E'.
else.
MOVE zmp01-cyno TO wa-cyno.
MOVE zmp01-ipdate TO wa-ipdate.
MOVE zmp01-opdate TO wa-opdate.
INSERT zmp01 FROM wa.
endif.
WHEN 'F_MOD'.
select single cyno
from zmp01
into i_cyno
where cyno = zmp01-cyno.
IF sy-subrc = 0.
MOVE zmp01-cyno TO wa-cyno.
MOVE zmp01-ipdate TO wa-ipdate.
MOVE zmp01-opdate TO wa-opdate.
APPEND wa to i_zmp01. "i_zmp01 is internal table and wa is the work area.
modify zmp01 from table i_zmp01.
ELSE.
MESSAGE 'cyno does not exist' TYPE 'E'.
ENDIF.
WHEN 'F_DIS'.
select single cyno
from zmp01
into i_cyno
where cyno = zmp01-cyno.
IF sy-subrc = 0.
select single *
from zmp01
into wa
where cyno = zmp01-cyno.
IF sy-subrc = 0.
zmp01-cyno = wa-cyno.
zmp01-ipdate = wa-ipdate.
zmp01-opdate = wa-opdate.
ENDIF.
ELSE.
MESSAGE 'cyno does not exist' TYPE 'E'.
ENDIF.
ENDCASE.Thanks,
Sri.
‎2009 Aug 04 11:02 AM
Hi Sri,
I have done with this..But when i click on display i want the ipdate & opdate fields to be disabled so tat we cant change the values in those fields and also when i click on modify the ipdate should be disabled and the value should be displayed in it bcoz the user will will be entering cyno & ipdate at a time and he may enter opdate later on.
‎2009 Aug 04 11:11 AM
Hi,
>
> when i click on display i want the ipdate & opdate fields to be disabled so tat we cant change the values in those fields.
Do this in display.
WHEN 'F_DIS'.
select single cyno
from zmp01
into i_cyno
where cyno = zmp01-cyno.
IF sy-subrc = 0.
select single *
from zmp01
into wa
where cyno = zmp01-cyno.
IF sy-subrc = 0.
LOOP AT SCREEN.
IF screen-group = 'G1'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
zmp01-cyno = wa-cyno.
zmp01-ipdate = wa-ipdate.
zmp01-opdate = wa-opdate.
ENDIF.
ELSE.
MESSAGE 'cyno does not exist' TYPE 'E'.
ENDIF.>
> and also when i click on modify the ipdate should be disabled and the value should be displayed in it bcoz the user will will be entering cyno & ipdate at a time and he may enter opdate later on.
did not get. Please explain.
Thanks,
Sri.
‎2009 Aug 04 11:46 AM
The user will be entering cyno & ipdate at a time and then may be after some days he may enter opdate field. so when he want to enter opdate,he enters the cyno and press modify then ipdate which was entered already should be displayed in dispaly mode and opdate field can be entered at this time.
‎2009 Aug 04 11:58 AM
Hi,
So you want cyno and ipdate also to be non editable during modify. Do like this in modify
In PBO.
WHEN 'F_MOD'.
LOOP AT SCREEN.
IF screen-group = 'G1'.
screen-input = 0.
modify screen.
ENDIF.
ENDLOOP.Also I am sorry, in the previous post write the loop at screen...endloop part in PBO under WHEN 'F_DIS'.
Thanks,
Sri.