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

Problem with BAPI: BAPI_GOODSMVT_CREATE

Former Member
0 Likes
757

Hi Experts,

I have a problem with the use of this BAPI: BAPI_GOODSMVT_CREATE

The problem is that i have this code sample in the report.

LOOP AT tg_posicion INTO sl_posicion.

.

.

.

LOOP AT tl_lotes INTO sl_lotes.

sg_goodsmvt_header-pstng_date = sg_cabecera-budat.

sg_goodsmvt_header-doc_date = sg_cabecera-bedat.

sg_goodsmvt_header-header_txt = sg_cabecera-bktxt.

  • begin cba 14012009

sg_goodsmvt_header-ver_gr_gi_slip = '1'.

sg_goodsmvt_header-ver_gr_gi_slipx = 'X'.

  • end cba 14012009

sg_goodsmvt_code-gm_code = '01'.

REFRESH gt_goodsmvt_item.

CLEAR gs_goodsmvt_item.

gs_goodsmvt_item-material = sl_posicion-matnr.

gs_goodsmvt_item-plant = sl_posicion-werks.

gs_goodsmvt_item-stge_loc = sl_posicion-lgort.

gs_goodsmvt_item-batch = sl_lotes-lote.

gs_goodsmvt_item-move_type = '101'.

gs_goodsmvt_item-vendor = sg_cabecera-lifnr.

gs_goodsmvt_item-entry_qnt = sl_posicion-conv.

gs_goodsmvt_item-entry_uom_iso = vl_isocode.

gs_goodsmvt_item-po_number = sg_cabecera-ebeln.

gs_goodsmvt_item-po_item = sl_posicion-ebelp.

gs_goodsmvt_item-mvt_ind = 'B'.

APPEND gs_goodsmvt_item TO gt_goodsmvt_item.

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

goodsmvt_header = sg_goodsmvt_header

goodsmvt_code = sg_goodsmvt_code

IMPORTING

goodsmvt_headret = gs_goodsmvt_headret

materialdocument = gs_materialdocument

matdocumentyear = gs_matdocumentyear

TABLES

goodsmvt_item = gt_goodsmvt_item

return = gt_return.

So far, so good.

The problem is that when i loop at the table tg_position when i want to process the second position, in the ME23N, this item, appears in the purchase order historial but in the first position.

I already debugg the program and in the parameter:

gs_goodsmvt_item-po_item = sl_posicion-ebelp.

when process the second position, it goes with a '00020'.

Does any one know why is this happening?

Please let me know if any one knows...

Thanks in advance,

Regards

Juan Quezada Calderon

ABAP Consultant

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
676

Hi,

Try with this..

call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
      exporting
        input  = gs_goodsmvt_item-po_item
      importing
        output = gs_goodsmvt_item-po_item.

Now you call your : CALL FUNCTION 'BAPI_GOODSMVT_CREATE'.

finally call this:

 call function 'BAPI_TRANSACTION_COMMIT'
      exporting
        wait = 'X'.

    

.

If it not surve your purpose revert back to me.

Anil.

Edited by: Anil Kumar Reddy on Nov 17, 2009 5:06 PM

4 REPLIES 4
Read only

Former Member
0 Likes
677

Hi,

Try with this..

call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
      exporting
        input  = gs_goodsmvt_item-po_item
      importing
        output = gs_goodsmvt_item-po_item.

Now you call your : CALL FUNCTION 'BAPI_GOODSMVT_CREATE'.

finally call this:

 call function 'BAPI_TRANSACTION_COMMIT'
      exporting
        wait = 'X'.

    

.

If it not surve your purpose revert back to me.

Anil.

Edited by: Anil Kumar Reddy on Nov 17, 2009 5:06 PM

Read only

0 Likes
676

Dear Anil,

i did what you recommend me in the previous post, but the same problem still persist.

Please let me know if you know what could it be...

I still try to figure it out.

Thanks in advance.

Juan Quezada

Read only

0 Likes
676

But which problem?

Max

Read only

0 Likes
676

The problem is that when i loop at the table tg_position when i want to process the second position, in the ME23N, this item, appears in the purchase order historial but in the first position.

I already debugg the program and in the parameter:

gs_goodsmvt_item-po_item = sl_posicion-ebelp.

when process the second position, it goes with a '00020'.

Does any one know why is this happening?

Please let me know if any one knows...