‎2007 Sep 14 5:23 AM
Hi Gurus,
How to call multiple screens in module pool programming I mean I want two screens one is like selection screen there I need to give two parameters for ex sales order and item number (both are parameters not select-options).if I press execute button(F8) then I need to display eight fields in the second screen with data based on the values entered in the first screen. Any need to design two screens or can I design first screen as normal selection screen. Please help me how to write the logic for this I mean how to use PBO PAI events properly. If possible please send me sample code to do this. Please help me.
Thanks a lot to all.
‎2007 Sep 14 5:46 AM
Hi Babji
you can do it .Please Try to use this code to call another screen.
CALL SCREEN 200 STARTING AT 1 1 ENDING AT 80 8.
starting at is the top left corner of another screen and endding at is the below right corner of the screen.
Regards
Wiboon
‎2007 Sep 14 5:49 AM
Hi,
U have to design two screen . take first normal screen here define one subscreen area. and selection option or parameter whatever u want for selection.
now difine second screen as a subscreen. here post ur output fields.
in first screen PAI write ur coding.
Regards,
‎2007 Sep 14 5:54 AM
Hi,
Thanks a lot for your reply. If possible please send me the sample code because i am new to module pool. can i create normal screen instead of subscreen. If possible please send me the sample code.
Thanks a lot for your help.
‎2007 Sep 14 6:12 AM
HI,
in this below example i have 2 screens.
in the first i have two input/output fields N1 and N2,3 push buttons(BACK,NEXT,CLEAR)
if i click on the next button it will go to the second screen.the second screen has one I/O field result(i am passing the addition of the two fields in the first screen to this result) and a push button(BACK).
<b>code:</b>
REPORT ZBHMOD1 .
DATA:OKCODE1 LIKE SY-UCOMM,
OKCODE2 LIKE SY-UCOMM.
DATA:N1(10) TYPE N,N2(10) TYPE N,RES(12) TYPE N.
MODULE USER_COMMAND_1000 INPUT.
CASE OKCODE1.
WHEN 'NEXT'.
RES = N1 + N2.
SET SCREEN 1001.
WHEN 'CLEA'.
CLEAR:N1,N2.
WHEN 'BACK'.
SET SCREEN '0'.
ENDCASE.
ENDMODULE. " USER_COMMAND_1000 INPUT
MODULE STATUS_1000 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'TIT1'.
ENDMODULE. " STATUS_1000 OUTPUT
MODULE USER_COMMAND_1001 INPUT.
CASE OKCODE2.
WHEN 'BACK'.
SET SCREEN 1000.
ENDCASE.
ENDMODULE. " USER_COMMAND_1001 INPUT
MODULE STATUS_1001 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'TIT2'.
ENDMODULE. " STATUS_1001 OUTPUT
<b>FLOW LOGIC:</b>
PROCESS BEFORE OUTPUT.
MODULE STATUS_1000.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1000.
PROCESS BEFORE OUTPUT.
MODULE STATUS_1001.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1001.
rgds,
bharat.
‎2007 Sep 14 5:51 AM
Hi,
U can fulfill ur requirement by both the way, means by designing two seperate screens as well one one screen.
1). If u want to design 2 seperate screens then design them and in the PAI event of the first write the codign to call the second screen.
And In PBO of the second screen do the code for displaying the data as per the privious screens input.
2). If u want to do all these things into the same screen then use the concept of subscreen.
At the starting time both the subscreens are displayed and when u fill the input and press button, then the second subscreen get filled by data.
Means the filling of data done when u press the button so for that u have to write the code into the PAI.
‎2007 Sep 14 6:36 AM
Hello Babji,
I dont think for your requirement any module pool programing is need.
I am attaching a sample code below copy paste in se38 and see if that is what you want.
I have used ALV to display 9 fields based on the selection screen criteria where I used 2 parameter statement.
************************************************************************************
TABLES: ekbe.
TYPE-POOLS : slis. "ALV Declarations
TYPES :BEGIN OF t_outtab,
ebeln LIKE ekbe-ebeln, "Purchase order number
ebelp LIKE ekbe-ebelp, "Item Number of Purchasing Document
belnr LIKE ekbe-belnr, "Number of Material Document
buzei LIKE ekbe-buzei, "Item in Material Document
bewtp LIKE ekbe-bewtp, "PO history category
menge LIKE ekbe-menge, "Quantity
dmbtr LIKE ekbe-dmbtr, "Amount in local currency
matnr LIKE ekbe-matnr, "Material Number
werks LIKE ekbe-werks, "Plant
END OF t_outtab.
PARAMETERS : p_ebeln TYPE ekbe-ebeln,
p_budat TYPE ekbe-budat.
DATA : i_outtab TYPE STANDARD TABLE OF t_outtab.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
&----
*& Form BUILD_FIELDCATALOG
&----
Build Fieldcatalog for ALV Report
----
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'Material Document Number'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'BELNR'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'BUZEI'.
fieldcatalog-seltext_m = 'Item in Material Document'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'BEWTP'.
fieldcatalog-seltext_m = 'PO History category'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'DMBTR'.
fieldcatalog-seltext_m = 'Amount'.
fieldcatalog-col_pos = 6.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 7.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'WERKS'.
fieldcatalog-seltext_m = 'Plant'.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
&----
*& Form BUILD_LAYOUT
&----
Build layout for ALV grid report
----
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-info_fieldname = 'LINE_COLOR'.
ENDFORM. " BUILD_LAYOUT
&----
*& Form DISPLAY_ALV_REPORT
&----
Display report using ALV grid
----
FORM display_alv_report.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
TABLES
t_outtab = i_outtab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISPLAY_ALV_REPORT
&----
*& Form DATA_RETRIEVAL
&----
Retrieve data form EKBE table and populate itab i_outtab
----
FORM data_retrieval.
DATA: ld_color(1) TYPE c.
SELECT ebeln ebelp belnr buzei bewtp menge dmbtr matnr werks FROM ekbe
INTO TABLE i_outtab WHERE ebeln = p_ebeln
AND budat = p_budat.
ENDFORM. " DATA_RETRIEVAL
********************************************************************************************
Please award points if it is useful.
Regards,
Bhanu
‎2007 Sep 14 6:41 AM
Hi,
Thanks for your reply but i can not use alv because i don't want the output in alv format. Any way thanks for your help.