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

Problem with BAPI_DOCUMENT_CREATE2

Former Member
0 Likes
401

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 !

1 REPLY 1
Read only

Former Member
0 Likes
321

here was my problem:

....

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

<b>    it_ausp-classname = 'DMS_FAB'.
    it_ausp-classtype = '017'.</b>
    it_ausp-charname = 'DMS_TIPODOCFAB'.
    it_ausp-charvalue = it_cdp_c-zztipodoc.
    APPEND it_ausp.

.....