Bapi: kbpp_extern_update_co, tcode: cj30/CJ40 Part 4

Source: Internet
Author: User

When function module: kbpp_extern_update_co is used for cj41, the budget estimate cannot be completely updated, indicating that the budget estimate is smaller than the existing budget estimate. This problem is also mentioned in other blog posts. In short, if you want to update all estimates at a time, there is no chance of success.

Analyze the cause of the problem. If I need to increase the budget estimate of A WBS node, if you do not increase the budget estimate from the upper layer of the WBS node, an error will be reported if you directly modify it, if the budget estimate of a wbs node needs to be adjusted slightly, it should be modified from the root node to the upper layer. However, if some layers become larger and some become smaller, it will be complicated.

Is there a simple way? After debugging, even if an error is reported, some nodes are successfully updated. If the same group of data is used and executed several times, all the modifications are completed. So to simplifyProgramThe same group of data is called multiple times. If an error is found, the function is called again. If there is no error at all, the function is stopped. The number of executions, which is the same as the number of WBS in your data.CodeAs follows:


SortLt_wbsByStufe.

LoopAtLt_wbsIntoLs_wbs.

ClearLt_bpak.
SelectSingleObjnrIntoLt_bpak-E_objnr
FromPRPs
WherePspnr=Ls_wbs-Pspnr.

lt_bpak - e_vorga = ' kstp ' .
lt_bpak - e_versn = '000' .
lt_bpak - twaer = cns_waers .
lt_bpak - wert = ls_wbs - zgssum .
append lt_bpak .
endloop .

"Call bapi cyclically, the number of times is the same as the number of project levels
data : l_times type I .
data : l_flag type C .

SortLt_wbsByStufeDescending.
ReadTableLt_wbsIntoLs_wbsIndex1.
Rochelle times=Ls_wbs-Stufe.

DoRochelle timesTimes.

RefreshLt_return [].

Call Function 'Kbpp _ extern_update_co'
Exporting
I _budget_activity = 'Kstp'
* I _budget_activ_sup_ret =''
* I _commit_data =''
I _delta_amounts = '' "X indicates appending, and" null "indicates substitution.
I _rollup_data = '' "X indicates summary to the top layer
* I _check_plan_data =''
* I _application =
I _commit_all = 'X'
* Importing
* E_errors_found =
Tables
It_bpak = Lt_bpak
It_return = Lt_return
Exceptions
No_update = 1
Others = 2
.
Clear Rochelle flag .
Loop At Lt_return Where Type = 'E' .
Rochelle flag = 'X' .
Endloop .

IfRochelle flagIsInitial.
Exit."If no error exists, exit the loop.
Endif.

Enddo.

LoopAtLt_returnWhereType='E'.
Rochelle flag='X'.
Exit.
* Message e000 with 'item estimate update failed:' LT_RETURN-MESSAGE.
Endloop.

IfRochelle flagIsInitial.
CommitWork.
MessageS000With'Project'P_pspid'The estimated cost is updated successfully. '.
Else.
RollbackWork.

Endif.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.