Best practice to show custom fields on dynpro?

1.4k views Asked by At

I am assigned to implement new custom fields. The possible entries have to be selected from a value table. The value table holds the key and a explaning text. The dynpro is build like that:

Input for new field (zzfield) | Output-only field for explaining text. (zzfield_text)

What I want my dynpro to do:

  • a) Show text in output field based on entered key
  • b) Update text after ENTER/SAVE from user
  • c) Update text directly after a new key has been selected from the value table

My current solution is this:

" in the dynpro
PROCESS BEFORE OUTPUT.
  MODULE GET_ZZFIELD_TEXT.

" in the module
DATA: zzfield_text TYPE string.
SELECT SINGLE text
  FROM value_table
  INTO zzfield_text
  WHERE zzfield = mara-zzfield.

This works well for the cases a) and b) I have listed above. However, beeing in a PBO, it does not work for case c). My colleage suggested to use something like this:

" in the dynpro
PROCESS AFTER INPUT.
  field: zzfield MODULE get_zzfield_text_pai ON REQUEST.

I can not duplicate my code in the module get_zzfield_text_pai, because the of the DATA declaration of zzfield_text. It is reported to be unknown in the PAI (besides it is already defined in the PBO module) but it is also reported to be duplicated if I declare it again in the PAI. Further, I dont know how to implement new global fields into my function group. Using another include creates again issues of that zzfield_text beeing unknown.

In general, I am not happy about my solution and would be very thankfull for each suggestion about how to code this feature.

0

There are 0 answers