Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8644

Re: Creating a longtext

$
0
0

Hello Sandra,

 

the user EXIT is called while creating actions. it is defined as preassigning maintenance notification actions with default values! User Exit is EXIT_SAPMIWO0_021!

 

I did some further debugging alreade and i handled to make the text displayable after performing user exit. So when you hit longtext button the default is displayed.

 

The problem is that INIT_TEXT was called and cleared the text i created with SAVE_TEXT in the user exit depending on ABAP Memory parameter.

When export ITX1 is filled with the text header of the new created text xou can display it. So i think i am missing some registration for this transaction at any point. I can fill it manually, but the text also will not be stored to database with the new message number.


So maybe the form you mentioned is not called! But i can't figure out why!?!


Source coude:


Data: LT_lines    type STANDARD TABLE OF TLINE,
       l_text_name TYPE TDOBNAME,
       ls_header   TYPE THEAD,
       l_function  type char1.

DATA: BEGIN OF LTXHEAD OCCURS 25.      "Langtext-Köpfe
         INCLUDE STRUCTURE THEAD.            "Kopf
DATA:   TXT_REF LIKE EQKT-KZLTX.            "Text nach Referenz o.k.
DATA:   PROPERTY TYPE C.                    "No Changes to Existing Long Text
DATA: END OF LTXHEAD.

"commit_text variables
data: l_count type SY-INDEX,
       L_1 TYPE STANDARD TABLE OF STXDROBJ,
       L_2 TYPE STANDARD TABLE OF STXDRNAME,
       L_3 TYPE STANDARD TABLE OF STXDRID,
       L_4 TYPE STANDARD TABLE OF STXDRLANG.
 
l_text_name+0(3= sy-mandt.
l_text_name+3(1= 2.              "katalog maßnahmen indikator
l_text_name+4(8= I_VIQMSM-MNGRP.
l_text_name+12(4) = I_VIQMSM-MNCOD.
l_text_name+16(6) = '000001'. "vermutlich tdversion!!! "this could variate
l_text_name+22(1) = sy-langu.

"1. Read notification longtext
CALL FUNCTION 'READ_TEXT'
   EXPORTING
     ID                      = 'QPCT'    "Codelangtext
     LANGUAGE                = sy-langu
     NAME                    = l_text_name
     OBJECT                  = 'QKATALOG'
   IMPORTING
     HEADER                  = ls_header
   TABLES
     LINES                   = LT_lines
   EXCEPTIONS
     ID                      = 1
     LANGUAGE                = 2
     NAME                    = 3
     NOT_FOUND               = 4
     OBJECT                  = 5
     REFERENCE_CHECK         = 6
     WRONG_ACCESS_TO_ARCHIVE = 7
     OTHERS                  = 8.
IF SY-SUBRC = 4.
   RETURN.
ELSEIF sy-SUBRC <> 0.

   MESSAGE id  sy-MSGID TYPE sy-MSGTY number sy-MSGNO with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.


"this is only working for IW22
if sy-TCODE = 'IW22'.

   "2. Set_values for new txt header to set the notification action text
   ls_header-TDOBJECT = 'QMSM'.
   clear ls_header-tdname.
   ls_header-tdname+0(12) = I_VIQMEL-QMNUM.
   ls_header-tdname+12(4) = I_VIQMSM-MANUM.
   ls_header-tdid         = 'LTXT'.
   ls_header-TDFUSER      = sy-UNAME.

*clear: ls_header-tdfreles." , ls_header-TDVERSION.
   ls_header-TDFDATE   = sy-datum.
   ls_header-TDFTIME   = sy-UZEIT.
   ls_header-TDLUSER   = sy-UNAME.
   ls_header-TDLTIME   = sy-UZEIT.
   ls_header-TDVERSION = 1.

   "3. commit notification action text
   CALL FUNCTION 'SAVE_TEXT'
     EXPORTING
*     INSERT          =
       SAVEMODE_DIRECT = ABAP_FALSE
       HEADER          = ls_header
     IMPORTING
       FUNCTION        = l_function    " Sicherung-Status
       NEWHEADER       = ls_header
     TABLES
       LINES           = LT_lines
     EXCEPTIONS
       ID              = 1
       LANGUAGE        = 2
       NAME            = 3
       OBJECT          = 4
       OTHERS          = 5.
   IF SY-SUBRC <> 0.
     MESSAGE id  sy-MSGID TYPE sy-MSGTY number sy-MSGNO with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
   ENDIF.

   CALL FUNCTION 'COMMIT_TEXT'
     EXPORTING
       OBJECT          = ls_header-TDOBJECT
       NAME            = ls_header-TDNAME
       ID              = ls_header-tdid
       LANGUAGE        = Sy-LANGU
*     SAVEMODE_DIRECT = ' '
       KEEP            = ABAP_TRUE
*     LOCAL_CAT       = ' '
     IMPORTING
       COMMIT_COUNT    = l_count
     TABLES
       T_OBJECT        = L_1
       T_NAME          = L_2
       T_ID            = L_3
       T_LANGUAGE      = L_4.

   "3. Set longtext flag Kennzeichen setzen wenn erfolgreich!
   E_VIQMSM-INDTX = ABAP_TRUE.

else.

   "2. Set_values for new txt header to set the notification action text
   ls_header-TDOBJECT = 'QMSM'.
   clear ls_header-tdname.
   ls_header-tdname+0(12) = I_VIQMEL-QMNUM.
   ls_header-tdname+12(4) = I_VIQMSM-MANUM.
   ls_header-tdid         = 'LTXT'.
   ls_header-TDFUSER      = sy-UNAME.

   clear: ls_header-tdfreles, ls_header-TDVERSION.
   ls_header-TDFDATE   = sy-datum.
   ls_header-TDFTIME   = sy-UZEIT.
   ls_header-TDLUSER   = sy-UNAME.
   ls_header-TDLTIME   = sy-UZEIT.
   ls_header-TDVERSION = 1.

   "here try the other thiiiing
   "3. commit notification action text
   CALL FUNCTION 'SAVE_TEXT'
     EXPORTING
*     INSERT          =
       SAVEMODE_DIRECT = ABAP_FALSE
       HEADER          = ls_header
     IMPORTING
       FUNCTION        = l_function    " Sicherung-Status
       NEWHEADER       = ls_header
     TABLES
       LINES           = LT_lines
     EXCEPTIONS
       ID              = 1
       LANGUAGE        = 2
       NAME            = 3
       OBJECT          = 4
       OTHERS          = 5.
   IF SY-SUBRC <> 0.
     MESSAGE id  sy-MSGID TYPE sy-MSGTY number sy-MSGNO with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
   ENDIF.

   MOVE-CORRESPONDING ls_header to LTXHEAD.
   append LTXHEAD to LTXHEAD.
   export LTXHEAD to MEMORY id 'ITX1'.

   CALL FUNCTION 'COMMIT_TEXT'
     EXPORTING
       OBJECT          = ls_header-TDOBJECT
       NAME            = ls_header-TDNAME
       ID              = ls_header-tdid
       LANGUAGE        = Sy-LANGU
      SAVEMODE_DIRECT = ABAP_TRUE
*     LOCAL_CAT       = ' '
     IMPORTING
       COMMIT_COUNT    = l_count
     TABLES
       T_OBJECT        = L_1
       T_NAME          = L_2
       T_ID            = L_3
       T_LANGUAGE      = L_4.

   "3. Set longtext flag Kennzeichen
   E_VIQMSM-INDTX = ABAP_TRUE.
endif.


Viewing all articles
Browse latest Browse all 8644

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>