BAPI - How to expand item text object automatically

RichBianco used Ask the Experts™
I am creating Purchase Requisitions via BAPI and I need to send in some item texts as "objects".

Here is the code I'm using, it is using an object (that exists in SAP as an object via tranaction S010) named ZIN23A:

// project level sap object id
lstr_bapiebantx[li_itm].preq_item =  '1'
lstr_bapiebantx[li_itm].text_id =  'B01'  
lstr_bapiebantx[li_itm].text_form = '/:'
lstr_bapiebantx[li_itm].text_line = 'INCLUDE ZIN23A OBJECT TEXT ID ST LANGUAGE EN'

What can I change in the BAPIEBANTX table so that SAP will immediately expand out the SAP object 'ZIN23A' and store all it's content as text? The way I have it now, it shows as an object and the user can only see it if they do a print preview. The user wants all the paragraphs of data for ZIN23A expanded out and stored as text so they can make changes to it.


p.s. I promise to read all replies within one day so you will be sure to get points for a correct answer! :)

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®


More clarification on the question, and increasing to 100 points.

Here is the on-line equivalent of what I need to do via bapi:

To change text lines of an included text, you must resolve the INCLUDE statement. In the text editor, choose Edit ® Selected area ® Expand INCLUDE. The system now copies the text lines into the current text and deletes the INCLUDE statement. Afterwards, there is no more link to the text originally specified in the INCLUDE statement. This means, that changes to the original text no longer effect the current text.

HERE IS DOCUMENTATION I'VE FOUND IN INCLUDE TEXT...nothing indicates it is possible to expand immediately as you can do on-line

Standard text

Standard texts is predifined texts that can be used in more than one form. Standard texts are can be created, changed and displayed using transaction SO10.

The text ID is used to classify texts.

To include a standard text in a form, use the INCLUDE command:


When formatting the standard text the PARAGRAPH parameter is used. To center the text use:

/: INCLUDE <name> <Parameter>

<parameter> = Object, ID, Language, Paragraph



Name: Z_BC460_EX4_HF

Object: Text

Text id: SDVD (Text id from SO10)

Language: EN

Paragraph: C (Centered)

Thanks again.

Your question is a bit confusing. First you want to create a purchase req via bapi and the comment following is how to output standard text in sapscript and sap forms.

Is this BAPI creating a Purchasing Rec on SAP?
I need the name of the BAPI and the code if possible to see exactly what your doing.


L2020, Yes I am creating Purchase Req on SAP. The actual BAPI is:

I'm using method CreateFromData of object PurchaseRequisition. The actual function is named: BAPI_REQUISITION_CREATE

The CreateFromData method takes many arguments, one of which is a table of item texts (BAPIEBANTX). I am sending in some item texts that are free form data and that works fine. I also send in some item texts that are "standard texts" and that works OK but the user can only see it expanded if they print or print preview, otherwise it shows on the screen as 'INCLUDE ZIN23A OBJECT TEXT ID ST LANGUAGE EN' note: ZIN23A is a valid SAP standard text in our system.

When using the SAP Gui a user can include a "standard text" (say ZIN23A) and choose to "expand immediately". I would like to be able to include a standard text and expand immediately via the bapi, but I am starting to believe that the functionality is not available via BAPI and is only available via the SAP Front End.

Thanks for your help so far.

Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

-------------some info------------------
BAPIEBANTX table requisitionItemText Size: 153 bytes  
In the table RequisitionItemText you pass on texts pertaining to the purchase requisition item. You can pass on the following in the specified fields:

the allowed text types (e.g. item or delivery texts) in the field TEXT_ID
a SAPscript format key in the field TEXT_FORM
the actual text lines in the field TEXT_LINE

If TEXT_ID is empty, an item text is always generated. If TEXT_FORM is empty, the standard format key * is assigned.
--------------end info --------------------
If you have tried all of the above options then it is clear that the online TXN is different from the bapi.

We had to solve a similar problem with the sales_order_create bapi.  The standard bapi did not include the special shipping on item text. We duplicated the origional std BAPI and expanded the interface to include an additional data and then called a f'n in the modified bapi to insert the std text.

Since you were successful inserting free form text items, and you know the standard text ID already before the bapi call,  you may want to create an RFC to retreive standard text from SAP; call that first then insert the result like the free form text. You would create an rfc using the
READ_TEXT function to retreive the std text.


I agree, I am pretty confident that the TXN is different from the bapi in this respect.

Both ideas you mention (expand bapi, or rfc to get text) may be my only option. Unfortunately I have no ABAP experience and don't know how to copy and extend a bapi, OR create a RFC.

I really want to learn ABAP, so I might try to ask the manager of that group to let me try to do the work. I highly doubt that will happen... but maybe.

I think your answer is the best that I am going to get and I appreciate your time so I will award you the points.

take care,
Rich Bianco


If you think of an easier way, let me know. I really appreciate the ideas.

Rich Bianco

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial