cancel
Showing results for 
Search instead for 
Did you mean: 

not able to create dir with bapi_document_create

Former Member
0 Kudos

1- My requirement is to create a DIR in DMS.

2- We have a .net person he will write a piece of code and call the bapi from his system and will create a DIR.

3- As in my system some mandatory  customize and additional fields are there to create a DIR, I created a customize bapi similar to bapi_document_create2. Following are the parameters and the values I passed in the importing parameter of  zbapi_document.

DOCUMENT TYPE  SPE

DOCUMENT NUMBER  "IT WILL BE GENERATED BY THE SYSTEM"

DOCUMENT PART 000

DOCUMENT VERSION A

LABORATORY SCC

USERNAME  Z0033B4V

DESCRIPTION    TEST

LANGUAGE EN

TECHNICAL CLASSIFICATION   " DECONTROLLED" ( NOT PRESENT IN STANDARD BAPI_DOCUMENT_CREATE2)

USCONTENT    "NO"   (NOT PRESENT IN STANDARD BAPI_DOCUMENT_CREATE2)

PRODUCT LINE 01       (NOT PRESENT IN STANDARD BAPI_DOCUMENT_CREATE2)

BUSINESS DOCUMENT NAME QD           (NOT PRESENT IN STANDARD BAPI_DOCUMENT_CREATE2).

Only MWERT, MWERT1, BDN, PRODUCT LINE ,these four fields are added in addition to bapi_document_create2 fields. Out of these four BDN and product line are customizing.

IMPORTING PARAMETER

DOCUMENTDATA1 TYPE ZBAPI_ONEP1

STRUCTURE ZBAPI_ONEP1

COMPONENT                                                             COMPONENTTYPE

DOCUMENTYPE                                                                DOKAR

DOCUMENTNUMBER                                                     DOKNR

DOCUMNNTPART                                                             DOKTL_D

DOCUMENTVERSION                                                         DOKVR

DOCUMENT DISCRIPTION                                                  DKTXT

USERNAME                                                                             DWNAM

LABORATORY                                                                              LABOR

LANGUAGE                                                                                    STABK

MWERT(TECHNICAL CLASSIFICATION)                                    AWERT

MWERT1(US CONTENT)                                                                  AWERT1

PL(PRODUCT LINE)                                                                       ZCPDM_PL

BDNABBR(BUSINESS DOCUMENT NAME)                          ZCPDM_BDNABBR

I created a customize bapi with these fields and when I test it, I gave me error as import from memory id not successful . when i checked the message in se91 .They have used enhance the document creation program and the method “AFTER_CHANGE_STATUS” for class ZCL_IM_DOCUMENT_STATUS01.

I am attaching the code for the enhancement. Can anyone please tell me how I can successfully create a DIR as I am new to this and what code should I write in FM source code.

Shilpa

Accepted Solutions (1)

Accepted Solutions (1)

former_member585060
Active Contributor
0 Kudos

Hi,

    Before testing your created ZBAPI 'ZBAPI_DOCUMENT', first try to test the creation of Document with the standard BAPI, 'BAPI_DOCUMENT_CREATE2' in SE37 or CV01N, place a break-point in the BADI method 'AFTER_CHANGE_STATUS', check how the logic is working in at the function module 'Z_CPDM_XCVX_CONSTRUCT_MEMID', the message in your ZBAPI must be triggered after this function module getting failed. As per the logic it is triggered based on the DRAW-RES1 and DRAW-RES2 field values, check in both the cases from Document creation and the BAPI 'BAPI_DOCUMENT_CREATE2' execution in SE37, based on that you pass the importing parameters of the BAPI.

Thanks & Regards

Bala Krishna

Former Member
0 Kudos

Hi,

I am able to solve that bdn from memory id error. Now it is showing me "that link to sap object for the document type 'SPE' is not allowed. When I am saw the link in draw table for spe document it shows MARA, but when I am putting objectlink = mara. it says mara does not exist.

Can you tell me what could be the reaon behind this

Shilpa

former_member585060
Active Contributor
0 Kudos

Hi,

    How and in which fields or structure you are passing the Objectlinks values. We have to pass Objectlinks values to the structure 'OBJECTLINKS' and append into it for each entry. It has a specific structure and fields which we have to pass.

For refrence how to pass the values into that structure,

Goto DRAD table in SE16, give DRAD-DOKAR as 'SPE' and DRAD-DOKOB as 'MARA', it will list you all the Documents which has 'MARA' has its Objectlinks. Now goto SE37 and call BAPI 'BAPI_DOCUMENT_GETOBJECTLINKS', provide any document values from the DRAD table and see how the 'OBJECTLINKS' table is filled.

Fill the 'OBJECTLINKS' table in 'BAPI_DOCUMENT_CREATE2' or in your ZBAPI' similarly.

Thanks & Regards

Bala Krishna

Former Member
0 Kudos

I am able to solve this and hence closing the thread..

Shilpa

Answers (1)

Answers (1)

madhu_vadlamani
Active Contributor
0 Kudos

Hi Shilpa,

Are you able to create with standard bapi

Regards,

Madhu.