Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem with BAPI_DOCUMENT_CREATE2

Hello

I'm using the bapi BAPI_DOCUMENT_CREATE2 to create a document.

After the

commit work

the document is created but not its characteristics.

What can i do to solve this issue ?

Can anyone help me ?

here is part of the code:

.....

DATA: it_draw LIKE STANDARD TABLE OF bapi_doc_draw2 WITH HEADER LINE,
        it_ltext LIKE STANDARD TABLE OF bapi_doc_text WITH HEADER LINE,
        it_drad LIKE STANDARD TABLE OF bapi_doc_drad WITH HEADER LINE,
        it_ausp LIKE STANDARD TABLE OF bapi_characteristic_values WITH HEADER LINE,
        it_clas LIKE STANDARD TABLE OF bapi_class_allocation WITH HEADER LINE,
        return LIKE bapiret2.

....
it_draw-documentnumber = it_cdp_c-doknr.
    it_draw-documenttype = 'FAB'.
....

    it_clas-classtype = '017'.
    it_clas-classname = 'DMS_FAB'.
    append it_clas.

   it_ausp-classname = 'FAB'.
    it_ausp-classtype = 'DMS_FAB'.
    it_ausp-charname = 'DMS_TIPODOCFAB'.
    it_ausp-charvalue = it_cdp_c-zztipodoc.
    APPEND it_ausp.
....

    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
      EXPORTING
        documentdata               = it_draw
      IMPORTING
        return                     = return
      TABLES
        characteristicvalues       = it_ausp
        classallocations           = it_clas
        objectlinks                = it_drad
        longtexts                  = it_ltext.

    IF return-type CA 'EA'.
      ROLLBACK WORK.
    ELSE.
      COMMIT WORK.
    ENDIF.

Thanks !

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question