Skip to Content
0

Issue of BAPI_BUS1077_CHANGE in AT_SAVE_CHECK of BADI impl of 'EHSS_SPEC_CHECKS'

Feb 21, 2017 at 06:34 PM

196

avatar image
Former Member

Hi Team,

The requirement is to update the 'Supplier Name' property of value assignment type 'SUPPLIER' during the save of the specification(Tcode:CG02) if the 'Supplier Name' is changed after the last save of the specification. The 'Supplier Name' should be changed during the change and save of any of the field of the specification like Specification Header, Identifier etc.

I have created a standalone report to change the property(Supplier Name) of value assignment type 'SUPPLIER' using the BAPI 'BAPI_BUS1077_CHANGE'.

I have used the guidelines provided in the report 'RC1_1077_BAPI_EXAMPLE_CHANGE' method ‘test_change_prop_data’.

The standalone report is working fine and I am able to change the property 'Supplier Name' successfully, But when I call the same report from the method 'AT_SAVE_CHECK' of BADI impl of 'EHSS_SPEC_CHECKS' the calls are happening back and forth from the BAPI 'BAPI_BUS1077_CHANGE' to method

'AT_SAVE_CHECK' and from method to BAPI. I have put a flag(to call the BAPI only once) and came out of the loop and have checked the return parameter of the BAPI 'BAPI_BUS1077_CHANGE' and the error is 'The data record is locked and cannot be changed', 'At least one lock error occurred during processing'.

Any help in this regard is greatly appreciated.

Thank & Regards,

Kiran Kumar

10 |10000 characters needed characters left characters exceeded

Dear Kirna

check may be https://www.dev-workbench.com/sap-dictionary/function-group/c1e0/. You will find an SAP based exmaple to use the method

May be consider potentially this OSS note (http://www.stechno.net/sap-notes.html?id=1265122)

C.B.

0
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Christoph Bergemann Feb 23, 2017 at 07:39 PM
0

Dear Kirna

I am sorry to say. i do not 100% understand your scenario and doubts.

With reference to:

"The standalone report is working fine and I am able to change the property 'Supplier Name' successfully, But when I call the same report from the method 'AT_SAVE_CHECK' of BADI impl of 'EHSS_SPEC_CHECKS' the calls are happening back and forth from the BAPI 'BAPI_BUS1077_CHANGE' to method"

"Normally" the BADI EHSS_SPEC_CHECKS' (and method AT_SAVE_CHECK) is "designed" to work in EHS. E.g. user change same data and then you can "trigger" subsequent actions using this approach.

For your report. i do not get the "Business" nor the "technical" "Message". If the report is planned as a "job" then the report will have some kind of "trigger" logic. For "offline" reports in most cases the "change documents" is the trigger factor. So the report might detect: there was a change...

BUt then if you process the "change" (using some business/program logic) you should not use the BADI but the BAPIs/APIs to save whatever result in database.

In any case. your topic is to "customer specific" so no real help is possible without deep knowledge of code etc.

C.B.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Feb 27, 2017 at 05:37 AM
0

Thank you Christoph for your response.

Actually the requirement is to update the 'Supplier Name' property of value assignment type 'SUPPLIER' when the specification is saved from the transaction code 'CG02'.

To achieve the requirement I have created a sample report (attached) with selection screen parameter's 'Specification Number' and 'Change Number'.

When I call the report in the BADI 'EHSS_SPEC_CHECKS' method 'AT_SAVE_CHECK' using the statement 'Submit Z_samplecode with p_recn = w_subid with p_aennr = w_aennr and return', the calls are happening back and forth from the method to report and from report to method.

Below is the data selection criteria used for filling the BAPI data.

SAP recommends the BAPI function modules BAPI_BUS1077_CREATE, BAPI_BUS1077_CHANGE, BAPI_BUS1077_DELETE in the 'AT_SAVE_CHECK' and am using one of those but I don't understand why calls are happening back and forth.

As suggested in Note '800918', I have even tried removing the 'BAPI_BUS1077_CLEARBUFFER' after the 'BAPI_BUS1077_GETDETAIL' but still the issue remains.

Any suggestions in the code or others alternatives is greatly appreciated.

Thanks & Regards,

Kiran Kumar


z-samplecode.txt (7.2 kB)
Share
10 |10000 characters needed characters left characters exceeded
Mark Pfister
Feb 27, 2017 at 12:11 PM
0

Hi Kiran,

You say that your report is called in the "AT_SAVE_CHECK" .

Within your report you call the SAVE BADI

BAPI_BUS1077_SAVEFROMBUFFER'

and I think therefore the "AT_SAVE_CHECK" is executed again - and therefore your report is called gain -> you call the save BAPI in your report -> the "AT_SAVE_CHECK" is executed again ... This is why you're ending up in an endless loop.

Since your coding is already in the save process there is no need to call the SAVE BADI!

If you execute the report stand alone however you would need it....

Hope this helps

Mark

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Feb 27, 2017 at 02:53 PM
0

Hi Mark,

I am calling the report from the BADI 'EHSS_SPEC_CHECKS' method 'AT_SAVE_CHECK' because the change to the VAT property has to happen when saving the specification from tcode 'CG02'..

Even I think the same that we are ending into endless loop because the BAPI_BUS1077_CHANGE is calling the BADI method 'AT_SAVE_CHECK' and vice versa.

But SAP recommends calling the BAPI function modules BAPI_BUS1077_CREATE, BAPI_BUS1077_CHANGE, BAPI_BUS1077_DELETE in the 'AT_SAVE_CHECK'. The same is found in BADI 'EHSS_SPEC_CHECKS' method 'AT_SAVE_CHECK' documentation, though we are following what SAP has recommended I wonder why it is going into loop.

Any other thoughts to achieve the requirement.

Thanks & Regards,

Kiran Kumar

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Kiran,

It is fine to call the BAPI_BUS1077_CREATE, BAPI_BUS1077_CHANGE, BAPI_BUS1077_DELETE - in the at SAVE-CHECK - but do not call the

BAPI_BUS1077_SAVEFROMBUFFER

as the save will happen anyhow....

Cheers

Mark

0
avatar image
Former Member Mar 01, 2017 at 07:33 PM
0

Hi Mark,

I have already checked the scenario by not calling the BAPI_BUS1077_SAVEFROMBUFFER but still the issue persists.

Thanks & Regards,

Kiran Kasula

Share
10 |10000 characters needed characters left characters exceeded