Skip to Content
author's profile photo Former Member
Former Member

chain and end-chain

Hi

why v use chain and end-chain in module program ?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 08, 2008 at 09:11 AM

    hi,

    If you want to ensure that more than one field is ready for input following an error dialog, you must list all

    of the relevant fields in the FIELD statement, and include both that and the MODULE statement in a

    CHAIN … ENDCHAIN block.

    You can include individual fields in more than one CHAIN … ENDCHAIN block.

    Note that the FIELD statement does not only make the field ready for input again; it also means that field contents changed during the current PAI processing are only visible if the field in question was also included in the FIELD statement of the current CHAIN block.

    The system transports data from screen fields into the ABAP fields with the same name in the PAI

    processing block. First, it transports all fields that are not contained in any FIELD statements. The

    remaining fields are transported when the system processed the relevant FIELD statement.

    If an error or warning message occurs in a module belonging to a FIELD statement, the current values of

    all fields in the same CHAIN structure are automatically transported back into their corresponding screen

    fields.

    <REMOVED BY MODERATOR>

    Edited by: Runal Singh on Apr 8, 2008 2:42 PM

    Edited by: Alvaro Tejada Galindo on Apr 8, 2008 1:40 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 08, 2008 at 09:12 AM

    If you want to ensure that more than one field is ready for input following an error dialog, you must list all

    of the relevant fields in the FIELD statement, and include both that and the MODULE statement in a

    CHAIN … ENDCHAIN block.

    You can include individual fields in more than one CHAIN … ENDCHAIN block.

    Note that the FIELD statement does not only make the field ready for input again; it also means that field

    contents changed during the current PAI processing are only visible if the field in question was also

    included in the FIELD statement of the current CHAIN block.

    If the system sends an error or warning message, the current screen is sent again, but the PBO is not

    processed again.

    Only the fields to which the module is assigned are ready for input again.

    After the user has entered new values, the PROCESS AFTER INPUT module is not completely

    reprocessed, but restarted somewhere within the processing block.

    The system finds out which field the user changed and resumes processing at the first corresponding

    FIELD statement.

    If the user merely confirms a warning message (without changing the field’s contents), the system

    restarts the PAI processing after the MESSAGE statement where the error was triggered.

    example code

    
    PROCESS AFTER INPUT.
    CHAIN.
    FIELD: <<FFiieelldd nnaammee 11>>,
    <Field name 2>,
    .
    .
    .
    <<FFiieelldd nnaammee nn>>..
    MODULE check
    
    
    
    PROCESS AFTER INPUT.
    FIELD A MODULE check_A.
    FIELD B MODULE check_B.
    CHAIN.
    FIELD: C,D.
    MODULE check_CD.
    ENDCHAIN.
    CHAIN.
    FIELD: C,B.
    MODULE check_CB.
    ENDCHAIN.
    
    

    <REMOVED BY MODERATOR>

    Edited by: sharad narayan on Apr 8, 2008 11:13 AM

    Edited by: Alvaro Tejada Galindo on Apr 8, 2008 1:40 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 08, 2008 at 09:14 AM

    Hi,

    Conditions for Multiple Screen Fields

    To ensure that one or more PAI modules are only called when several screen fields meet a particular condition, you must combine the calls in the flow logic to form a processing chain. You define processing chains as follows:

    CHAIN.

    ...

    ENDCHAIN.

    All flow logic statements between CHAIN and ENDCHAIN belong to a processing chain. The fields in the various FIELD statements are combined, and can be used in shared conditions.

    CHAIN.

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

    MODULE <mod1> ON CHAIN-INPUT|CHAIN-REQUEST.

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

    MODULE <mod2> ON CHAIN-INPUT|CHAIN-REQUEST.

    ...

    ENDCHAIN.

    The additions ON CHAIN-INPUT and ON CHAIN-REQUEST work like the additions ON INPUT and ON REQUEST that you use for individual fields. The exception is that the module is called whenever at least one of the fields listed in a preceding FIELD statement within the chain meets the condition. So <mod1> is called when one of the fields <fi> meets the condition. <mod2> is called when one of the fields <f i> or <g i> meets the condition.

    Within a processing chain, you can combine individual FIELD statements with a MODULE statement to set a condition for a single field within the chain:

    CHAIN.

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

    FIELD <f> MODULE <mod1> ON INPUT|REQUEST|*-INPUT

    |CHAIN-INPUT|CHAIN-REQUEST.

    MODULE <mod2> ON CHAIN-INPUT|CHAIN-REQUEST.

    ENDCHAIN.

    The module <mod1> is called when screen field <f> meets the specified condition for individual fields. <mod2> is called when one of the fields <fi> or <f> meets the condition. If you use the addition ON CHAIN-INPUT or ON CHAIN-REQUEST with FIELD <f>, the condition also applies to the entire chain and module <mod1> and <mod2> are both called.

    In cases where you apply conditions to various combinations of screen fields, it is worth setting up a separate processing chain for each combination and calling different modules from within it.

    The functions of the FIELD statement for controlling data transport also apply when you use processing chains. Within a processing chain, screen fields are not transported until the FIELD statement. Processing chains also have another function for the FIELDS statements that they contain. This is described in the section on validity checks.

    Ex:

    PROCESS AFTER INPUT.

    MODULE CANCEL AT EXIT-COMMAND.

    CHAIN.

    FIELD: INPUT1, INPUT2.

    MODULE MODULE_1 ON CHAIN-INPUT.

    FIELD INPUT3 MODULE MODULE_* ON *-INPUT.

    MODULE MODULE_2 ON CHAIN-REQUEST.

    ENDCHAIN.

    FIELD INPUT1 MODULE C1 AT CURSOR-SELECTION.

    CHAIN.

    FIELD: INPUT2, INPUT3.

    MODULE C2 AT CURSOR-SELECTION.

    ENDCHAIN.

    MODULE CURSOR AT CURSOR-SELECTION.

    <REMOVED BY MODERATOR>

    Edited by: Alvaro Tejada Galindo on Apr 8, 2008 1:41 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 08, 2008 at 09:14 AM

    we can perform validations on screen fields in flow logic using FIELD statement. if there are group of fields to be validated and we enter an wron value in one field then only that particular fiels will be enabled and rest disabled for input.

    if the user wants to enter all the values again the we group them between chain and endchain

    example

    PAI

    field sflight-carrid values = ('LH').

    field sflight-connid values = ( '0400' '0500' ).

    if the user enter wron connid value only that field will be enbled for input and the rest diabled.

    but if we put them between chain and endchain like this

    PAI

    chain.

    field sflight-carrid values = ('LH').

    field sflight-connid values = ( '0400' '0500' ).

    endchain.

    if the user enter wron connid value

    all the fields are enabled for input again

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 08, 2008 at 09:24 AM

    hi there.,,,

    Check the below link

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

    The statements CHAIN and ENDCHAIN of the dynpro flow logic define processing chains. Between CHAIN and ENDCHAIN, the statements FIELD and MODULE can be executed. The statements between CHAIN and ENDCHAIN form a processing chain. Processing chains cannot be nested. The CHAIN statement can be specified in the event blocks at PAI and PBO , however, in the event block at PBO it has no effect.

    A processing chain allows the joint processing of all the screen fields stated between CHAIN and ENDCHAIN after FIELD statements:

    The contents of all screen fields combined to a processing chain by the FIELD statements can be checked in the shared conditions ON CHAIN-INPUT and ON CHAIN-REQUEST of the MODULE statement.

    A warning or error message in a module called within a processing chain resets all input fields whose screen fields are combined in this processing chain using FIELD statements to ready-for-input. After a user input, the PAI processing resumes at the CHAIN statement at the latest.

    Example

    Call dialog modules to check input values. The screen fields input1 and input2 are checked in individual dialog modules check_1 and check_2. The screen fields input3 to input5 are checked in a processing chain in a shared dialog module check_chain. Warning or error messages in the dialog modules either make only one input field input1 or input2 ready for input again or all three input fields input3 to input5.

    PROCESS AFTER INPUT.

    MODULE leave_dynpro AT EXIT-COMMAND.

    FIELD input1 MODULE check_1 ON REQUEST.

    FIELD input2 MODULE check_2 ON REQUEST.

    CHAIN.

    FIELD input3.

    FIELD input4.

    FIELD input5.

    MODULE check_chain ON CHAIN-REQUEST.

    ENDCHAIN.

    MODULE handle_user_command.

    In PAI if you want to validate group of fields put in

    chain and End chain statement .

    You can declare fields in the chain enchain .

    CHAIN.

    FIELD chk_ABC.

    FIELD chk_DEF.

    FIELD chk_GHI.

    FIELD CHK-JKL.

    MODULE CHK_screenfields.

    ENDCHAIN.

    below is an example:

    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.

    <REMOVED BY MODERATOR>

    rekha.

    <REMOVED BY MODERATOR>

    rekha

    Edited by: Alvaro Tejada Galindo on Apr 8, 2008 1:43 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 08, 2008 at 12:35 PM

    Hi,

    validations r done in Chain--endchain process.

    Regards,

    durgaprasad

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 08, 2008 at 03:20 PM

    Hi,

    If the validation has to be done for more than one field then

    those fields are included between chanin and endchain.

    Thank u ,

    Manjula devi.D

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.