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: 

call transaction 'VA01' -> long texts

ralf_wenzel_heuristika
Active Participant
0 Kudos

Hi,

requested feature: code a batch input, that fills a bunch of fields in transaction VA01, including some long texts (goto -> header -> text) and let the batch input stop, BEFORE saving the order. the user has to press the save-button, after he has checked the contents.

problem: the long text name is the order no - which I do not have before saving the order, AND: the long texts control in VA01 is not batchable, and even it would be, I don't want to batch input long texts. how can I trick the VA01 into writing the long texts into the (still unsaved!) order?

Our SD user exists are full of coding, so I don't want to extend a user exit (because this would cause many tests).

Thanks

Ralf

15 REPLIES 15

archanapawar
Contributor
0 Kudos

Hi Ralf,

You can update long texts using FM SAVE_TEXT by passing textname, text ID, text objects and language. But, I don't think it is possible to update it in unsaved order.

0 Kudos

Hi,

I am developer since 1998 - so I know FM save_text. But as I wrote: I don't have a text name before saving the order - because the order no IS the text name.

0 Kudos

I am sorry I replied. All the best!!!

raymond_giuseppi
Active Contributor
0 Kudos

Try to save text in local catalog (let the standard commit update the database) with key similar to "XXXXXXXXXX"

Hint: You can try to find this (or accurate version for your system) by debug, call VA01, enter some text, start debug and display local catalog of text : (SAPLSTXD)CATALOG

Regards,

Raymond

0 Kudos

I am experimenting with this coding:


DATA:
   catalog TYPE STANDARD TABLE OF tcatalog,
   mem_id  TYPE char20,
   BEGIN OF text,
     header TYPE thead,
     lines  TYPE STANDARD TABLE OF tline,
   END OF text.

* build text header and catalog entry
APPEND INITIAL LINE TO catalog ASSIGNING FIELD-SYMBOL(<catalog>).
<catalog>-tdobject = text-header-tdobject = 'VBBK'.
<catalog>-tdid     = text-header-tdid     = '0002'.
<catalog>-tdname   = text-header-tdname   = 'XXXXXXXXXX'.
<catalog>-tdspras  = text-header-tdspras  = sy-langu.
<catalog>-id = '000001'.

* export catalog
mem_id = 'SAPLSTXD' && <catalog>-id.
EXPORT catalog = catalog TO MEMORY ID 'SAPLSTXD'.

* build text body
APPEND INITIAL LINE TO text-lines ASSIGNING FIELD-SYMBOL(<textline>).
<textline>-tdformat = '*'.
<textline>-tdline   = 'this is a test'.

* write text to text memory
CALL FUNCTION 'SAVE_TEXT'
   EXPORTING
     header    = text-header
     local_cat = 'X'
   TABLES
     lines     = text-lines.

CALL FUNCTION 'COMMIT_TEXT'
   EXPORTING
     object    = text-header-tdobject
     name      = text-header-tdname
     id        = text-header-tdid
     language  = text-header-tdspras
     local_cat = 'X'.

* open VA01 and hope, that there is a long text existing
CALL TRANSACTION 'VA01'.

But unfortunately, (SAPLSTXD)CATALOG[] is empty in VA01 😞

0 Kudos

The EXPORT should be:

EXPORT catalog = catalog TO MEMORY ID mem_id.

0 Kudos

You are right - but this does not help 😞

0 Kudos

Perhaps there is a refresh done by standard coding in VA01.
Although you don't want it you can try in a userexit if the memory id is still there.
If not you can use an own memory id to pass the data to the userexit and fill the SAPLSTXD stuff there.

0 Kudos

But in a user exit I can not determine if the order has been posted by my call transaction. And only in this case (as a result of some IF statements in my program) I want to insert special long texts.

0 Kudos

This code must be executed during the transaction in one of  the User Exits In Sales Document Processing, and don't commit the text yourself.

Regards,
Raymond

Former Member
0 Kudos

Hi,

post the sales order by means of CALL TRANSACTION VA01 or BAPI. Get the sales order number from parameter id or BAPI return. Save the text.
Ask in a loop for the lock entry. If it is gone call transaction VA02.

0 Kudos

Then I have a posted order in the system, which has not been audited. I need the text BEFORE saving.

I am trying to get the texts into the local text memory of VA01 (Raymonds posting), but until now it does not work...

0 Kudos

I believe you are calling VA01 from custom prog. What if we create a long text with key $000001. hope it will load. once saved when control backs to custom prog, delete it?

0 Kudos

$000001???

0 Kudos

when we create a new order and go in to the long text, the key will be something like $000001 as order is not yet created. So I was proposing to create a new long text with this key and check whether this is being read in VA01.