cancel
Showing results for 
Search instead for 
Did you mean: 

No classification data when customized BAPI (Z_BAPI_DOCUMENT_CREATE) used

Former Member
0 Kudos

Hi all,

I have one problem considering importing Classification data with modified BAPI_DOCUMENT_CREATE. I have made only small modifications to BAPI_DOCUMENT_CREATE function, because I want to parse one string and add parts of that string to Document Info Record's Classification data. The whole thing works like this:

1) I load the string to SAP (in the test-test field)

2) I parse it and each part of it I put Into field CHARVALUE

3) I fill CHARNAMES with information:COSTPERCOSTCENTER1 (the name of char name with the increment number in the end)

3) In that time I also enter the data for CLASSTYPE and CLASSNAME

4) It is repeated as long as there are components in string

5) In the end I append these values in the TABLE part of BABI (CHARACTERISTICVALUES = characteristicvalues2)

When I trace execution all these information are stored correctly to characteristicvalues2, but when I create document with appropriate data input the classification data is still empty!

Why is that so?

Here is the part of code which I have added to bapi BAPI_DOCUMENT_CREATE. The rest of original bapi is completely the same.

-


.

.

.

data characteristicvalues2 like BAPI_CHARACTERISTIC_VALUES occurs 0 with header line.

data: i1 TYPE I.

data: lv_fdpos TYPE I.

data: s1(2) TYPE c.

i1 = 1.

while test-test ne space and i1 le 2.

search test-test for ','.

if sy-subrc = 0.

lv_fdpos = sy-fdpos + 1.

move test-test(sy-fdpos) to characteristicvalues2-CHARVALUE.

MOVE i1 TO s1.

CONCATENATE 'COSTPERCOSTCENTER' s1 INTO characteristicvalues2-CHARNAME.

characteristicvalues2-CLASSNAME = 'COSTCENTERINF'.

characteristicvalues2-CLASSTYPE = '017'.

append characteristicvalues2.

shift test-test left by lv_fdpos places.

else.

characteristicvalues2-CHARVALUE = test-test.

MOVE i1 TO s1.

CONCATENATE 'COSTPERCOSTCENTER' s1 INTO characteristicvalues2-CHARNAME.

characteristicvalues2-CLASSNAME = 'COSTCENTERINF'.

characteristicvalues2-CLASSTYPE = '017'.

append characteristicvalues2.

clear test-test.

endif.

i1 = i1 + 1.

endwhile.

.

.

.

TABLES

.

.

.

CHARACTERISTICVALUES = characteristicvalues2

.

.

-


Thanks folks!

I appreciate Your help and effort!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Karlo,

Try to run a test case from the test data directory of SE37 function builder and if possible debug from there. The actual FM which is used to create the DIR is 'API_DOCUMENT_MAINTAIN2' and the code which saves the classification data is marked as SAVE CLASSIFICATION DATA FOR CREATE in the FM. Probably you need an ABAP support to help you with this.

Sojan

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks for Your effort guys!

I have tried all these things, but none is the solution. Since I at the moment do not need this solution, I will close this thread.

Thanks again on Your help!

christoph_hopf
Advisor
Advisor
0 Kudos

Hi all,

did you also execute BAPI_TRANSACTION_COMMIT after the CREATE BAPI? Because this TRANSACTION_COMMIT is necessary to put the new data on the database.

Further I would recommend you to use BAPI_DOCUMENT_CREATE2 which is the latest one for creating document info records.

Best regards,

Christoph

Former Member
0 Kudos

Hi,

Have you attached the classification to that document type in configuration

Anirudh,

Former Member
0 Kudos

Karlo,

I suppose the characterestics and Classes are already existing in the system. If you are trying to create it using the BAPI, it would not work. If my assumption above is true, you need to create first the characterestics and then the class and run the above programming logic.

Please let me know, if you need to know more,

Sojan