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: 

Create long text using CREATE_TEXT

Former Member
0 Kudos
7,529

Hi All,

I am trying to create a long text for Asset (AS01/AS02) using the function module CREATE_TEXT. After the execution of this FM I am doing COMMIT WORK (also COMMIT_TEXT).

The issue is, text is getting created successfully but it doesnt appear while attempting to see it in display mode.

Other way around, if we again go to t-code AS02, the CREATE button does not appear like DISPLAY (Pencil) button.

Can any body please tell me if there is something more to be done in order to get the text appeared in DISPLAY mode.

Thanks,

Ashish

17 REPLIES 17

Former Member
0 Kudos
1,413

Before calling function module CREATE_TEXT use following statements.

WAIT UPTO 2 SECONDS.

Hope, will work.

Kumar.

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos
1,413

use commit work and wait , this will update the text in synchronous mode.

Former Member
0 Kudos
1,413

hi

is it a User Exit? or what

if it is a userexit then check out whether u have defined the EXPORT parameter

in the PAI of the screen & IMPORT parameter in the Z include of the Corresponding

Function Module Exit.

then in the PBO of ur screen check for the below coding

if sy-tcode = 'AS03'.

loop at screen.

screen-input = '0'.

modify screen.

endloop.

endif.

Regards

I066686
Advisor
Advisor
0 Kudos
1,413

hai Ashish,

You try with the function module EDIT_TEXT .It has one parameter for Displaying the text in long text editor (display), just set it as 'X' , it will work.

Former Member
0 Kudos
1,413

Hi all,

Thanks for the onverwhelming response, I have already tried all the suggested options (wait, edit_text, save_text) but nothing worked out. I have also tried with COMMIT_TEXT, COMMIT WORK (with wait upto 2 seconds) but this also did not work.

As I said, text is created but not visible in DISPLAY mode. However, you can see the created text in CHANGE mode.

Any other inputs please...??

Thanks,

Ashish

Former Member
0 Kudos
1,413

Hi Ashish ,

Use SAVE_TEXT FM check this sample code .

How to Upload Long Text into SAP Using Excel Sheet and SAVE_TEXT Function Module - Code Gallery -...

Regard's

Smruti

Former Member
0 Kudos
1,413

Hi,

When we use the FM "CREATE_TEXT" it will create the long text but it will never update the long text existance flag field like "XLTXID" or "XKALID" . In your case in dispaly mode the transaction will check for the long text existance field and as it is not updated , it will never show the long text. So check for some other function module for the longtext update.

You may check the possibility of the FM "ASSET_MASTERRECORD_MAINTENANCE".

Hope this will help you.

Regards,

Smart Varghese.

0 Kudos
1,413

Hi Smart,

The solution given seems to be promising but I have one doubt here, if I update the master record using this FM do I need to populate all the values in the importing parameters.

Because I believe that if I pass only Long Text indicator it will clear all other values from the database table which will be a big blunder in this case.

Inputs are welcome!!!

Thanks,

Ashish

vinita_kasliwal
Active Contributor
0 Kudos
1,413

Dear Experts

Did any one actually manage to solve this we are facing the same issue while we work  with create notification long text i.e  iw21 . Notification text  gets saved in the database tables  STXL  and STXH before saving it and we can view the same from READ_TEXT  i.e the value for the default text and thus we can say it is transferred correctly while creating the notification .

I am pasting steps tp reproduce the issue :

Step 1 : Creating a notification : IW21

Step 2 : Fill all the details

Step 3 : If the user clicks on the long text Display notification marked in yellow it comes as blank :

ORKAROUND : However if user  enters a space / enter or some entry in the small window like below

Step 6 : And then click on Display next to long notification : It would display the long text .

Former Member
0 Kudos
1,413

Hi Ashish,

               previously i got the same problem after that i hv solved that prbm.

Please mentain the language as dynamically.pls find the below code.

   DATA : V_LAN TYPE THEAD-TDSPRAS. " Language

CALL FUNCTION 'CREATE_TEXT'
    EXPORTING
      FID               = 'PLPO'
      FLANGUAGE         = V_LAN
      FNAME             = RESULT
      FOBJECT           = 'ROUTING'
      SAVE_DIRECT       = 'X'
*     FFORMAT           = '*'
    TABLES
      FLINES            = TLINES1
   EXCEPTIONS
     NO_INIT           = 1
     NO_SAVE           = 2
     OTHERS            = 3

Regards,

OmChandra

0 Kudos
1,413

Hi Om chandra

Any Idea about my issue I have done just what you suggested above yet while creating a notification from IW21 the default long text doesnt copt to editor while after saving it I can see . I have described it as above :

Oasting the code bekow for your ref to check :

  DATA:
li_text           
TYPE STANDARD TABLE OF tline,
lw_header         
TYPE thead,
lv_text_name      
TYPE tdobname,
lv_text_lang      
TYPE spras,
lv_tdname         
TYPE tdobname,
lv_doc_type       
TYPE char4.

*" Local Constant Decleration
CONSTANTS:
lc_ltxt           
TYPE tdid        VALUE 'LTXT',
lc_qmel           
TYPE tdobject    VALUE 'QMEL'.

Change the Object Long Text Available indicator


*" Change the Primary language indicator for text segment
e_viqmel
-kzmla = lv_text_lang.

*" Populate TD name to create default text.
lv_tdname
= i_viqmel-qmnum.


CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid      
= lc_ltxt
flanguage
= lv_text_lang
fname    
= lv_tdname
fobject  
= lc_qmel
*        fformat   = '/'
TABLES
flines   
= li_text
EXCEPTIONS
no_init  
= 1
no_save  
= 2
OTHERS    = 3.

0 Kudos
1,413

Hi Vinita,

             in that FM you can pass as SAVE_DIRECT  = 'X' and FFORMAT     = '*'. i gess it will work.

Present you are using BDC call transaction or session method?

Regards,

OmChandra

0 Kudos
1,413

HI OmChandra

Tried this and also using save_text instead of create text still facing the same issue as you can see above in step 3 of what I have pasted in my previous replies .

  CALL FUNCTION 'CREATE_TEXT'

      EXPORTING

        fid               = lc_ltxt

        flanguage         = lv_text_lang

        fname             = lv_tdname

        fobject           = lc_qmel

       SAVE_DIRECT       = 'X'

       FFORMAT           = '*'

      tables

        flines            = li_text

     EXCEPTIONS

       NO_INIT           = 1

       NO_SAVE           = 2

       OTHERS            = 3

Please can you check and let me know ?

0 Kudos
1,413

Hi Vinita,

            Please find the belw link.

http://scn.sap.com/docs/DOC-45423

Regards,

OmChandra

Former Member
0 Kudos
1,413

Hello,

You need to set FM ‘SAVE_TEXT’.or  'CREATE_TEXT'

tdformat = '>X'  <-- this format you can not set directly in editor

CONCATENATE '*' tdline

         INTO tdline

         SEPARATED BY space.

this will make text to be non editable.

Thank you...

Former Member
0 Kudos
1,413

Hi,

Before you cross verify whether your program is updating the long text successfully I suggest to create the long text manually using transaction AS01 and check whether you are able to see this text in Display mode.

Thanks.

Former Member
0 Kudos
1,413

Hi,

I have the same issue updating long text for asset. I can not see the pencil button when I go into AS02.

Please provide me a solution if you already have found one.