Monday, September 26, 2016

Call Subscreen in SAP

CALL SUBSCREEN
  • A subscreen is an independent screen that is displayed in an area of another ("main") screen.
  • Subscreens allow you to embed one screen within another at runtime. You can include multiple sub-screens on main screen.
To use a subscreen, you must follow three simple steps
  1. Define the subscreen area(s) on a screen
  2. Define suitable subscreen screens
  3. Include the subscreen screen in the subscreen area.
EXAMPLE
For instance here we have defined two sub-screen areas on main screen and have attached two different Sub-screen to corresponding areas. Whenever main screen is called, the PBO of main screen is called. But before display, the PBO's of each screen attached with sub-screen areas on main screen are also called.
sap-subscreen
To include a subscreen screen in the subscreen area of the main screen and call its PBO flow logic, use the following statement in the PBO event of the main screen:
PROCESS BEFORE OUTPUT.
CALL SUBSCREEN <area> INCLUDING [<prog>] <dynp>.
This statement assigns the subscreen screen with number <dynp> to the subscreen area called <area>. You can also specify the program in which the subscreen screen is defined (optional). If you do not specify the program explicitly, the system looks for the subscreen screen in the same ABAP program as the main program. The PBO flow logic of the subscreen screen is also included at the same point. This can call PBO modules of the ABAP program in which the subscreen screen is defined. At the end of the subscreen PBO, the global fields from the program are passed to any identically-named screen fields in the subscreen screen. The PBO flow logic of the subscreen screen can itself include further subscreens.
The name <area> of the subscreen area must be entered directly without inverted commas. You can specify the names <prog> and <dynp> either as literals or variables. If you use variables, you must declare and fill identically-named variables in the ABAP program. The screen number <dynp> must be 4 characters long. If you do not assign a subscreen screen to an area, it remains empty.
To call the PAI flow logic of the subscreen screen, use the following statement in the PAI flow logic of the main screen:
PROCESS AFTER INPUT.
CALL SUBSCREEN <area>.
This statement includes the PAI flow logic of the subscreen screen included in the subscreen area <area> in the PBO event. This can call PAI modules of the ABAP program in which the subscreen screen is defined. Data is transported between identically-named fields in the subscreen screen and the ABAP program either when the PAI event is triggered, or at the corresponding FIELD statements in the PAI flow logic of the subscreen screen.

Points to Remember
  • You should not have OK_CODE or FCODE attached with sub-screen. The OK_CODE of main screen itself is OK_CODE of sub-screen
  • Sub-screens cannot have any dialog modules containing SET TITLEBAR, SET PF-STATUS, SET SCREEN, LEAVE SCREEN or LEAVE TO SCREEN. This will cause runtime error.
  • You need to call it in the flow logic (both PBO and PAI) of the main screen.
  • CALL SUBSCREEN is not allowed in CHAIN..ENDCHAIN and LOOP ENDLOOP statements
  • Can not have an AT EXIT-COMMAND module
  • The fields that you use are the global fields. They must be declared in the top include
  • If using subscreens from another dialog program the data transfer will not happen unless you add specific code.

No comments:

Post a Comment

SAP giới thiệu mã hỗ trợ AI trong ngôn ngữ ABAP riêng của mình

SAP đã ra mắt một loạt tính năng mã hỗ trợ AI trong môi trường phát triển ứng dụng dựa trên đám mây của mình, đồng thời tham gia vào danh sá...