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: 

ADD BAPI in distribution model

Former Member
0 Kudos

Hello everybody,

Can you please expalin use of ADD BAPI button given in BD64/distribution model.

Please explain with an example.

I tried to to serach on inetrnet about ADD BUTTON.But not much information available niether ADD BAPI was explained in me training.

Thanks.

1 ACCEPTED SOLUTION

jitendra_it
Active Contributor
0 Kudos

Hi Sanjay_int,

Sometimes when we add message type in distribution model, it doesn't allow us to add, then we go for Add Bapi.

take an example. Idoc for accounting is Acc_document03 & its message type is Acc_document.

when we add this msg type in distribution model it doesnot allow us. then we add Bapi " bapi_acc_document_post".

Hope it may help you.

Regards,

Jitu

20 REPLIES 20

Former Member
0 Kudos

This functionality isn't terribly well named. What it refers to is adding an API method of a business object.

You can generate an Idoc wrapper for a business object method via transaction BDBG. To add this Idoc and message type to your distribution model you need to use the 'Add Bapi' function, rather than 'Add Message'.

0 Kudos

Hi Simon,

Thanks for reply.can you please explain why this methodology is not preferred?

Also can you plese give a scenario where this method is preferred over Message type method.

Edited by: Sanjay_lnt on Jan 21, 2011 5:31 PM

0 Kudos

BDBG is not that uncommon... When there are no standard IDOCs or IDOC function modules, We can generate our own IDOC type using the BDBG transaction... Check out this link

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/6943dc85-0601-0010-beab-e2ce1eb16...

0 Kudos

Kris's link pretty much says it all about how to use this. All I'd add further to this is that this is a useful shortcut to building custom Idocs without having to set everything up in the Idoc editor etc. Since it is based on a function module interface you are limited to flat structures or tables with flat structures (i.e. no complex nesting like many standard Idocs).

However if you just need an Idoc with a simple structure this can be a real time-saver; I've used this approach many times.

0 Kudos

Custom idocs can be always triggered using custom z program with mater_idoc_distribute.

Can you guide why where specifically this method used?

jitendra_it
Active Contributor
0 Kudos

Hi Sanjay_int,

Sometimes when we add message type in distribution model, it doesn't allow us to add, then we go for Add Bapi.

take an example. Idoc for accounting is Acc_document03 & its message type is Acc_document.

when we add this msg type in distribution model it doesnot allow us. then we add Bapi " bapi_acc_document_post".

Hope it may help you.

Regards,

Jitu

0 Kudos

Is it only scenario where ADD BAPI functionality to be deployed.

Can you give more scenarios where ADD BAPI is most preferable.

0 Kudos

Hi,

help.sap.com link doesn't provide practical scenario.

Knmdly provide practcal scenario you came across

I mean for what tcode, on what event and what BO with method; ALE-BAPI interface scenario was deployed.

0 Kudos

Hi Jitu,

Thanks a ton for reply.

Would you please provide the business object you used for account document.

I mean please provide method and business object used in add bapi button.

Thanks.

0 Kudos

Hi Sanjay,

Business object is "AcctngDocument" and method is "Post".

Thanks

jitu188

0 Kudos

HI jitu188 ,

I tried your scenario in distribustion model.

But idoc is not generated.Is there any sort of event linkage the way we do in workflow?

How this distribution model bapi and BO is being triggered and instanciated?

Kindly help.

Edited by: Sanjay_lnt on Jan 30, 2011 2:43 PM

0 Kudos

Hi Sanjay,

Please first explain me u scenario.

0 Kudos

I am learning ALE_BAPI interface method.

I used BO BUS6035 and method POST in distribution model.

Outbound function module is - ALE_ACC_DOCUMENT_POST which i found from BDGB.

Can you please guide how this function module for generating idoc will be triggered?

I appreciate your earlier replies.

0 Kudos

Hi Jitu,

I appreciate your replies.

I am learning ALE_BAPI interface method.

I used BO BUS6035 and method POST in distribution model.

Outbound function module is - ALE_ACC_DOCUMENT_POST which i found from BDGB.

Can you please guide how this function module for generating idoc will be triggered?

Would it be automaticaly triggered when the document will be posted from standard SAP tcode used for posting of acc document

as BO will be triggered from SAP?

What T-code you used for posting acc documnt?

Thanks.

Edited by: Sanjay_lnt on Jan 30, 2011 4:15 PM

0 Kudos

Hi Jitu188,

Kindly reply.

0 Kudos

Hi Sanjay,

When u see BUS6035(Accouting) in SWO1 it shows no event.

but when u see BUS2012 (Purchase Order) it shows event.

So as I understand we cant trigger it through a tcode, u should use FM MASTER_IDOC_DISTRIBUTE.

Thanks

jitu188

0 Kudos

Hi Jitu,

gr8 to se ur reply.

I think ur suggesting custom idoc for accounting.

Though we need not use MASTER_IDOC_DISTRIBUTE.

We can still create custom idoc using BDBG.

Just need to instanciate BO-

CALL FUNCTION 'SWO_CREATE'

EXPORTING

objtype = 'ZBUS6035_A' "My z- BO ,Here we can use standard BO

objname = 'ZBUS6035_A' "Custom method

IMPORTING

object = l_objhnd

EXCEPTIONS

no_remote_objects = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

************************************************************************

break-point.

  • pass data to container for bapi

SWC_GET_ELEMENT lt_cont 'Date1' DATE1.

  • fire BAPI

CALL FUNCTION 'SWO_INVOKE'

EXPORTING

  • ACCESS = 'C'

object = l_objhnd

verb = 'ZBUS60351_A'

  • PERSISTENT = ' '

IMPORTING

return = l_return

  • VERB =

  • MODE_ID =

TABLES

container = lt_cont.

My problem is resolved now.Icould use ADD BAPI for IDOC triggere.

Thanks everybody for kind help.

Edited by: Sanjay_lnt on Feb 1, 2011 11:35 AM

Edited by: Sanjay_lnt on Feb 1, 2011 11:37 AM

0 Kudos

Code doesnt work!

Former Member
0 Kudos

Hi,

please check this link

http://help.sap.com/saphelp_46c/helpdata/en/4f/1c4b6e5733d1118b3f0060b03ca329/content.htm

In that, you have to see the add bapi and add message type then you would get clear picture.

It will helps you.