Application Development 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: 

BAPI_PO_CREATE to BAPI_PO_CREATE1; how to?

matteo_montalto
Contributor
0 Kudos

Hello gurus,

I'm working on an old custom interface FM (on a backend system) which substancially acts as a "wrapper" for the BAPI_PO_CREATE.

In details, the code processes an input, does some check on some conditions, then launch the BAPI_PO_CREATE fm in order to create a Purchase order. This is used to interface a third party system with SAP backends.

Now, the aim is to substitute the call to the BAPI_PO_CREATE (obsolete) with BAPI_PO_CREATE1. As far as I've seen, the latter allows to manage more data and also structures and types used are different from the older one.

So I wonder and ask if there's a sort of howto or standard FM to manage data conversion in order to successfully swap the call from BAPI_PO_CREATE with a newer call of BAPI_PO_CREATE1.

I searched a bit on the forum and web but didn't find anything related to this task

Thanks in advance for your help.

1 ACCEPTED SOLUTION

martin_voros
Active Contributor
0 Kudos

Hi,

Have a look at note 1054029. It contains FM EHSWA_112_PO_BAPI_CONVERT which does what you need. It converts from old structures to new structures. Even if you don't look at that FM it shouldn't be that hard. BAPI_PO_CREATE1 provides additional functionality but I guess that it covers all functionality from BAPI_PO_CREATE. So you just need to figure out mapping from old structures to new structures. Unfortunately, they changed field names but field types should be same.

Cheers

4 REPLIES 4

martin_voros
Active Contributor
0 Kudos

Hi,

Have a look at note 1054029. It contains FM EHSWA_112_PO_BAPI_CONVERT which does what you need. It converts from old structures to new structures. Even if you don't look at that FM it shouldn't be that hard. BAPI_PO_CREATE1 provides additional functionality but I guess that it covers all functionality from BAPI_PO_CREATE. So you just need to figure out mapping from old structures to new structures. Unfortunately, they changed field names but field types should be same.

Cheers

0 Kudos

Hello there

sorry for the late, I had a previous task to work to so that I had the chance to test your purposed solution only on friday..

I have to say, Martin's suggestion goes quite fine; I used the standard EHSWA_112_PO_BAPI_CONVERT (curiosity: what are the EHSWA* FM for?) to convert some input structures from BAPI_PO_CREATE to BAPI_PO_CREATE1.

Some other structures use the same data type on both BAPI so they don't need - apparently - specific conversion.

And here comes the trouble: while older BAPI_PO_CREATE worked before, the newly interfaced BAPI_PO_CREATE1 doesn't work, as expected, because some little adjustments need to be done.

The one I'm facing now is how to adapt the EXTENSIONIN structure, which contains custom field values. I noticed in debug the routine that moves extensionin to the data structure of the bapi looks for the structure name BAPI_TE_MEPOHEADER, which is different from the structure used in the older bapi (BAPI_TE_PO_HEADER).

So, a preliminary task is to substitute in the EXTENSIONIN table the structure names, in order to adapt them to the new BAPI.

Tried in debug, but seems there are other problems and... since I don't know specifically how this extensionin structure works and what's the correct way of converting them for the new BAPI, is there any guide/document that could help me understanding how mapping is done ? Or the only way is to debug the stuff?

Thanks in advance for yout help

0 Kudos

Hi,

regarding EHSWA: you should've read that OSS note more carefully.

Component: Waste Management

Module: Disposal processing

regarding EXTENSIONIN: check [SAP documentation|http://help.sap.com/saphelp_470/helpdata/es/3e/0e1089c24611d1ad09080009b0fb56/frameset.htm] as well as BAPI documentation in SE37.

Cheers

raymond_giuseppi
Active Contributor
0 Kudos

You can use transaction BDBS to generate a mapping module between two structures.

(ref: [Converting Between Int. and Ext. Data Formats and Structures|http://help.sap.com/erp2005_ehp_03/helpdata/EN/a5/3ec9594ac011d1894e0000e829fbbd/frameset.htm] in [BAPI Programming Guide Reference (CA-BFA)|http://help.sap.com/erp2005_ehp_03/helpdata/EN/a5/3ec8074ac011d1894e0000e829fbbd/frameset.htm])

Regards,

Raymond