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_po_create1

0 Likes
2,109

Hi,

I have created an abap programm to create Purchase Orders using the FM BAPI_PO_CREATE1.

The program creates Purchase Orders successfully.

The problem is that when users open purchase orders using 'me22n' or 'me23n' transactions they get the following information message on Delivery tab of the purchase order:

Customizing table of period indicators is incomplete - Message no. 12145

Is this an issue?

When I create a P.O. using FM BAPI_PO_CREATE1 (using transaction se37 without using my abap code) the P.O. that created does not give this Information message through me22n or me23n transactions.

What am I doing wrong?

Thanks.

10 REPLIES 10
Read only

former_member206479
Participant
0 Likes
1,555

Hi,

Before going to use BAPI create PO manually and observe what are minimum required data you have provided and find for any incomplete log. Make sure that while using BAPI you passed the value as like manual PO creation.

Regards,

Venkat.

Read only

gouravkumar64
Active Contributor
0 Likes
1,555

Hi,

As per research I found that,You have to maintain some customization for this like

under SPRO>MM >Purchasing>maintain display type for date/period.

check this thread and follow jurgen's reply,it's may help,

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

Thanks

Gourav.

Read only

0 Likes
1,555

But if this a customization issue why this message does not appear when I create a PO executing FM from se37 and not from my ABAP program?

Thanks

Read only

Former Member
0 Likes
1,555

check you import and export parameter and table as follow.

CALL FUNCTION 'BAPI_PO_CREATE1'

          EXPORTING

            poheader         = header

            poheaderx        = headerx

          IMPORTING

            exppurchaseorder = exppurchaseorder

          TABLES

            return           = return[]

            poitem           = item[]

            poitemx          = itemx[]

            poaccount        = ipoaccount[]

            poaccountx       = ipoaccountx[]

            pocond           = ipocond[]

            pocondx          = ipocondx[].

Read only

Former Member
0 Likes
1,555

check following logic to pass import and export parameters

