Author: Christian Gradolf
Last saved by: Michael Kahl

ProNovia Produkte Korrekturanleitung
Knowledge Base ID / Version | CFM-203 / V8.0.2
Ausgabe Korrekturanleitung | I / MK / 09.11.2022
Farblegende Korrekturen | INSERT | REPLACE THIS | REPLACE WITH | DELETE

Include | /PRONOVIA/LPRMOBDF11
Form | GET_TEXTPOOL_TEXT

FORM get_textpool_text
  USING    iv_textpool TYPE csequence
           iv_key TYPE csequence
  CHANGING ev_text TYPE csequence.

  STATICS:
      st_textpool         TYPE textpool_table
    .

  DATA:
      lv_key              TYPE textpoolky
    .

  FIELD-SYMBOLS:
      <ls_text>           LIKE LINE OF st_textpool
    .

  CLEAR ev_text.

  IF st_textpool IS INITIAL.
    READ TEXTPOOL iv_textpool INTO st_textpool LANGUAGE sy-langu.
    DELETE st_textpool WHERE id <> 'I'.
    SORT st_textpool BY key.
  ENDIF.

  lv_key = iv_key.
  READ TABLE st_textpool ASSIGNING <ls_text> WITH KEY lv_key BINARY SEARCH.
  IF sy-subrc IS INITIAL.
    ev_text = <ls_text>-entry.
  ENDIF. 
>>>REPLACE WITH
  "MK/CFM-203 - komplett überarbeitet

  TYPES:
      BEGIN OF ts_textpool_cache
    ,   progname                    TYPE progname
    ,   textpool                    TYPE SORTED TABLE OF textpool
                                    WITH UNIQUE KEY key
    , END OF ts_textpool_cache
    .

  STATICS:
      st_textpool                   TYPE SORTED TABLE OF ts_textpool_cache
                                    WITH UNIQUE KEY progname
    .

  DATA:
      lt_textpool                   TYPE textpool_table
    .

  FIELD-SYMBOLS:
      <ls_textpool>                 LIKE LINE OF st_textpool
    .

  CLEAR ev_text.

  ASSIGN st_textpool[ progname = iv_textpool ] TO <ls_textpool>.
  IF sy-subrc IS NOT INITIAL.
    READ TEXTPOOL iv_textpool INTO lt_textpool LANGUAGE sy-langu.
    DELETE lt_textpool WHERE id <> 'I'.

    INSERT VALUE #(
      progname = iv_textpool
      textpool = VALUE #( FOR <ls_t> IN lt_textpool ( <ls_t> ) )
    ) INTO TABLE st_textpool ASSIGNING <ls_textpool>.
  ENDIF.

  ev_text = VALUE #( <ls_textpool>-textpool[ key = CONV #( iv_key ) ]-entry OPTIONAL ). 
>>>END REPLACE
ENDFORM.

<ENDE>

ProNovia Produkte Korrekturanleitung		Template  Version B.00