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

error in bapi_po_change

Former Member
0 Likes
1,909

hi,

i m updating the existing PO which has 2 line item,i passed two new line items with schedule line data.

but it is showing faulty data in return of FM - bapi_po_change.

and item table change from 2 to 4 rows after executing bapi_po_change.

hi,

i m updating the existing PO which has 2 line item,i passed two new line items with schedule line data.

but it is showing faulty data in return of FM - bapi_po_change.

and item table change from 2 to 4 rows after executing bapi_po_change.

17 REPLIES 17
Read only

Former Member
0 Likes
1,858

Hi Dakshu,

Please fill the POSCHEDULEX table also. In this table mention the line item number and provide 'X' for all the fields that needs to be changed.

If this table is not filled, the BAPI will try to create new line items for the records filled in POSCHEDULE table.

Thanks,

Manikandan JN.

Read only

0 Likes
1,858

i filled both schedule n schedulex table...

do i need to change value from  'X' to 'U' anywhr.

Read only

madhu_vadlamani
Active Contributor
0 Likes
1,858

Hi,

How you are filling new line items with indicator.

Regards,

Madhu.

Read only

0 Likes
1,858

new data in item table with indicator 'X' in itemx table.

Read only

0 Likes
1,858

Hi,

This is from documenataion.

Parameter: POITEM

PO_ITEM=00001
CONF_CTRL=0001

Parameter: POITEMX

PO_ITEM=00001
PO_ITEMX=X
CONF_CTRL= X

Parameter: POSCHEDULE

PO_ITEM=00001
SCHED_LINE=0001
QUANTITY=10.000
PO_ITEM=00001
SCHED_LINE=0003
DELETE_IND= X

Parameter: POSCHEDULEX

PO_ITEM= 00001
SCHED_LINE= 0001
PO_ITEMX= X
SCHED_LINEX= X
QUANTITY= X
PO_ITEM= 00001
SCHED_LINE= 0003
PO_ITEMX= X
SCHED_LINEX= X
DELETE_IND=X

Parameter: POACCOUNT

Read only

Former Member
0 Likes
1,858

Hi,

Pass required values for POITEMX(i.e 'X') in the BAPI_PO_CHANGE function module.

Regards,

venkat.

Read only

0 Likes
1,858

did that

Read only

0 Likes
1,858

Hi,

Just paste the piece of that code.

Read only

0 Likes
1,858

LOOP AT i_ekko INTO w_ekko.
     purchase = w_ekko-num.

     header-po_number = w_ekko-num.
     APPEND header ."TO header1.
     headerx-po_number = 'X'.

     APPEND  headerx ."TO headerx1.

     LOOP AT i_ekpo INTO w_ekpo WHERE num = w_ekko-num.
       item-po_item = w_ekpo-ebelp.
       item-material = w_ekpo-matnr.
       item-plant = w_ekpo-werks.
       item-quantity = w_ekpo-menge.
       item-net_price = w_ekpo-netpr.
       APPEND item TO item1.

       itemx-po_item = 'X' .
       itemx-material ='X' .
       itemx-plant = 'X' .
       itemx-quantity = 'X' .
       itemx-net_price = 'X' .
       APPEND itemx TO itemx1.
       LOOP AT i_eket INTO w_eket WHERE ebelp = w_ekpo-ebelp.
         schedule-po_item = w_eket-ebelp.
         schedule-sched_line = w_eket-etenr.
         schedule-delivery_date = w_eket-eindt.
         schedule-quantity = w_eket-menge.
         APPEND schedule TO schedule1.

         schedulex-po_item = 'X'.
         schedulex-sched_line = 'X'.
         schedulex-delivery_date = 'X'.
         schedulex-quantity = 'X'.
         APPEND schedulex TO schedulex1.

         SELECT SINGLE ebelp eindt menge INTO (l_item , l_date , l_quant)
         FROM eket WHERE ebeln = purchase AND ebelp = w_ekpo-ebelp.
         versions-completed = 'X'.

         IF w_eket-eindt <> l_date.
           versions-reason = 'Z001'.
         ELSEIF w_eket-menge <> l_quant.
           versions-reason = 'Z002'.
         ELSEIF w_eket-ebelp <> l_item.
           versions-reason = 'Z003'.
         ENDIF.
         APPEND versions TO versions1.
         CLEAR w_eket.
       ENDLOOP.
     ENDLOOP.

Read only

0 Likes
1,858

Hi,

With this are you trying to add or change.

Regards,

Madhu.

Read only

0 Likes
1,858

ya

Read only

0 Likes
1,858

Hi,

For schedules lines pass some value with out any loop and see .Keep X only for the line items to be added.

Regards,

Madhu.

Read only

0 Likes
1,858

did,still showing same error

Purchase order still contains faulty item

Read only

0 Likes
1,858

Hi Dakshu,

You have forgot to mention the line item number and ITEMX and SCHEDULEX table.

Just make the below change in your code.

       itemx-po_item = w_ekpo-ebelp .

       itemx-po_itemx = 'X' .

       itemx-material ='X' .
       itemx-plant = 'X' .
       itemx-quantity = 'X' .
       itemx-net_price = 'X' .
       APPEND itemx TO itemx1.

         schedulex-po_item = w_ekpo-ebelp.
         schedulex-sched_line =
w_eket-etenr.

         schedulex-po_itemx = 'X'.
         schedulex-sched_linex =
'X'.

         schedulex-delivery_date = 'X'.
         schedulex-quantity = 'X'.
         APPEND schedulex TO schedulex1.

Thanks,

Manikandan JN


Read only

0 Likes
1,858

thanks did this too.

still same error

Read only

0 Likes
1,858

Hi Dakshu,

I am a bit confused over the following statements.

     header-po_number = w_ekko-num.
     APPEND header ."TO header1.
     headerx-po_number = 'X'.
     APPEND  headerx ."TO headerx1.

HEADER and HEADERX are structures and I think you have treated them as tables.

If you need to change multiple POs, call the BAPI within the loop.

I feel something is wrong with this APPEND. Just a have a look at this please.

Thanks,

Manikandan JN.

Read only

0 Likes
1,858

Thanks a lot

its done