Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Menu Problem?

Former Member
0 Likes
541

Hello,

Its very very urgent task. I have created menu in PBO. and in the screen i have kept all the fields as required i.e the user should not got to next screen until he fills in all the fields in the present screen, as i kept all the fields required when i am clicking cancel the POPUP window is not displaying.

The solution that i know is to use CHAIN and ENDCHAINs but i dont know the exact syntax how to write please help with answer i mean menu should work and fields should also be in required state.

Thks

4 REPLIES 4
Read only

Former Member
0 Likes
497

CHAIN.

FIELD: Field1, Field2.

MODULE USER_COMMAND_0100.

ENDCHAIN.

Field1 and Field2 are the fields from your display - make sure you enter all the fields.

MODULE USER_COMMAND_0100.

If statement to determine if all fields are filled.

call popup.

EndModule.

Read only

0 Likes
497

Hello Sir,

Can you please given my the syntax for the if statement also.

Thks

Read only

0 Likes
497

http://help.sap.com/saphelp_46c/helpdata/EN/9f/dbaa4735c111d1829f0000e829fbfe/frameset.htm

Input Checks in Dialog Modules

You cannot perform input checks in PAI modules of programs until you have transported the contents of the input fields to the ABAP program. You can then use logical expressions to check the values that the user entered. You should then allow the user to correct any wrong entries before calling further modules.

You can do this by sending warning (type W) or error (type E) messages from PAI modules that are called in conjunction with the ABAP statements FIELD and CHAIN.

Checking Single Fields

If you send a warning or error message from a module <mod> that you called using a FIELD statement as follows:

FIELD <f> MODULE <mod>.

the corresponding input field on the current screen (and only this field) is made ready for input again, allowing the user to enter a new value. If the field is only checked once, the PAI processing continues directly after the FIELD statement, and the preceding modules are not called again.

Checking a Set of Fields

If you send a warning or error message from a module <mod> that you called using a FIELD statement as follows:

CHAIN.

FIELD: <f1>, <f 2>,...

MODULE <mod1>.

FIELD: <g1>, <g 2>,...

MODULE <mod2>.

...

ENDCHAIN.

all of the fields on the screen that belong to the processing chain (all of the fields listed in the field statements) are made ready for input again. Other fields are not ready for input. Whenever the MODULE statement appears within a processing chain, even if there is only one FIELD attached to it, all of the fields in the chain (not only the affected field) are made ready for input again, allowing the user to enter new values. If the fields in the processing chain are only checked once, the PAI processing continues directly after the FIELD statement, and the preceding modules are not called again.

Controlling Input and Data Transport

If you use the FIELD statement outside a chain, only a single field is made ready for input when a warning or error message is displayed. If you use it between the CHAIN and ENDCHAIN statements, it controls a set of fields. All of the fields controlled by a FIELD statement are transported back to the screen, bypassing PBO processing. This means that any changes made to the field contents before the message become visible on the screen. This also applies to information

Checking Fields Repeatedly

You may sometimes need to include the same field in more than one FIELD or CHAIN statement. If one of the corresponding modules sends a warning or error message, PAI processing resumes with the value that the user corrected. However, in this case, processing cannot simply resume at the corresponding FIELD or CHAIN statement if the field in question has already been included in an earlier FIELD or CHAIN statement.

Instead, all of the FIELD and CHAIN statements containing a field in which an error occurred are repeated. PAI processing resumes at the first FIELD or CHAIN statement containing a field in which an error occurred and that the user changed the last time the screen was displayed.

Example:

PROCESS AFTER INPUT.

FIELD F1 MODULE M1.

FIELD F2 MODULE M2.

CHAIN.

FIELD: F1, F2, F3.

FIELD: F4, F5, F1.

MODULE M3.

MODULE M4.

ENDCHAIN.

CHAIN.

FIELD: F6.

MODULE M5.

ENDCHAIN.

CHAIN.

FIELD F4.

MODULE M6.

ENDCHAIN.

If module M6 contains a warning or error message, the screen is displayed again, after which processing resumes with the first CHAIN statement and module M3, since this is the first occurrence of the field F4.

Remaining Functions in the FIELD Statement

All of the functions of the FIELD and CHAIN statements for controlling data transport and conditional module calls can also be used in combination with warning and error messages. The contents of each field are transported at the FIELD statement in which the field occurs. If a warning or error message occurs in a conditional module of a processing chain, all of the fields in that chain will be ready for input when the screen is redisplayed, although not all of the fields will have been transported.

