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

BAPI_PROCORDCONF_CREATE_TT problem

Former Member
0 Likes
4,067

Dear Experts,

I want to do process order confirmation using BAPI BAPI_PROCORDCONF_CREATE_TT.

But when I execute the below code, it create only 261 and 531 movement with initial and parent_id and reset the line_id.

I have search for this bapi, but no any correct process found.

Please advice, if anyone used this bapi with correct answer.

PARAMETERS: p_pstdat LIKE bapi2017_gm_head_01-pstng_date DEFAULT sy-datum,

             p_docdat  LIKE bapi2017_gm_head_01-doc_date DEFAULT sy-datum,

             p_matnr    LIKE bapi2017_gm_item_create-material DEFAULT 'HRCH06W03CSL',

             p_plant    LIKE bapi2017_gm_item_create-plant DEFAULT '3110',

             p_sloc     LIKE bapi2017_gm_item_create-stge_loc DEFAULT 'WH01',

             p_iquant    LIKE bapi2017_gm_item_create-entry_qnt DEFAULT '2.214',

             p_oquant    LIKE bapi2017_gm_item_create-entry_qnt DEFAULT '2.000',

             p_batch    LIKE bapi2017_gm_item_create-batch DEFAULT '3RW881A2',

             p_ord TYPE aufm-aufnr DEFAULT '000001002816',

             p_rsnum TYPE resb-rsnum DEFAULT '000000027582'.

PARAMETERS : p_omatnr LIKE bapi2017_gm_item_create-material DEFAULT 'HRCH06W03CSL',

              p_oscr LIKE bapi2017_gm_item_create-material DEFAULT 'HR-SCR-O',

              p_oscrqt LIKE bapi2017_gm_item_create-entry_qnt DEFAULT '0.214',

              p_osloc LIKE bapi2017_gm_item_create-stge_loc DEFAULT 'WP01'.

PARAMETERS : p_test AS CHECKBOX DEFAULT 'X'.

*-----Table athdrlevels-------------------------

ls_athdrlevels-orderid = p_ord.

ls_athdrlevels-fin_conf = 'X'.

ls_athdrlevels-clear_res = 'X'.

ls_athdrlevels-postg_date = p_pstdat.

ls_athdrlevels-conf_quan_unit = 'TON'.

ls_athdrlevels-phase = '0020'.

*ls_athdrlevels-yield = '99'.

*ls_athdrlevels-Conf_Acti_Unit1 = '

APPEND ls_athdrlevels TO lt_athdrlevels. CLEAR ls_goodsmovements.

*------Line 1 movment type 261-------------------

ls_goodsmovements-material = p_matnr.

ls_goodsmovements-plant   = p_plant.

ls_goodsmovements-stge_loc = p_sloc.

ls_goodsmovements-batch = p_batch.

ls_goodsmovements-move_type = '261'.

ls_goodsmovements-entry_qnt = p_iquant.

ls_goodsmovements-entry_uom = 'TON'.

ls_goodsmovements-mvt_ind = 'F'.

ls_goodsmovements-line_id = '1'.

ls_goodsmovements-parent_id = '1'.

ls_goodsmovements-orderid = p_ord.

ls_goodsmovements-reserv_no = p_rsnum.

ls_goodsmovements-res_item = '0001'.

ls_goodsmovements-activity = '0020'.

APPEND ls_goodsmovements TO lt_goodsmovements. CLEAR ls_goodsmovements.

*------Table goodsmovements------------------------

*------Line 1 movment type 101-------------------

ls_goodsmovements-material = p_omatnr.

ls_goodsmovements-plant   = p_plant.

ls_goodsmovements-stge_loc = p_osloc.

CONCATENATE p_batch 'D' INTO ls_goodsmovements-batch.

ls_goodsmovements-move_type = '101'.

ls_goodsmovements-entry_qnt = p_oquant.

ls_goodsmovements-entry_uom = 'TON'.

*ls_goodsmovements-mvt_ind = 'F'.

ls_goodsmovements-line_id = '2'.

ls_goodsmovements-parent_id = '1'.

