cancel
Showing results for 
Search instead for 
Did you mean: 

Integration framework 2.0: POST HTTP Call (Payload and Error)

fabio_ubbiali
Explorer

Dear experts,

I'm having some difficulties with using HTTP (POST) calls using the HTTA adapter via B1IF 2.0

a. Manage Payload

I found some difficulties in creating the payload because in 2.0 it is not necessary to create a preparation atom with all properties like in version 1.0 (httppreparationatom-v1.xml), but just write the payolad in the XPath Expression and other properties in the adapter.

Below you can see a working example. I can't understand:

  1. How is it able to identify the correct payload (payloadTEST) excluding the cookie tag that is used in the adapter.

<call>
	<payloadTEST>
		<io pltype="json">
			<object>
				<string name="DocEntry">220010</string>
				<string name="LineNumber">100</string>
				<string name="LineNumber2">10</string>
				<string name="LineNumber3">0</string>
				<string name="TimeType">A</string>
				<string name="CloseEntry">true</string>
				<string name="ManualBooking">true</string>
				<string name="Duration">60</string>
				<string name="CalculateDuration">false</string>
				<string name="Remarks">TEST B1IF</string>
			</object>
		</io>
	</payloadTEST>
	<cookie>testcookie=20220404101949236818656</cookie>
</call>

b. Manage Error

The other problem I've encountered is on the error handling.

If the payload format is wrong or the operation cannot be executed, the layer returns ERROR 400 and the B1IF throws an exception. Is it possible to catch and manage the response of the layer error in the step?

Thanks in advance.

Fabio

Accepted Solutions (1)

Accepted Solutions (1)

fabio_ubbiali
Explorer
0 Kudos

Hi Sainath,

I solved my error handling problem in this thread.

Hope it can be helpful.

Fabio

Answers (3)

Answers (3)

0 Kudos

Hi Fabio,

I'm trying to use B1DI to add customer details. If the error is default SAP restriction say Duplicate Customer Code is not allowed I'm getting it as Failure in Response. But if the error is from the SPTransaction Notification I'm getting the below internal server error and not as a response "failure" in the second screenshot. Could you please tell me how to get this internal server error "Customer Ref. No. Cannot be Duplicated" which is from SP Transaction notification as a response. This is my Response atom.

Default SAP restriction:

SP Transaction notification Restriction:

How can I get the error response like below instead of the error in the screenshot {"Response": [ {"Result": "failure","ActionMessage": " Exception : DI Error: (-10) 1320000140 - Business partner code 'OP-8512578' Customer name cannot be duplicate-The di call #1 did fail."}],}

],

fabio_ubbiali
Explorer
0 Kudos

Try to use the ThrowException param set to false in the Envelope atom (I'm not so expert of B1DI in the B1IF 2.0) and also try to read the Request documentation.

I also suggest to open your own community post to let other experts to evaluate your case 😉

Fabio

0 Kudos

Hi Fabio,

Thank you for your response. This is my setup. Should I add the HTTA atom in between the PrepareB1 and CallB1 or change the CallB1 from B1DI to HTTA and add the configuration in the thread you referred.

fabio_ubbiali
Explorer
0 Kudos

Hi Rajesh,

it depends on what your goal is.

My original post was about a call to an external WS (if it is your goal too change B1DI with HTTA)

If instead you need to do an operation on SAPB1 use B1DI or B1SL depending on your environment and needs.

Also check out this usefull playlist: https://www.youtube.com/watch?v=a2z_LnJ1AxA&list=PLMdHXbewhZ2Sils0OrNUsVS-g69EaQnEe

Fabio

0 Kudos

Hi Fabio,

I'm having the same issue, whenever there is an error say if it's from the SPTransactionNotification I get it like this in Postman but when I try it with an API Call from application there is no response.

I get this error in API call correctly when the error is from Default SAP Application but when the error is not a default configuration I'm not getting the error message like this. can you please help