If a warning or error message occurs in a module that is not linked with a FIELD or CHAIN statement, none of the fields on the screen will be ready for input. In this case, the user can only exit the program, but only as long as you have included an unconditional module call in the program.

Input Checks in Dialog Modules

PROGRAM DEMO_DYNPRO_FIELD_CHAIN.

DATA: OK_CODE LIKE SY-UCOMM,

INPUT1 TYPE I, INPUT2 TYPE I, INPUT3 TYPE I,

INPUT4 TYPE I, INPUT5 TYPE I, INPUT6 TYPE I,

SUM TYPE I.

CALL SCREEN 100.

MODULE INIT_SCREEN_100 OUTPUT.

CLEAR: INPUT1, INPUT2, INPUT3, INPUT4, INPUT5, INPUT6.

SET PF-STATUS 'STATUS_100'.

ENDMODULE.

MODULE CANCEL INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE MODULE_1 INPUT.

IF INPUT1 < 50.

MESSAGE E888(BCTRAIN) WITH TEXT-001 '50' TEXT-002.

ENDIF.

ENDMODULE.

MODULE MODULE_2 INPUT.

IF INPUT2 < 100.

MESSAGE E888(BCTRAIN) WITH TEXT-001 '100' TEXT-002.

ENDIF.

ENDMODULE.

MODULE MODULE_3 INPUT.

IF INPUT3 < 150.

MESSAGE E888(BCTRAIN) WITH TEXT-001 '150' TEXT-002.

ENDIF.

ENDMODULE.

MODULE CHAIN_MODULE_1 INPUT.

IF INPUT4 < 10.

MESSAGE E888(BCTRAIN) WITH TEXT-003 '10' TEXT-002.

ENDIF.

ENDMODULE.

MODULE CHAIN_MODULE_2 INPUT.

CLEAR SUM.

SUM = SUM + : INPUT4, INPUT5, INPUT6.

IF SUM <= 100.

MESSAGE E888(BCTRAIN) WITH TEXT-004 '100' TEXT-002.

ENDIF.

ENDMODULE.

MODULE EXECUTION INPUT.

MESSAGE I888(BCTRAIN) WITH TEXT-005.

ENDMODULE.

The next screen (statically defined) for screen 100 is itself. It has the following layout:

{{Screen can be seen on the Link listed above}}

The screen fields INPUT1 to INPUT6 are assigned to the input fields. The function code of the pushbutton is EXECUTE.

In the GUI status STATUS_100, the icon (F12) is active with function code CANCEL and function type E. Furthermore, the function key F8 is assigned to the function code EXECUTE with the function type <blank>.

The screen flow logic is as follows:

PROCESS BEFORE OUTPUT.

MODULE INIT_SCREEN_100.

PROCESS AFTER INPUT.

MODULE CANCEL AT EXIT-COMMAND.

FIELD INPUT1 MODULE MODULE_1.

FIELD INPUT2 MODULE MODULE_2.

FIELD INPUT3 MODULE MODULE_3.

CHAIN.

FIELD INPUT4.

MODULE CHAIN_MODULE_1.

FIELD INPUT5.

FIELD INPUT6 MODULE CHAIN_MODULE_2.

ENDCHAIN.

MODULE EXECUTION.

This program demonstrates how you can check input fields in dialog modules.

The fields INPUT1 to INPUT3 are checked independently of each other in the modules MODULE_1 to MODULE_3. As long as the user does not enter a corresponding value, the screen is repeatedly displayed with the appropriate field ready for input.

The fields INPUT4 to INPUT6 are checked together in a processing chain. If INPUT4 does not satisfy the condition in CHAIN_MODULE_1, all three fields are again ready for input. The same applies if the three fields do not satisfy the condition in CHAIN_MODULE_2.

The EXECUTION module, from which an information message is displayed, is not executed until all six fields satisfy the appropriate conditions.

Read only

Former Member
0 Likes
497

Hi,

When you put your fields as REQUIRED, then the other functionalities dont work unless until you fill all the required fields.

For that you need to use this MODULE under PAI.

PAI.

MODULE EXIT AT EXIT-COMMAND.

code in that module.

module.

case okcode.

when 'cancel'.

call popup.

endcase.

endmodule.

Regarding Chain and endchain.

When you entr the wrong value in any of the fields, then renmaining fields will be in display mode.(means you cant enter the values in remaining fields).

So, for that you can do like this.

pai.

CHAIN.

field : field1, field2.

module validate.

endchain.

Code for this module.

module.

do validation for the field here.

if you enter wrong value display error message here.

so that, remaing fields will be change mode only.

endmodule.

Regards

Sandeep reddy