Application Development 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: 

Which BAPI/FM allow to update AFPO-CHARG field (BATCH)

dstjacques
Participant
0 Kudos

Hello everyone

Some FM are available to update batch in the component level of a production order.
CO_XT_COMPONENT_CHANGE
CO_XT_ORDER_PREPARE_COMMIT

The following BAPI and FM doesn't allow to change the field "AFPO-CHARG".
CO_BI_AFPO_UPD doesn't work. It always returning sy-subrc = 1.
BAPI_PRODORD_CHANGE doesn't have the field "CHARG" in the structure.

Is anyone has an idea which FM or BAPI can be used to update the field AFPO-CHARG?

Regards
stjacqd

1 ACCEPTED SOLUTION

dstjacques
Participant
0 Kudos

For the benefits of all.

The solution we have used is:

Using user exit EXIT_SAPLV01Z_002 and add the appropriate code to overwrite the field "CHARG"

This user exit is called at the Production order release action through BAPI_PRODORD_RELEASE.

If anyone has another solution to assign the AFPO-CHARG field without to have to release the Production order, Fill free to add it to this post.

Regards

5 REPLIES 5

NTeunckens
Active Contributor
0 Kudos

Hello Daniel

What is the MessageID / Number of the Error upon Using "CO_BI_AFPO_UPD" and does it help using "CO_BI_AFPO_*" Functions to Fetch the AFPO-data beforehand?

The FM "CO_VB_ORDER_POST" has a Form 'AFPO_POST' (see Include "LCOVBF10"), but this is a complex / critical FM to be using for this (I would not recommend it) ...


Kind regards

Nic T.

dstjacques
Participant
0 Kudos

Hello Nic

Thank you for your answer.

The function CO_BI_AFPO_UPD is only raising the "ERROR_READ_AFPO" exception.

Doing some debugging, the function is reading an internal table "AFPO_BT" and if the record is not there, the exception flag is raise. No matters if the record is physically in the table or not.

I tried to use the function CO_BI_AFPO_GET and CO_BI_AFPO_CREATE to fill up the internal table AFPO_BT without success.

I am afraid the FM "CO_VB_ORDER_POST" is also using the internal table AFPO_BT.


Maybe, if I can find the right way to populate the internal table 'AFPO_BT" it will solve my problem. But for now, I didn't succeed to do it.

Regards

0 Kudos

Hello Daniel

In our System the FM "VB_CP_HEADER_DATA" provides the AFPO-Result. Otherwhise you could just Query AFPO-Table an Store the Result in AFPOD-Structure ...

PS : By 'Commenting' (rather than Answering) your Correspondents will get Notified on your Update ... Now, I luckily went through some Posts and saw your Update ...


Hope this helps

Nic T.

dstjacques
Participant
0 Kudos

For the benefits of all.

The solution we have used is:

Using user exit EXIT_SAPLV01Z_002 and add the appropriate code to overwrite the field "CHARG"

This user exit is called at the Production order release action through BAPI_PRODORD_RELEASE.

If anyone has another solution to assign the AFPO-CHARG field without to have to release the Production order, Fill free to add it to this post.

Regards

ramki2
Explorer
0 Kudos

"Otherwhise you could just Query AFPO-Table an Store the Result in AFPOD-Structure ..." - I've the same requirement, it's not working !

As per my understanding, this FM CO_BI_AFPO_UPD will work in only BADI implementation "WORKORDER_UPDATE" - IF_EX_WORKORDER_UPDATE~AT_SAVE Method.