‎2008 Aug 14 8:35 AM
Hi all,
I have to develop one module pool program which will have two screens.The first screen is for selecting data and the second screen is for create,change and display data using table control.I have to create three transactions to maintain the custom table.One transaction is for creating entry in the custom table,One transaction is for changing entry in the custom table,One transaction is for displaying entry in the custom table.
In case of creating entry the transaction will hit the second screen directly.In the second screen the user will create entry and save the entry and that will update the custom table.
In case of change entry the transaction will hit the first screen.In this screen the user enter valid data and hit the enter button.Then the second screen will be opened in editable mode.Then the user will make the changes and will save it.
In case of display entry the transaction will hit the first screen.In this screen the user enter valid data and hit the enter button.Then the second screen will be opened in display mode.the user will can only view the fields.
Can any one suggest how to do this development?
Waiting for your replies.
Regards
Raj
‎2008 Aug 14 8:40 AM
Dear,
catch in ok_code the screen number and call screen as per your requirement.
Thanks,
jaten
‎2008 Aug 14 8:48 AM
Hi....
Create two screens...
First screen with DISPLAY, CREATE, CHANGE pushbuttons and if you want arrange some input parameters.
Second screen with one table control, and ENTER push button.
Now..,
>To Display entries..,
1. Run transcation.
2. Give input parameter and click on DISPLAY.
3. you can get 2 nd sreen with entries,
>To Create entries..,
1. Run transcation.
2. Give input parameter and click on CREATE.
3. you can get 2 nd sreen with empty table control,
4. Enter the records, click on SAVE
>To Chage entries..,
1. Run transcation.
2. Give input parameter and click on CHANGE.
3. you can get 2 nd sreen table control entries,
4. Modify the records, click on SAVE
This is Better...
Try like this,
Search forums on this concept...
Get back if you need any further logic...
Thanks,
Naveen.I
‎2008 Aug 14 8:54 AM
Hi Raj ,
For the module pool you are planning to do , follow this proces :
1> Create a module pool program and design the 2 required screens along with the logic .
2> Create mode : create a transaction ( Ex: Z_create ) and provide the screen number of the 2nd screen .
( As you need to directly make entries in 2nd screen) . In the flow logic of the 2nd screen , write the logic for saving these recently entered values in the DB ).
3> EDIT amd DISPLAY MODE : create 2 separate transactions for EDIT and DISPLAY modes , and give the 1st screen number in the initial screen field and even provide the module pool program name .And then Based on the operation call the 2nd screen when needed .
4> Based on the transaction , make the required fields editable ( for Edit mode ) and non editable ( for Display mode ) write the corresponding logic for these in both the screens .
The above logic is a very generic logic for creating transactions in 3 modes .
Reply if any fuether help needed ..
Regards,
Ranjita
‎2008 Aug 14 8:59 AM
hi,
we will see the scenario one by one..
let the 2 screens be 100 and 101.
Now,let the Ok-codes be CHAN,DISP,CRET for change,display,create resp.
the code will be as follows to call the resp. screens.
Case sy-ucomm.
when 'CHAN'.
call screen 100.
(now you can write your code in that screens)
when 'DISP'.
call screen 100.
when 'CRET'.
call screen 101.
endcase.
Now you will also have to modify the attributes of the screen like when you want to change the fields that you require to change should be editable and incase of display all the fields should be non-editable.
Hope this helps.
if you need more information feel free to ask.
Thanks,
Rashmi.
‎2008 Aug 14 9:53 AM
Hi,
U can do so my creating a module pool program with two screens, say 1000, 2000
On one screen jus give the required fields and on the other make the table control.
Now create three transactions say 'CREATE', 'CHANGE', 'DISPLAY'.
Now write the following logic in the PBO of the first screen.
case sy-tcode.
when 'CREATE'.
CALL SCREEN 2000.
when 'CHANGE'.
CALL SCREEN 1000.
when 'DISPLAY'.
CALL SCREEN 1000.
ENDCASE.
for keeping the fields in the display mode when display transaction is run u need to write the following code in the PBO of the first screen.
WHEN 'DISPLAY'.
LOOP AT SCREEN.
IF screen-name CS ' wa_EKKO'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
where wa_ekko will be the work area assigned to the respective fields.
*I have worked on such an application and the code is as under,
I think this will fulfill all your requirements....*
&----
*& Include ZPOSTGROUP03O01
&----
&----
*& Module STATUS_0300 OUTPUT
&----
text
----
MODULE status_0300 OUTPUT.
SET PF-STATUS 'STATUS2'.
CASE sy-tcode.
To disable the change and display buttons in create transaction.
WHEN 'ZCREATE03'.
SET TITLEBAR 'TITLE'.
LOOP AT SCREEN.
IF screen-name = 'CHANGE' OR screen-name = 'DISPLAY'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
To disable the create and display buttons in change transaction .
WHEN 'ZCHANGE03'.
SET TITLEBAR 'TITLE01'.
LOOP AT SCREEN.
IF screen-name = 'CREATE' OR screen-name = 'DISPLAY'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
To disable the change and create buttons in display transaction .
WHEN 'ZDISPLAY03'.
SET TITLEBAR 'TITLE02'.
LOOP AT SCREEN.
IF screen-name = 'CREATE' OR screen-name = 'CHANGE'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDCASE.
ENDMODULE. " STATUS_0300 OUTPUT
&----
*& Module STATUS_0400 OUTPUT
&----
text
----
MODULE status_0400 OUTPUT.
SET PF-STATUS 'STATUS1'.
SET TITLEBAR 'TITLE'.
SETTING TITILE BAR FOR DIFFERENT SCREENS
CASE ok_code .
WHEN 'CREATE'.
SET TITLEBAR 'TITLE' .
WHEN 'CHANGE'.
SET TITLEBAR 'TITLE01' .
WHEN 'DISPLAY'.
SET TITLEBAR 'TITLE02'.
ENDCASE.
Make the PO no in second screen non-editable.
LOOP AT SCREEN.
IF screen-name = 'ZGROUP03EKKO-EBELN'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
*NO of line in table control .
DESCRIBE TABLE lineitem LINES lin.
tablecontrol1-lines = lin.
DESCRIBE TABLE scheduleline LINES lin2.
tablecontrol2-lines = lin2.
ENDMODULE. " STATUS_0400 OUTPUT
&----
*& Module STATUS_0401 OUTPUT
&----
text
----
MODULE status_0401 OUTPUT.
*In display fetch the data into table.
CASE ok_code.
WHEN 'DISPLAY'.
SELECT SINGLE * FROM zgroup03ekko INTO zgroup03ekko WHERE ebeln =
zgroup03ekko-ebeln.
LOOP AT SCREEN.
IF screen-name CS 'ZGROUP03EKKO'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
*In Change mode
WHEN 'CHANGE'.
SELECT SINGLE * FROM zgroup03ekko INTO zgroup03ekko WHERE ebeln =
zgroup03ekko-ebeln.
WHEN 'CREATE'.
netvalue = 0.
LOOP AT lineitem.
netvalue = netvalue + lineitem-netvalue1 .
ENDLOOP.
ENDCASE.
ENDMODULE. " STATUS_0401 OUTPUT
&----
*& Module lineitem_control OUTPUT
&----
text
----
MODULE lineitem_control OUTPUT.
De-activating the add,delete,selectall,deselectall buttons for the
display transaction .
CASE sy-tcode.
WHEN 'ZDISPLAY03'.
LOOP AT SCREEN.
IF screen-name EQ 'SELECT_ALL' OR screen-name EQ 'DESELECT_ALL' .
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
LOOP AT SCREEN.
IF screen-name EQ 'ADD' OR screen-name EQ 'DELETE'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDCASE.
ENDMODULE. " lineitem_control OUTPUT
&----
*& Module edit_lineitem OUTPUT
&----
text
----
MODULE edit_lineitem OUTPUT.
CASE sy-tcode.
To make all the fields in the screen non-editable in the transaction
to create.
WHEN 'ZCREATE03'.
IF lin <> 0.
LOOP AT SCREEN.
IF screen-name CS 'LINEITEM' AND
screen-name NE 'LINEITEM-EBELP' AND
screen-name NE 'LINEITEM-MATNR' AND
screen-name NE 'LINEITEM-MENGE' AND
screen-name NE 'LINEITEM-WAERS' AND
screen-name NE 'LINEITEM-MARK'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
To make the added line editable
IF lineitem IS INITIAL.
screen-input = 1.
ENDIF.
ENDLOOP.
To make the remaining table(lineitem) remain in the non-editable mode
ELSE.
LOOP AT SCREEN.
IF screen-name CS 'LINEITEM'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
To make all the fields in the screen non-editable in the transaction
to change.
WHEN 'ZCHANGE03'.
IF lin <> 0.
LOOP AT SCREEN.
IF screen-name CS 'LINEITEM' AND
screen-name NE 'LINEITEM-EBELP' AND
screen-name NE 'LINEITEM-MATNR' AND
screen-name NE 'LINEITEM-MENGE' AND
screen-name NE 'LINEITEM-WAERS' AND
screen-name NE 'LINEITEM-MARK'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
To make the added line editable
IF lineitem IS INITIAL.
screen-input = 1.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-name CS 'LINEITEM'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
To make all the fields in the screen non-editable in the transaction
to display.
WHEN 'ZDISPLAY03'.
LOOP AT SCREEN.
IF screen-name CS 'LINEITEM'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDCASE.
ENDMODULE. " edit_lineitem OUTPUT
&----
*& Module scheduleline_control OUTPUT
&----
text
----
MODULE scheduleline_control OUTPUT.
CASE sy-tcode.
WHEN 'ZDISPLAY03'.
LOOP AT SCREEN.
IF screen-name EQ 'SELECT_ALL' OR screen-name EQ 'DESELECT_ALL'.
screen-active = 0.
Changes the attributes belonging to the current screen field while
processing
MODIFY SCREEN.
ENDIF.
ENDLOOP.
LOOP AT SCREEN.
IF screen-name EQ 'ADD' OR screen-name EQ 'DELETE'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDCASE.
ENDMODULE. " scheduleline_control OUTPUT
&----
*& Module edit_scheduleline OUTPUT
&----
text
----
MODULE edit_scheduleline OUTPUT.
CASE sy-tcode.
To make all the fields in the screen non-editable in the transaction
to create.
WHEN 'ZCREATE03'.
IF lin2 <> 0.
LOOP AT SCREEN.
IF screen-name CS 'SCHEDULELINE' AND
screen-name NE 'SCHEDULELINE-EBELP' AND
screen-name NE 'SCHEDULELINE-ETENR' AND
screen-name NE 'SCHEDULELINE-MENGE' AND
screen-name NE 'SCHEDULELINE-EINDT' AND
screen-name NE 'SCHEDULELINE-MARK1'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
if screen-name = 'SCHEDULELINE-MARK1' .
SCREEN-INPUT = 1 .
ENDIF .
To make the added line editable
IF scheduleline IS INITIAL.
screen-input = 1.
ENDIF.
To make the added line editable
IF SCREEN-NAME EQ 'SCHEDULELINE-EBELP' .
SCREEN-INPUT = 0 .
MODIFY SCREEN .
ENDIF .
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-name CS 'SCHEDULELINE'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
LOOP AT lineitem.
IF lineitem-mark EQ 'X'.
scheduleline-ebelp = lineitem-ebelp.
ENDIF.
ENDLOOP.
To make all the fields in the screen non-editable in the transaction
to change.
WHEN 'ZCHANGE03'.
IF lin2 <> 0.
LOOP AT SCREEN.
IF screen-name CS 'SCHEDULELINE' AND screen-name NE
'SCHEDULELINE-EBELP' AND
screen-name NE 'SCHEDULELINE-ETENR' AND screen-name NE
'SCHEDULELINE-MENGE' AND
screen-name NE 'SCHEDULELINE-EINDT' AND screen-name NE
'SCHEDULELINE-MARK1'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
To make the added line editable
IF scheduleline IS INITIAL.
screen-input = 1.
ENDIF.
To make item no field inactive .
IF SCREEN-NAME EQ 'SCHEDULELINE-EBELP' .
SCREEN-INPUT = 0 .
MODIFY SCREEN .
ENDIF .
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-name CS 'SCHEDULELINE'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
To make all the fields in the screen non-editable in the transaction
to display.
WHEN 'ZDISPLAY03'.
LOOP AT SCREEN.
IF screen-name CS 'SCHEDULELINE'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDCASE.
ENDMODULE. " edit_scheduleline OUTPUT
Please get back if still any doubts...
Regards,
Manish