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 link in BAPI_DOCUMENT_CREATE2

maria_merino
Active Participant
0 Likes
1,860

Hello experts,

I am using module function BAPI_DOCUMENT_CREATE2 to create a document (CV01N) when creating a sales order (VA01). As the user needs the document at header level, I have created a new screen 9001 in report SAPLCV130 and a new module function OBJECT_CHECK_VBAK as it was explained in a document I found.

In CV0xN I can see my new tab for the header.

In the user exit SAVE_DOCUMENT I call module function BAPI_DOCUMENT_CREATE2 as follows:

      l_doc-documenttype = 'Z54'.
    CONCATENATE 'Z54' l_ped INTO l_doc-documentnumber.
    l_doc-statusextern = 'LI'.

    CLEAR w_obj.
    w_obj-objecttype = 'VBAK'.
    w_obj-objectkey = vbak-vbeln .
    w_obj-documentdirection = 'X'.
    APPEND w_obj TO i_obj.

      CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
      EXPORTING
        documentdata         = l_doc
      IMPORTING
        documenttype         = l_type
        documentnumber       = l_docn
        return               = i_return
      TABLES
        characteristicvalues = i_charact
        classallocations     = i_class
        documentdescriptions = i_descr
        objectlinks          = i_obj
        documentstructure    = i_doc
        documentfiles        = i_file
        longtexts            = i_text.

When I run CV03N form my document (created as Z54<sales order number>) the document is created, but in VA03 there is no link for the document.

Is there any missing thing or is it impossible what I've been asked to do ??

thanks in advance,

María

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,776

Hi Maria Merino,

To help you to find a problem more quicly, use FM BAPI_DOCUMENT_GETDETAIL2 and search any document have a created a link to help a find a problem.

Regards.

8 REPLIES 8
Read only

Former Member
0 Likes
1,777

Hi Maria Merino,

To help you to find a problem more quicly, use FM BAPI_DOCUMENT_GETDETAIL2 and search any document have a created a link to help a find a problem.

Regards.

Read only

0 Likes
1,776

Hi Rodolfo,

Thanks for your answer but I still have my problem unsolved. I need to get the link to the document in VA02..

Regards,

Maria

Read only

0 Likes
1,775

Hola Maria, hasta donde se, la pantalla de la VA03 es sólo para documentos enlazados a la tabla VBAP. Si entras en la VA02 y pruebas a pinchar en Detalles->Documentos, sólo puedes indicar un documento que tenga enlace con VBAP

Una solución puede ser añadir el documento en la pestaña de datos adicionales.

Dear Mary, in standard screens in VA03 or VA02 you can only assign documents linked to VBAP. A solution can be add this funcionality to the additional data screen at header level.

Un saludo

Read only

0 Likes
1,775

Hi,

How do you plan to display the link in VA03? like is it by populating another field?

please explain.

If you want to display the link by populating another field, then again u need to use some logic to fetch the link and display.(may be in PBO of 9001 screen for VA03 tcode only)

Read only

0 Likes
1,775

Hola Alejandro,

Al principio probé con link a la VBAP y funcionaba correctamente, el problema es que muchas veces crean el pedido sin posiciones, por eso querían link a la VBAK. En el caso de la VBAP no había problema, desde la VA03, Detalles -> documento se accedía al documento.

Pero con la VBAK esto entonces es imposible ?

gracias !!

Read only

0 Likes
1,775

Hi Maju,

The user wants to display the link in Extras -> Documents, as it was a link to VBAP. But I think this is not possible..

María

Read only

0 Likes
1,775

María, lamentablemente no. Como te dije una posiblidad es añadir un campo en la pestaña de datos adicionales. Otra posibildad es crear una posición de texto en la misma posición, por ejemplo, la posición 1 y linkar a esta posición tus anexos. Poco ortodoxo pero útil.

María, unfortunally there is no a way to link form extras->document to vbak. A possible solution is to include  a field in 'additional data' screen at header level, with the document number. Another possibility is to create a text position (TATX position type) always in the same position number, i.e. position numer 1 and link your attachments to this position.

Read only

0 Likes
1,775

Hi,

Thanks a lot. I'll check if the user wants a new field in addiontal data screen. I think it's the better solution.

thanks a lot !!