Skip to Content
0

BAPI_PRODORDCONF_GET_HDR_PROP with partial quantity

Jan 25, 2017 at 03:10 PM

273

avatar image

Hello!

I did find a lot of questions around this BADI and even to the same topic of partial quantaties, but no real answer. So:

I want to use

BAPI_PRODORDCONF_GET_HDR_PROP
and
BAPI_PRODORDCONF_CREATE_HDR

for goods receipt and backflush evey time a palett of our product is finished. The problem is that BAPI_PRODORDCONF_GET_HDR_PROP always proposes the complet rest of the prduction order and not the quantaties in relation to the amount I enter for yield.
Because we also use the batch determination strategies it is not done by just recalculating the amounts for the GI.

I tried changing the settings in OPK4 but that did only change the behaviour of CO15.

Thanks a lot!

Horst

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Horst-Dieter Heitmann Feb 06, 2017 at 03:38 PM
0

Hello!

I did find the answer myself.

BAPI_PRODORDCONF_GET_HDR_PROP and BAPI_PRODORDCONF_CREATE_HDR

is not designed for partial yield. So, it does not work with these BAPIs.

What does work is this:

lv_aktyp_p = 'H'.
lv_autyp_qm = '10'.

* check if confirmation is generally possible
CALL FUNCTION 'CO_RU_CONFIRMATION_PREPARE'
EXPORTING
aktyp_imp = lv_aktyp_p
aufnr_imp = lv_aufnr
autyp_imp = lv_autyp_qm
no_dialog_flag = 'X'
IMPORTING
afrud_exp = ls_afrud
afvgd_exp = ls_afvgd
aktyp_exp = lv_aktyp_s
caufvd_exp = ls_caufvd
EXCEPTIONS
order_already_locked = 01
new_status_not_possible = 02
interrupt_by_user = 03
OTHERS = 08.

* confirmation is possible
IF sy-subrc = 0.

* set quantaties, units of measure and text
ls_afrud-lmnga = sl_lqua-einme.
ls_afrud-gmein = sl_lqua-meins.
ls_afrud-meinh = sl_lqua-meins.
ls_afrud-ltxa1 = sl_lqua-lenum.

MOVE ls_afrud TO ls_afrud_tmp.

* check confirmation data
CALL FUNCTION 'CO_RU_CONFIRMATION_CHECK'
EXPORTING
afrud_in = ls_afrud_tmp
aktyp_in = lv_aktyp_s
caufvd_in = ls_caufvd
IMPORTING
afrud_exp = ls_afrud
TABLES
namtab = lt_ftab.

* Change confirmation data
CALL FUNCTION 'CO_RU_EDIT_CONF'
EXPORTING
afrud_imp = ls_afrud
afvgd_imp = ls_afvgd
aktyp_imp = lv_aktyp_s
caufvd_imp = ls_caufvd
coruf_imp = ls_coruf
IMPORTING
afrud_exp = ls_afrud
aktyp_exp = lv_aktyp_s.

CALL FUNCTION 'CO_RU_BT_AFRU_BT_GET'
TABLES
afru_tab = lt_afrubtab
EXCEPTIONS
no_entry = 01.

CALL FUNCTION 'CO_RU_CONFIRMATION_ADD'
EXPORTING
afrud_in = ls_afrud
afvgd_in = ls_afvgd
aktyp_in = 'H'
aktyp_pic_in = 'V'
caufvd_in = ls_caufvd
IMPORTING
caufvd_out = ls_caufvd
TABLES
afrud_tab = lt_afrudtab.

CALL FUNCTION 'CO_RU_CONFIRMATION_POST'
EXPORTING
cprot_flg = 'X'
ext_flg = lv_kreuz
gprot_flg = space
no_back_flush_flg = ''
no_goods_receipt_flg = ''
trans_typ = 'H'
EXCEPTIONS
posting_error = 1.

endif.

So far, this works for me. I'm happy about any suggestion to make this coding better.

Horst

Share
10 |10000 characters needed characters left characters exceeded
Raghu Govindarajan Feb 06, 2017 at 08:45 PM
0

I would use BAPI_PRODORDCONF_GET_TT_PROP and then similar to what you did, change the quantity information on the GOODSMOVEMENTS table and then use BAPI_PRODORDCONF_CREATE_TT to do your confirmation and goods movement. Follow that up with the BAPI_TRANSACTION_COMMIT to commit to the database.

Share
10 |10000 characters needed characters left characters exceeded
Horst-Dieter Heitmann Feb 08, 2017 at 08:13 AM
0

Hello!

Well, did you read my initial post? The problem is the batch determination for back flushing is based on wrong quantaties. If you don't need that functionality than you can just recalculate the proprosed quantaties, that's right.

Horst

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

Ok, in that case, do exactly what I proposed and then when you call the BAPI_PRODORDCONF_CREATE_TT, blank out the batch and let it redetermine it.

0