Application Development and Automation 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: 
Read only

Refresh Global table in BAPI_AGREEMENTS

Former Member
0 Likes
735

Hi,

I am using the BAPI 'BAPI_AGREEMENTS' to create multiple Rebate Agreements.

When I call the BAPI for the first time, it works perfectly and created the Rebate Agreement document. But when I call the BAPI for the second time, it results in a dump.

The reason for the dump is that, within this BAPI, the Function Module 'AGR_FILL_DEFAULT' is called. It populates a Global internal table GT_T6B1 from table T6B1, after checking that the internal table GT_T6B1 is initial. Then it assigns values to certain Field-Symbols. These Field-Symbols are used later within this same Function Module.

The first time the BAPI is called, the global internal table GT_T6B1 is indeed initial, and hence the Field-Symbols are assigned. But this global table is not refreshed within the BAPI. Hence, when the BAPI is called the second time, the Field-Symbol assignment does not take place. When the code tries to use the Field-Symbols, it results in a dump as the Field-Symbols have not been assigned.

I am using the BAPI 'BAPI_TRANSACTION_COMMIT' to commit the transaction after the BAPI is called. This ought to refresh all buffers, but it is not refreshing this internal table at least. I also called the Function 'BUFFER_REFRESH_ALL' explicitly within my program, but that also is not helping.

Any solutions for this problem? Please share your ideas.

Thanks,

Swagata.

Hi,

I am using the BAPI 'BAPI_AGREEMENTS' to create multiple Rebate Agreements.

When I call the BAPI for the first time, it works perfectly and created the Rebate Agreement document. But when I call the BAPI for the second time, it results in a dump.

The reason for the dump is that, within this BAPI, the Function Module 'AGR_FILL_DEFAULT' is called. It populates a Global internal table GT_T6B1 from table T6B1, after checking that the internal table GT_T6B1 is initial. Then it assigns values to certain Field-Symbols. These Field-Symbols are used later within this same Function Module.

The first time the BAPI is called, the global internal table GT_T6B1 is indeed initial, and hence the Field-Symbols are assigned. But this global table is not refreshed within the BAPI. Hence, when the BAPI is called the second time, the Field-Symbol assignment does not take place. When the code tries to use the Field-Symbols, it results in a dump as the Field-Symbols have not been assigned.

I am using the BAPI 'BAPI_TRANSACTION_COMMIT' to commit the transaction after the BAPI is called. This ought to refresh all buffers, but it is not refreshing this internal table at least. I also called the Function 'BUFFER_REFRESH_ALL' explicitly within my program, but that also is not helping.

Any solutions for this problem? Please share your ideas.

Thanks,

Swagata.

1 REPLY 1
Read only

Former Member
0 Likes
489

I found a workaround and that was sufficient to solve my problem. I created all he Rebate Agreements at once by passing all Rebate Agreements data in the parameter TI_BAPIAGRMNT and called the BAPI a single time. This did not cause dump. Marking this question as closed.