ls_goodsmovements-orderid = p_ord.

ls_goodsmovements-reserv_no = p_rsnum.

ls_goodsmovements-res_item = '0001'.

ls_goodsmovements-activity = '0020'.

APPEND ls_goodsmovements TO lt_goodsmovements. CLEAR ls_goodsmovements.

*------Line 1 movment type 531-------------------

ls_goodsmovements-material = p_oscr.

ls_goodsmovements-plant   = p_plant.

ls_goodsmovements-stge_loc = 'WSR1'.

*ls_goodsmovements-batch = p_batch.

ls_goodsmovements-move_type = '531'.

ls_goodsmovements-entry_qnt = p_iquant - p_oquant.

ls_goodsmovements-entry_uom = 'TON'.

*ls_goodsmovements-mvt_ind = 'F'.

ls_goodsmovements-line_id = '3'.

ls_goodsmovements-parent_id = '1'.

ls_goodsmovements-orderid = p_ord.

*ls_goodsmovements-RESERV_NO = P_RSNUM.

*ls_goodsmovements-RES_ITEM = '0001'.

APPEND ls_goodsmovements TO lt_goodsmovements.

*----Table link_conf_goodsmov-----------------------

*------Line 1 for movment 101-------------------

ls_link_conf_goodsmov-index_confirm = '1'.

ls_link_conf_goodsmov-index_goodsmov = '1'.

APPEND ls_link_conf_goodsmov TO lt_link_conf_goodsmov.

*------Line 2 for movment 261-------------------

ls_link_conf_goodsmov-index_confirm = '1'.

ls_link_conf_goodsmov-index_goodsmov = '2'.

APPEND ls_link_conf_goodsmov TO lt_link_conf_goodsmov.


*------Line 3 for movment 531-------------------

ls_link_conf_goodsmov-index_confirm = '1'.

ls_link_conf_goodsmov-index_goodsmov = '3'.

APPEND ls_link_conf_goodsmov TO lt_link_conf_goodsmov.

CALL FUNCTION 'BAPI_PROCORDCONF_CREATE_TT'

   EXPORTING

     post_wrong_entries = '2'

     testrun            = p_test

   IMPORTING

     return             = ls_return

   TABLES

     timetickets        = lt_athdrlevels

     goodsmovements     = lt_goodsmovements

     link_conf_goodsmov = lt_link_conf_goodsmov

     detail_return      = lt_detail_return.

BREAK-POINT.

IF p_test IS INITIAL and ls_return is initial.

   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.

Regards,

Narendra

13 REPLIES 13
Read only

Former Member
0 Likes
2,952

Experts,

Pl. reply, its urgent.

Read only

0 Likes
2,952

Hi Narendra,

Check these Notes :

Note 1586230 - FAQ: Confirmation using BAPI in production order

Note 437377 - Entering confirmations by BAPI

Regard's

Smruti

Read only

0 Likes
2,952

Thanks Smruti,

But It is not useful for me. I want example code with my above mentioned requirement.

Regards,

Narendra

Read only

Former Member
0 Likes
2,952

There must have been a COGI entry created for the movement type 101. Check the COGI transaction for the error details.

Also note that this BAPI creates three different goods movement documents because there are three different movement types in your case.

Read only

0 Likes
2,952

Dear,

It create single material document, but only with movement 261 and 531. but 101 movement appear in COGI with error "

Update control of movement type is incorrect (entry 101 X X)"

and why it clear the Parent_id and reset line_id fields with new value.

Regards.

Read only

0 Likes
2,952

Plz reply,

plz help, is there any way to get the movement with confirmation.

regards,

narendra

Read only

Former Member
0 Likes
2,952

Its urgent, any expert who help me.

Plz, suggest the solution. how can i do it.

Read only

0 Likes
2,952

try using movement indicator "F"  for movement type 101. check possible values for movement indicator and use appropriate indicator.

ls_goodsmovements-mvt_ind = 'F'.

check the following link

http://scn.sap.com/thread/619756..

if not 'F' then check with other possible values like "B",etc.

Read only

0 Likes
2,952

Dear,

