Application Development and Automation 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: 
Read only

Idoc

Former Member
0 Likes
421

we are trying to populate long texts in customer invoice transaction (f-22) using the Idoc acc_document, which is not possible according to SAP standard code... looking for a solution

Thanks

Satyaki

1 REPLY 1
Read only

Former Member
0 Likes
344

Can you use IDoc type INVOIC02 instead? It has a segment E1EDPT1 (and E1EDPT2) that should allow you to enter the long text. I'm not sure if this IDoc type will create the type of invoice you need though.

If you must use ACC_DOCUMENT01, the first question that comes to mind is where do you plan to retrieve the long texts (i.e. where are the long texts stored)? If you are storing the texts in table STXH and STXL then you can use function module 'COPY_TEXTS' to make a direct copy from your existing long text into the document item. In the example below, I am copying the long text from an existing document item to another document item:


CONSTANTS: object_doc_item LIKE thead-tdobject VALUE 'DOC_ITEM',
           lang            LIKE thead-tdspras VALUE 'E',
           id1             LIKE thead-tdid VALUE '0001'.

DATA: BEGIN OF keydata,                                  
         bukrs LIKE bkpf-bukrs,
         belnr LIKE bkpf-belnr,
         gjahr LIKE bkpf-gjahr,
         buzei LIKE bseg-buzei,
      END OF keydata.


* Get the text name for the source document number and item
    keydata-bukrs = p_bukrs.  "Co.code
    keydata-belnr = p_doc.    "Doc num
    keydata-gjahr = p_gjahr.  "Fiscal year
    keydata-buzei = p_item.   "Item
    name1 = keydata.


* Get the text name for the destination document number and item
    keydata-bukrs = p_bukrs2. "Doc company code 
    keydata-belnr = p_doc2.   "Doc number
    keydata-gjahr = p_gjahr2. "Doc fiscal year
    keydata-buzei = p_item2.  "Doc item 
    name2 = keydata.          


    itexts-destobject = object_doc_item.
    itexts-destname   = name2.
    itexts-destid     = id1.
    itexts-destlang   = lang.
    itexts-srcobject  = object_doc_item.
    itexts-srcname    = name1.
    itexts-srcid      = id1.
    itexts-srclang    = lang.
    APPEND itexts.


    CALL FUNCTION 'COPY_TEXTS'
         EXPORTING
              savemode_direct = 'X'
              insert          = 'X'
         IMPORTING
              error           = l_error
         TABLES
              texts           = itexts.
    IF NOT l_error IS INITIAL.
      WRITE: /1 'Error during copy'.
    ENDIF.

The second question is how do you get this information into your customer invoice that is created by the IDoc. In order to come up with a complete answer to this question, you may need to figure out where to implement the COPY_TEXTS function within the flow of your customer invoice processing. One thing to try is adding this function call as a follow-on step to your IDoc creation (i.e. within the program that creates your IDocs) if a success status is returned.

If the source long texts do not already reside in table STXL, then there are various functions available for creating and saving texts in function group STXD.

Regards,

James G.

Message was edited by: James Gaddis