ABAP Subscreens Tutorial: Call Subscreen in SAP
Subscreens in SAP ABAP are a powerful feature that allows
you to display multiple screens within a single screen. This functionality is
particularly useful when you want to break down complex processes into smaller,
manageable parts, or when you need to present related information together. In
this tutorial, we will learn how to call subscreens in SAP and how to pass data
between the main screen and the subscreen.
the Subscreen: The first step is to create a subscreen in the ABAP Dictionary.
Go to the transaction code SE51 and select the "Subscreen" option.
Define the subscreen attributes like the number, name, and screen type. You can
design the subscreen using the Screen Painter, just like you do for regular
the Main Screen: Next, create the main screen that will contain the subscreen.
Use the Screen Painter (SE51) to design the main screen and leave space where
you want the subscreen to appear. Assign a unique screen number to the main
Subscreen Area: To call the subscreen in the main screen, define a subscreen
area. Go to the main screen's flow logic, and declare a subscreen area using
the following syntax: INCLUDE
Values to the Subscreen: Before calling the subscreen, you may need to pass
some values from the main screen. Declare the variables in the main screen's
PBO (Process Before Output) module. To pass values to the subscreen, assign the
values to the corresponding subscreen field using the following syntax:
the Subscreen: In the main screen's PBO module, write the logic to call the
subscreen using the following syntax: CALL SUBSCREEN
the Subscreen Data: When the subscreen is called, the control is transferred to
the subscreen. Process the data on the subscreen, and if required, perform
validations and calculations.
to the Main Screen: After the processing on the subscreen is complete, use the
following syntax to return to the main screen: LEAVE TO SCREEN
the Main Screen: In the main screen's PAI (Process After Input) module, write
the logic to display the main screen with the updated data after returning from
User Input: In the main screen's PAI module, handle user input and process the
data as per your application requirements. If you need to call the subscreen
again based on specific conditions, use the statement CALL SUBSCREEN
and Testing: To ensure that the subscreen integration works as expected, set
breakpoints and debug the main screen and subscreen processing. Test different
scenarios and validate the data flow between the main screen and the subscreen.
A subscreen is a free screen that is shown in a space of another ("principal") screen. Subscreens permit you to insert one screen inside one more at runtime. You can remember numerous sub-evaluates for primary screen. The term subscreen applies both to the screen that you implant, and the region on the principal screen in which you place it. This instructional exercise is about subscreen regions. The genuine screens made through SE51 exchange, are called subscreen screens in the event that characterized in screen credits. At the point when you utilize a subscreen, the stream rationale of the implanted screen is likewise installed in the stream rationale of the primary screen. Hence, Using subscreens on screens is like utilizing remembers for ABAP programs.
To utilize a subscreen, you should follow three straightforward advances
Characterize the subscreen area(s) on a screen
Characterize reasonable subscreen screens
Incorporate the subscreen screen in the subscreen region.
Likewise, you want to change the edge of sub-screen and fundamental screen. You want to name it in the field name field.Further, you likewise need to change the fields inside the subscreen to cause them to show up in primary screen. On the off chance that the sub-screen is characterized to be bigger than the accessible region in the principal screen, just the piece of subscreen will be noticeable that fits in the region accessible. The region is constantly estimated from the upper left corner of screen. Thus you ought to take sufficient consideration while characterizing sub-screen regions and making sub-screens.
|Experience the difference
For example here we have characterized two sub-screen regions on primary screen and have connected two different Sub-screen to comparing regions. At the point when principal screen is called, the PBO of fundamental screen is called. Be that as it may, before show, the PBO's of each screen joined with sub-screen regions on fundamental screen are likewise called.
ABAP Subscreens Tutorial: Call Subscreen in SAP
You can incorporate a subscreen screen involving the CALL SUBSCREEN proclamation in the stream rationale of the fundamental screen To incorporate a subscreen screen in the subscreen region of the primary screen and call its PBO stream rationale, utilize the accompanying assertion in the PBO occasion of the principal screen: This assertion doles out the subscreen screen with number
To call the PAI stream rationale of the subscreen screen, utilize the accompanying assertion in the PAI stream rationale of the principal screen:
This assertion incorporates the PAI stream rationale of the subscreen screen remembered for the subscreen region in the PBO occasion. This can call PAI modules of the ABAP program in which the subscreen screen is characterized. Information is shipped between indistinguishably named fields in the subscreen screen and the ABAP program either when the PAI occasion is set off, or at the relating FIELD proclamations in the PAI stream rationale of the subscreen screen.
Focuses to Remember
Names of components of sub-screens inside a screen ought to be novel
You shouldn't have OK_CODE or FCODE connected with sub-screen. The OK_CODE of primary screen itself is OK_CODE of sub-screen
Sub-screens can't have any exchange modules containing SET TITLEBAR, SET PF-STATUS, SET SCREEN, LEAVE SCREEN or LEAVE TO SCREEN. This will cause runtime mistake.
You really want to call it in the stream rationale (both PBO and PAI) of the primary screen.
CALL SUBSCREEN isn't permitted in CHAIN..ENDCHAIN and LOOP ENDLOOP articulations
Can not have an AT EXIT-COMMAND module
The fields that you use are the worldwide fields. They should be announced in the top incorporate
In the event that utilizing subscreens from another discourse program the information move won't occur except if you add explicit code.
Conclusion: Using subscreens in SAP ABAP can significantly enhance the user experience and improve the organization of complex processes. By following this tutorial, you have learned how to create and call subscreens in SAP, as well as how to pass data between the main screen and the subscreen. With this knowledge, you can now design more efficient and user-friendly SAP applications that leverage the power of subscreens.