I have checked it but it is not working.

Please suggest any other solution.

I want to create a single material document with multiple 101, 261 and 531 with link of line_id and parent_id and confirmation also.

Read only

0 Likes
2,952

HI Narendra

Maybe your problem is related to the field  MVT... When you are doing goods issue this field must be empty or comented (i mean, for movement types 261 and 531) , but you have to use 'F' in this indicator when  u r doing movement 101, so, it would be like this:

*------Line 1 movment type 261-------------------

ls_goodsmovements-material = p_matnr.

ls_goodsmovements-plant   = p_plant.

ls_goodsmovements-stge_loc = p_sloc.

ls_goodsmovements-batch = p_batch.

ls_goodsmovements-move_type = '261'.

ls_goodsmovements-entry_qnt = p_iquant.

ls_goodsmovements-entry_uom = 'TON'.

*ls_goodsmovements-mvt_ind = 'F'. "This must be comented

ls_goodsmovements-line_id = '1'.

ls_goodsmovements-parent_id = '1'.

ls_goodsmovements-orderid = p_ord.

ls_goodsmovements-reserv_no = p_rsnum.

ls_goodsmovements-res_item = '0001'.

ls_goodsmovements-activity = '0020'.

APPEND ls_goodsmovements TO lt_goodsmovements. CLEAR ls_goodsmovements.

*------Table goodsmovements------------------------

*------Line 1 movment type 101-------------------

ls_goodsmovements-material = p_omatnr.

ls_goodsmovements-plant   = p_plant.

ls_goodsmovements-stge_loc = p_osloc.

CONCATENATE p_batch 'D' INTO ls_goodsmovements-batch.

ls_goodsmovements-move_type = '101'.

ls_goodsmovements-entry_qnt = p_oquant.

ls_goodsmovements-entry_uom = 'TON'.

ls_goodsmovements-mvt_ind = 'F'. "You have tou use this indicator in here

ls_goodsmovements-line_id = '2'.

ls_goodsmovements-parent_id = '1'.

ls_goodsmovements-orderid = p_ord.

ls_goodsmovements-reserv_no = p_rsnum.

ls_goodsmovements-res_item = '0001'.

ls_goodsmovements-activity = '0020'.

APPEND ls_goodsmovements TO lt_goodsmovements. CLEAR ls_goodsmovements.

*------Line 1 movment type 531-------------------

ls_goodsmovements-material = p_oscr.

ls_goodsmovements-plant   = p_plant.

ls_goodsmovements-stge_loc = 'WSR1'.

*ls_goodsmovements-batch = p_batch.

ls_goodsmovements-move_type = '531'.

ls_goodsmovements-entry_qnt = p_iquant - p_oquant.

ls_goodsmovements-entry_uom = 'TON'.

*ls_goodsmovements-mvt_ind = 'F'. "this is fine, is comented....

ls_goodsmovements-line_id = '3'.

ls_goodsmovements-parent_id = '1'.

ls_goodsmovements-orderid = p_ord.

*ls_goodsmovements-RESERV_NO = P_RSNUM.

*ls_goodsmovements-RES_ITEM = '0001'.

APPEND ls_goodsmovements TO lt_goodsmovements.

i shlould work in this way....

Best Regards!

Read only

0 Likes
2,952

Hi Daniel,

I have a requirement to create 101, 261 and 531 all in single material document. Is it possible through BAPI_PRODORDCONF_CREATE_TT? Please let me know at the earliest.

Regards

Read only

0 Likes
2,952

Hi Baiju PS!

No, you can not post all those movements in a single material document. I strugle myself some time ago with this and making a research to find the reason why, i found SAP NOTE 540392 Q/A 10 that says:

"for technical reasons, goods receipts and goods issues must be

transferred in separate packages of inventory management. This leads

to the different material documents."

I know when you post the production order via CO11N, 261,531 and 101 are in the same material document, but when you do it with that BAPI ( That is supposed this is how CO11N works ) it just put the movements in separated material documents.

Best Regards!

Read only

0 Likes
2,952

Hi Daniel,

Its possible, please check this

Regards,