Application Development 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: 

Update costumer fields of CI_PRPS in PAI of screen exit or in EXIT_SAPLCJWB_005 ?

hagit
Active Participant
0 Kudos

Hello Experts,

I need to update some customer fields which are in CI_PRPS. Those fields are in screen exit 0700 and so are shown in CJ20N.

I have 2 options to write the code:

1. In the PAI of screen 700

2. In EXIT_SAPLCJWB_005 (which is called from the PAI of screen 1215)

Both are working.

Which is the better option?

Thank you in advanced

Hagit

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
  1. Add a TABLES definition for CI_PRPS (or PRPS, CNCI_PRPS if other fields required in your implementation) to the TOP include of the exit function group, Include ZXCN1TOP, so implicit moves will occur between this buffer and your customer dynpro fields at PBO/PAI steps
  2. In the EXIT_SAPLCJWB_004, include ZXCN1U21, move relevant fields from import parameters to this area (and save also display mode parameter to use later in PBO)
  3. In the EXIT_SAPLCJWB_005, include ZXCN1U22, move back fields of the buffer area to the export parameter
* ZXCN1TOP
TABLES CI_PRPS.
DATA display_only.
* ZXCN1U21
display_only = sap_display_only.
MOVE-CORRESPONDING cnci_prps_imp TO ci_prps.
* ZXCN1U22
MOVE-CORRESPONDING ci_prps to cnci_prps_exp.
17 REPLIES 17

hagit
Active Participant
0 Kudos

Does anyone have an answer?

former_member196280
Active Contributor

After add the custom fields to structure CI_PRPS ensure you write code in the function exit includes

Code should be written inside both Function Exit (Includes)

a) EXIT_SAPLCJWB_004

INCLUDE ZXCN1U21

MOVE-CORRESPONDING sap_prps_imp TO prps.

b) EXIT_SAPLCJWB_005

INCLUDE ZXCN1U22

move-corresponding prps to cnci_prps_exp.

The custom fields are automatically appended in all the structures that are used above.

Regards,

SaiRam

0 Kudos

sairamreddy.neelapu Thanks for your answer.

Do you think that it is better to use the exit function (as you showed above) than to use the PAI of the exit screen (700) , which includes the custom fields?

raymond_giuseppi
Active Contributor
  1. Add a TABLES definition for CI_PRPS (or PRPS, CNCI_PRPS if other fields required in your implementation) to the TOP include of the exit function group, Include ZXCN1TOP, so implicit moves will occur between this buffer and your customer dynpro fields at PBO/PAI steps
  2. In the EXIT_SAPLCJWB_004, include ZXCN1U21, move relevant fields from import parameters to this area (and save also display mode parameter to use later in PBO)
  3. In the EXIT_SAPLCJWB_005, include ZXCN1U22, move back fields of the buffer area to the export parameter
* ZXCN1TOP
TABLES CI_PRPS.
DATA display_only.
* ZXCN1U21
display_only = sap_display_only.
MOVE-CORRESPONDING cnci_prps_imp TO ci_prps.
* ZXCN1U22
MOVE-CORRESPONDING ci_prps to cnci_prps_exp.

0 Kudos

raymond.giuseppi Thanks for your answer.

Do you think that it is better to use the exit function (as you showed above) than to use the PAI of the exit screen (700) , which includes the custom fields?

0 Kudos

Using the exit is the best practice, you will get the whole sap process including change documents and the like.

0 Kudos

raymond.giuseppi ,

Could you please clarify what do you mean by ' you will get the whole sap process including change documents and the like ' ?

Thank you

Hagit

0 Kudos

Standard behavior for lock management, update task to update database, change document, LUW consistency...

(I hope you were not planning to execute some sql statements in the screen's PAI)

0 Kudos

raymond.giuseppi

I understand that the update of DB fields |(and the fetch of DB fields into screen fields) should be in the exit as you showed the code above .

* ZXCN1TOP

TABLES CI_PRPS.

DATA display_only.

* ZXCN1U21

display_only = sap_display_only.

MOVE-CORRESPONDING cnci_prps_imp TO ci_prps.

* ZXCN1U22

MOVE-CORRESPONDING ci_prps to cnci_prps_exp.
Now I want to add a code that
updates the screen fields. For example

If ci_prps-zfld1 = 5.

ci_prps-zfld2 = 7.

The question is – Is that code should be also in the exit or in the PAI of the subscreen 700?

Thank you

Hagit

0 Kudos

Put that kind of code In a MODULE of the PAI of the subscreen, check before that you are not in display mode.

0 Kudos

raymond.giuseppi Thank you so much for your answer.

Sorry for the delay in my response (I was ill).

How can I check if the screen is in a display mode?

Thanks

Hagit

0 Kudos

Check if the saved value of sap_display_only is not initial, if so, set screen-input to 0 in a LOOP AT SCREEN in the PBO of your client dynpro.

Take care of yourself.

0 Kudos

raymond.giuseppi Sorry for the delay in my response (I am still ill).

Why is it important to check if the screen is in in display mode? I just want to change the value of ci_prps-zfld2 according to the value of ci_prps-zfld1.

Thanks

Hagit

0 Kudos

By modifying the data read from the database, while the user is in "display" mode and the database will therefore not be updated, you deceive the user into thinking that the data is consistent.

0 Kudos

raymond.giuseppi Thank you for your answer

I run CJ20N in display mode and notice that

  • 1. The screen fields in the subscreen (including ZFLD2) are dim and are not enterable.
  • 2. The subscreen's PAI is executed (after pressing enter) but the ZFLD2 is not updated.

So ,it seems to me that the check (if it is a display mode) is unnecessary (the field is not updated in DB nor in the screen).

What do you think?

Thanks

Hagit

0 Kudos

The field may be updated in the PAI but at following PBO the data from main program will overwrite any change, so that's okay (but dirty)

0 Kudos

raymond.giuseppi Thank you for your great help.

Hagit