DATA: wa LIKE LINE OF i_data.

   LOOP AT i_data.
     wa = i_data.

     header-pmnttrms = 'V000'.

     IF header-pur_group IS INITIAL.
       header-pur_group  = wa-ekgrp.
     ENDIF.

     IF header-purch_org IS INITIAL.
       header-purch_org = wa-ekorg.
     ENDIF.

     AT NEW kostl.
       SUM.
       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
         EXPORTING
           input  = wa-lifnr
         IMPORTING
           output = wa-lifnr.

       v_counter       = v_counter + 10.

       item-po_item    = v_counter.
       item-material   = 'FREIGHT'.
       item-plant      = wa-werks.
       item-quantity   = 1.
       item-net_price  = i_data-afriegh.
       item-acctasscat = 'K'.
       item-tax_code   = wa-mwskz.
       item-order_reason = 'NR'.
       APPEND item.
       CLEAR: item.

       itemx-po_item     = v_counter.
       itemx-po_itemx    = c_x.
       itemx-material    = c_x.
       itemx-plant       = c_x.
       itemx-quantity    = c_x.
       itemx-net_price   = c_x.
       itemx-acctasscat  = c_x.
       itemx-tax_code    = c_x.
       itemx-order_reason = c_x.
       APPEND itemx.
       CLEAR: itemx.

       ipoaccount-po_item    = v_counter.
       ipoaccount-costcenter = wa-kostl.
       ipoaccount-gl_account = wa-saknr.
       ipoaccount-serial_no  = '00'.
       APPEND ipoaccount.
       CLEAR ipoaccount.

       ipoaccountx-po_item    = v_counter.
       ipoaccountx-costcenter = c_x.
       ipoaccountx-gl_account = c_x.
       APPEND ipoaccountx.
       CLEAR ipoaccountx .

       ipocond-itm_number    = v_counter.
       ipocond-cond_type     = WRITE YOUR CONDITION TYPE.
       ipocond-cond_st_no    = '000'.
       ipocond-cond_count    = '00'.
       ipocond-cond_value    = i_data-afriegh.
       ipocond-currency      = 'INR'.
       ipocond-cond_unit     = 'EA'.
       ipocond-change_id     = 'U'.
       APPEND ipocond.
       CLEAR  ipocond.

       ipocondx-itm_number   = c_x.
       ipocondx-cond_type    = c_x.
       ipocondx-cond_st_no   = c_x.
       ipocondx-cond_count   = c_x.
       ipocondx-cond_value   = c_x.
       ipocondx-currency     = c_x.
       ipocondx-cond_unit    = c_x.
       ipocondx-change_id    = c_x.
       APPEND ipocondx.
       CLEAR  ipocondx.
     ENDAT.

     AT LAST.
       header-comp_code  = '1000'.
       header-doc_type   = WRITE YOUR CONDITION TYPE.
       header-vendor     = wa-lifnr.
       header-currency   = 'INR'.
       header-PMNTTRMS   = 'V000'.
       APPEND header.

       headerx-comp_code  = c_x.
       headerx-doc_type   = c_x.
       headerx-vendor     = c_x.
       headerx-purch_org  = c_x.
       headerx-pur_group  = c_x.
       headerx-currency   = c_x.
       headerx-pmnttrms   = c_x.

       APPEND headerx.

       IF p_run IS INITIAL.
         CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
           EXPORTING
             percentage = '20'
             text       = 'Process Is Running'.

         CALL FUNCTION 'BAPI_PO_CREATE1'
           EXPORTING
             poheader         = header
             poheaderx        = headerx
           IMPORTING
             exppurchaseorder = exppurchaseorder
           TABLES
             return           = return[]
             poitem           = item[]
             poitemx          = itemx[]
             poaccount        = ipoaccount[]
             poaccountx       = ipoaccountx[]
             pocond           = ipocond[]
             pocondx          = ipocondx[].

         CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
           EXPORTING
             percentage = '60'
             text       = 'Process Is Running'.

         CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
             wait = 'X'.
         IF exppurchaseorder IS NOT INITIAL.
           WRITE: 'Purchase Order Created', exppurchaseorder.
         ELSE.
           LOOP AT return WHERE type EQ 'E'.
             WRITE: / '----------------------------------------------------------------------------------------'.
             WRITE: / return-message.
             WRITE: / return-message_v1.
             WRITE: / return-message_v2.
             WRITE: / return-message_v3.
             WRITE: / return-message_v4.
             WRITE: / '----------------------------------------------------------------------------------------'.
           ENDLOOP.
         ENDIF.
       ENDIF.
       REFRESH:
         header,
         headerx,
         item,
         itemx,
         ipoaccount,
         ipoaccountx,
         return.
       CLEAR: header.
     ENDAT.

Read only

0 Likes
1,555

If it is a customization issue why this message does not apear when I create the PO using FM from se37 and not from my ABAP program?

Thanks

Read only

Former Member
0 Likes
1,555

Hi,

Please check the delivery date passed by you is updated in the PO or not.

Check both PO data created by program and by SE37.

Some date conversion issue I suppose.

Regards

Read only

Former Member
0 Likes
1,555

Please check  under TABLES 'poschedulex' parameters passed with required values for FM BAPI_PO_CREATE1'

Read only

0 Likes
1,555

I have tried all this with no luck.

When after PO creation go to transaction me22n and save the PO the message stops!

The question is if this message create other problems that I can not imagine.

Read only

0 Likes
1,555

I had the same issue. It turned out to be that sto was created using 'D',   which is not specified in config. Please check Rem shelf life in sto delivery tab, with your config in SPRO>MM >Purchasing>maintain display type for date/period.

Also you can specify which period indicator your want to use in bapi. Once I switched it to use 'W', the error went away.

  ls_poitem-period_ind_expiration_date = 'W'.