cancel
Showing results for 
Search instead for 
Did you mean: 

Webservices on Business Partners

Former Member
0 Kudos

Hi!

I am trying to build a small Java-Application and want it to communicate with SAP BP.

And i am wondering which methods can be used for the webservices to do the following things:

- Displaying,

- Adding,

- Changing,

- Deleting a Businesspartner.

I tried the following Methods as Webservices:

createFromData:

After trying to create a BP i cant find the created BP anywhere, but the TableOfBapiret _return is empty so no errors should have occured.

Can anybody help me please?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

let me understand your requirement clearly.

U r in an external system and trying to create BP in Sap system.

If that is the case. Use Web service(may have BAPI,RFC) of SAP system for creating BP and in response of creation get return message for new BP number.

1st test Web service in SAP system to check the return parameter using SOAMANAGER.

Regards

Snehasish

Former Member
0 Kudos

Dear Romit, dear Snehasish

thank you for your answers, they are helpful!

@romit:

yes, it is a BAPI, i looked it up.

i am still thinking of how to wrap it into an own function module because i am rather new in developing ABAP (i am doing it for my bachelor-report.). what do you actually mean by wrapping?

@ Snehasish:

Yes that is right, i want to create, display, change and delete BPs in an external java application. i will test it in the SOAMANAGER as you said. (is SOAMANAGER also the name of the transaction to call? i am still at the university and can't test it "on the fly" )

Former Member
0 Kudos

SOAMANAGER is the transaction where u can test,create,configure,trace all web services and proxies.

Go to SAP HELP site u will get all informaton about it.

thanks

Snehasish

Former Member
0 Kudos

Hi Frank,

By wraping the BAPI I mean you need to call it in a function module. Create a new function module from se37 transaction. In this function module, remote enable it and define all the importing/exporting/changing/tables parameters that the BAPI has.

Then in the source code, call the BAPI as a method and assign the corresponding parameters that you defined to it.

After this write the statement COMMIT TRANSACTION.

Now test this function module to see if the data gets saved to the database.

Hope this helps!

Regards,

Romit

Former Member
0 Kudos

Dear Snehasish, dear Romit

first of all thank you for your answers

@snehasish:

I cant find the transaction SOAMANAGER, perhaps it is not installed on our netweaver!? The company i am writing my report for is running a Netweaver 2004s ABAP Trial Version at the moment.

@Romit:

I tried to write the wrapper now. i created a function module in a new function group. in the next step i created a webservice from the function module, published it with WSCONFIG and tried to consume the WSDL-document directly by using the small tool wsimport.

this works fine for all the other webservices like calculatiing sqrt as a small example but it doesnt work for my wrapper function module. i get the following mistake and cant help myself out of it:


parsing WSDL...


generating code...
[ERROR] null
unknown location

D:\Programme\eclipse\eclipse_europe\workspace\SAPBPWebservTest\src\.\anlegen\ZFH
ANLEGENService.java:46: invalid method declaration; return type required
    public getZFHANLEGENSoapBinding() {
           ^
1 error
compilation failed, errors should have been reported

do you have any idea?

thanks!

Frank

Former Member
0 Kudos

Hi Frank,

I'm not entirely sure what you mean by the tool wsimport. I usually use the WSNavigator (that comes with the Composition Environment) to test the consumption of my web services.

Regards,

Romit

Former Member
0 Kudos

I don't know the tool you are using for consuming web service.try this way create proxy in SE80 using URL of the web sevice.See if there is any error during generation of proxy .If proxy is generated , then create logical port using LPCONFIG.Then consume the sevice using any FM or Report.

Regards

Snehasish

Former Member
0 Kudos

I am trying to consume the webservice with an external Java-Application (a NON-SAP Application)

the tool WSIMPORT is a small tool from the Java JDK 1.6.X.

i use it to generate the artefacts from a WSDL-document and it works quite fine exept the case mentioned above.

hope i described it more clearly now.

regards

frank

Former Member
0 Kudos

oh dear...

that was a hard weekend. i puzzled the whole weekend to solve my problem but didn't get it.

i am still wondering of how the wrapper should work...

and i get the feeling that i can only put information into BP and can't get em out.

i didn't find anything for information which methods i can use to get all contacts from BP or to search for contacts...

cheers

frank

Former Member
0 Kudos

I am still worrying about the wrapper...

I created a function module to wrap the create_from_date-function module in it.

this is my sourcecode of the wrapper-function-module. every variable-name beginning with "w_" is from the wrapper-module.


FUNCTION z_fh_anlegen.

  CALL FUNCTION 'BAPI_BUPA_CREATE_FROM_DATA'
    EXPORTING
      businesspartnerextern        = w_businesspartnerextern
      partnercategory              = w_partnercategory
      partnergroup                 = w_partnergroup
      centraldata                  = w_centraldata
      centraldataperson            = w_centraldataperson
      centraldataorganization      = w_centraldataorganization
      centraldatagroup             = w_centraldatagroup
      addressdata                  = w_addressdata
      duplicate_message_type       = w_duplicate_messg
      accept_error                 = w_accept_error
    IMPORTING
      businesspartner              = w_businesspartner
    TABLES
      telefondata                  = w_telefondata
      faxdata                      = w_faxdata
      teletexdata                  = w_teletexdata
      telexdata                    = w_telexdata
      e_maildata                   = w_e_maildata
      rmladdressdata               = w_rmladdressdata
      x400addressdata              = w_x400addressdata
      rfcaddressdata               = w_rfcaddressdata
      prtaddressdata               = w_prtaddressdata
      ssfaddressdata               = w_ssfaddressdata
      uriaddressdata               = w_uriaddressdata
      pagaddressdata               = w_pagaddressdata
      addressnotes                 = w_addressnotes
      communicationnotes           = w_communicationnotes
      communicationusage           = w_communicationusage
      telefondatanonaddress        = w_telefondatanonaddress
      faxdatanonaddress            = w_faxdatanonaddress
      teletexdatanonaddress        = w_teletexdatanonaddress
      telexdatanonaddress          = w_telexdatanonaddress
      e_maildatanonaddress         = w_e_maildatanonaddress
      rmladdressdatanonaddress     = w_rmladdressdatanonaddress
      x400addressdatanonaddress    = w_x400addressdatanonaddress
      rfcaddressdatanonaddress     = w_rfcaddressdatanonaddress
      prtaddressdatanonaddress     = w_prtaddressdatanonaddress
      ssfaddressdatanonaddress     = w_ssfaddressdatanonaddress
      uriaddressdatanonaddress     = w_uriaddressdatanonaddress
      pagaddressdatanonaddress     = w_pagaddressdatanonaddress
      communicationnotesnonaddress = w_communicationnotesnonaddress
      communicationusagenonaddress = w_communicationusagenonaddress
      return                       = w_return
      addressduplicates            = w_addressduplicates.

  COMMIT WORK.

ENDFUNCTION.

my problem now is that i can create BusinessPartners perfectly if i run the FM on the SAP-System.

If i create a WebService from it i cant even consume the WSDL-Document with the JDK-Tool "wsimport" because there is a missing returnType (at least it tells me that there is no return-type).

is there any mistake in my code? did i forget anything?

regards

frank

Former Member
0 Kudos

Hi Frank,

Is this a BAPI you are trying to use by converting it to a Web Service?

You might want to check if this BAPI commits the transaction to the database. Many creation BAPIs do not commit the creation or deletion to the database since it takes away the flexibility with which the user can use the BAPI.

If that is the case, then you need to wrap the BAPI in a function module in which you need to COMMIT TRANSACTION after calling the BAPI and then create a Web Service from this Function Module.

Hope this helps!

Regards,

Romit