Problem BAPI_PO_CREATE1

hi,
i have a proble with Purchase Order for price in the WAERS 'JPY'..
amounts that values in the BAPI in output are multiplied for 100.
Es
LOOP AT lt_itemservdet INTO lw_itemservdet.
    lw_poservices-pckg_no     = lw_itemservdet-pckg_no.
    lw_poservices-line_no     = lw_itemservdet-line_no.
    lw_poservices-outl_ind    = lw_itemservdet-outl_ind.
    lw_poservices-subpckg_no  = lw_itemservdet-subpckg_no.
    lw_poservices-service     = lw_itemservdet-service.
    IF lw_itemservdet-quantity IS INITIAL.
      ADD 1 TO lw_itemservdet-quantity.
    ENDIF.
    lw_poservices-quantity    = lw_itemservdet-quantity.
    lw_poservices-price_unit  = lw_itemservdet-price_unit.
    lw_poservices-gr_price    = lw_itemservdet-gr_price. "    30,0000
    lw_poservices-short_text  = lw_itemservdet-short_text.
    lw_poservices-matl_group  = lw_itemservdet-matl_group.
    lw_poservices-ovf_unlim   = c_flag.
    APPEND lw_poservices TO lt_poservices.
    CLEAR:lw_itemservdet,lw_poservices.
  ENDLOOP.
In outpu in the transaction me23n the price is 3000

question not clear....basically you have to add the coding for conversion,
then pass this value to the bapi like this
    i_services-base_uom = i_new_itms-meins.
    PERFORM assign_price USING waers
                         CHANGING i_new_itms-netpr
                                  i_services-gr_price.
    i_srvacvals-percentage = 100.
    i_srvacvals-serial_no = v_srl_no.
    APPEND i_services.
    APPEND i_srvacvals.
    i_services-pckg_no = i_srvacvals-pckg_no = i_services-subpckg_no.
    i_services-line_no = i_srvacvals-line_no =
                                v_line_no = v_line_no + 1.
    i_services-subpckg_no = space.
    i_services-short_text = i_new_itms-svc_text.
    i_services-quantity   = i_new_itms-menge.
    i_services-base_uom = i_new_itms-meins.
    PERFORM assign_price USING waers
                      CHANGING i_new_itms-netpr
                               i_services-gr_price.
    i_srvacvals-percentage = 100.
    i_srvacvals-serial_no = v_srl_no.
    APPEND i_services.
    APPEND i_srvacvals.
    CLEAR: i_item,i_itemx,
           i_schedule,i_schedulx,
           i_account,i_accountx,
           i_services,i_srvacvals.
  ENDLOOP.
  v_testrun = chk_only.
  EXPORT ztcode TO MEMORY ID ztcode.
  CALL FUNCTION 'BAPI_PO_CREATE1'
       EXPORTING
            poheader          = i_header
            poheaderx         = i_headerx
            testrun           = v_testrun
       IMPORTING
            exppurchaseorder  = i_header-po_number
            expheader         = i_header
       TABLES
            return            = i_return
            poitem            = i_item
            poitemx           = i_itemx
            poschedule        = i_schedule
            poschedulex       = i_schedulx
            poaccount         = i_account
            poaccountx        = i_accountx
            poservices        = i_services
            posrvaccessvalues = i_srvacvals.

Similar Messages

  • Problem in PO  creation using BAPI_PO_CREATE1

    Hi Experts,
    I am creating the PO by using the BAPI_PO_CREATE1.
    I am giving the net price for the material in POITEM-NET_PRICE and also 'X' in POITEMX-NET_PRICE.
    For some material, BAPI is working fine and for some material BAPI is giving the error like 'Net price must be greater than zero'.
    When i tried to create the PO manually for material for which the BAPI is giving the error, the PO was created successfully.  
    I am working on R/3 Release 4.6C.
    Anybody have the suggestion how to resolve this problem?
    Thanks in Advance,
    Abhishek Ingole

    Abhishek,
    It's not your BAPI. That is how your customizing settings are deffined for the PO creation.
    "If you want to create a purchase order without a value, you must set the
    IR indicator to " ".  "
    contact your functional person to check the settings and find out if you need to skip the records with 0 net price.......
    Also you should get this error when you create a PO online. Please try it again with 0 net price.
    Thanks,
    Alchemist.

  • PROBLEM IN USING BAPI_PO_CREATE1

    WHILE CREATING A PO THROUGH BAPI_PO_CREATE1 WITH REFERENCE TO PURCHASE REQUISITION THEN THE ERROR MESSAGES
    ENCOUNTERED ARE
    1.PURCHASE ORDER STILL CONTAINS FAULTY ITEMS.(ERROR MESSAGE- MEPO000)
    2.In case of account assignment, please enter acc. assignment data for item .(ERROR MESSAGE - 06436)

    Hi,
    My suggestion is simple :
    Enter the data in the standard PO creation transaction and see if you get the same error.
    If you do, debug the transaction to see what causes the issue.
    I'm sorry this seems a little long winded but this is a surefire way of finding out what is causing the problem
    Hope this helps.
    Kind regards
    Colin.

  • Problem in uploading multiple PO line items thro bapi_po_create1...

    Hi All,
    I want to upload Purcase details thro BAPI_PO_create1.I am able to upload PO for single line item. If i pass multiple line items i am getting error.
    Error is "Purchase order still contails faulty items".
    Pls see my code,and help to solve this pls.Thanks in Advance.
      *iTEM 1
        ls_poitem-po_item = '00010'.
        ls_poitemx-po_item = '00010'.
        ls_poitemx-po_itemx = 'X'.
        ls_poitem-material = '11C650004'.
        ls_poitemx-material = 'X'.
         ls_poitem-MATL_GROUP = '125'.
         ls_poitemx-MATL_GROUP = 'X'.
         LS_POITEM-STGE_LOC = '1101'.
         LS_POITEMX-STGE_LOC = 'X'.
    MATERIAL DESCRIPTION.
        SELECT SINGLE MAKTX
          FROM MAKT
          INTO ls_poitem-short_text
          WHERE MATNR = ls_poitem-material AND
                SPRAS = 'EN'.
        ls_poitemx-short_text = 'X'.
       ls_poitem-quantity = '100'.
        ls_poitemx-quantity = 'X'.
        ls_poitem-po_unit = 'KG'.
        ls_poitemx-po_unit = 'X'.
        ls_poitem-po_unit_iso = 'KG'.
        ls_poitemx-po_unit_iso = 'X'.
        ls_poitem-net_price = '220.57'.
        ls_poitemx-net_price = 'X'.
        ls_poitem-price_unit = '1'.
        ls_poitemx-price_unit = 'X'.
        LS_POITEM-TAX_CODE = 'NT'.
        LS_POITEMX-TAX_CODE = 'X'.
        LS_POITEM-ACCTASSCAT = 'F'.
        LS_POITEMX-ACCTASSCAT = 'X'.
        ls_poitem-plant = '1100'.
        ls_poitemx-plant = 'X'.
    APPEND : ls_poitem TO gt_poitem,
    ls_poitemx TO gt_poitemx.
    CLEAR:LS_POITEM,LS_POITEMX.
    ITEM 2
        ls_poitem-po_item = '00020'.
        ls_poitemx-po_item = '00020'.
        ls_poitemx-po_itemx = 'X'.
        ls_poitem-material = '11C650003'.
        ls_poitemx-material = 'X'.
    MATERIAL DESCRIPTION.
        SELECT SINGLE MAKTX
          FROM MAKT
          INTO ls_poitem-short_text
          WHERE MATNR = ls_poitem-material AND
                SPRAS = 'EN'.
        ls_poitemx-short_text = 'X'.
        ls_poitem-quantity = '100'.
        ls_poitemx-quantity = 'X'.
        ls_poitem-po_unit = 'KG'.
        ls_poitemx-po_unit = 'X'.
        ls_poitem-po_unit_iso = 'KG'.
        ls_poitemx-po_unit_iso = 'X'.
        ls_poitem-net_price = '230.57'.
        ls_poitemx-net_price = 'X'.
        ls_poitem-price_unit = '1'.
        ls_poitemx-price_unit = 'X'.
        LS_POITEM-TAX_CODE = 'NT'.
        LS_POITEMX-TAX_CODE = 'X'.
        LS_POITEM-ACCTASSCAT = 'F'.
        LS_POITEMX-ACCTASSCAT = 'X'.
        ls_poitem-plant = '1100'.
        ls_poitemx-plant = 'X'.
    APPEND : ls_poitem TO gt_poitem,
    ls_poitemx TO gt_poitemx.
    CLEAR:LS_POITEM,LS_POITEMX.

    Hi Sree,
    Thanks for ur reply. After i passed storage location the PO is created.
    One more problem is multiple schedule line is not created.It considers only the first line alone.
    If possible can u pls give some ideas to solve the problem
    Thanks.

  • Problem in BAPI_PO_CREATE1

    Hello All,
    My requirement is to create an ARIBA PO thru BAPI_PO_CREATE1. IN order to successfully process an ARIBA PO, i need to check the gl account and cost center used. If the first two letter of the cost center is equal to 'BS', then I need to issue out an error message. I have successfully done the checking of the cost center via user exit ZXMEWU10. But my problem is, how do I prevent the creation of PO if there is an error message?  It seems that the function module does not recognized that there is an error encountered and PO is still created.
    Please advice.
    Thanks,
    Jim

    Hi Jim ,
    BAPI will take care of Validations which comes while creation of PO, In ur case make use the point where SAP will calls this User Exit.BAPI will return message thru RETURN tables And u have to call COmmit work based on the return tables
    like tghis.
    <b>    return                    = l_return.--> this is BAPI table entry
    if l_return[] is initial.
        call function 'BAPI_TRANSACTION_COMMIT'
    *     EXPORTING
    *       WAIT          =
    *     IMPORTING
    *       RETURN        =
    endif.</b>
    regards
    Prabhu

  • Problem in Capturing Item text (BAPI_PO_CREATE1 )

    HI  Experts
    I have a problem with the BAPI BAPI_PO_CREATE1 for  PO creation.
    When I pass the values to the BAPI and passing Header text in the table I_PO_HEADER_TXT and Item text in the table I_PO_ITEM_TXT.
    But after the execution of BAPI    I_PO_HEADER_TXT is getting cleared and the same is beiong populated in the table I_PO_ITEM_TXT.
    Is there any way to differentiate Item text and Header text??/
    Thnks in Advance.
    Hari Krishna

    Hi,
    For header texts, pass '00000' as the value to structure field POTEXTHEADER-PO_ITEM.
    Read BAPI documentation regarding header & item texts
    4. Examples of population of BAPI_PO_CREATE1 interface:
    Parameter: POTEXTHEADER
    PO_NUMBER
    PO_ITEM              =                    00000
    TEXT_ID              =                    F01
    TEXT_FORM            =                    *
    EXT_LINE             =                    HEADER TEXT
    Parameter: POTEXTITEM
    PO_NUMBER
    PO_ITEM              =                    00010
    TEXT_ID              =                    F05
    TEXT_FORM            =                    *
    EXT_LINE             =                    ITEM TEXT, ITEM 00010
    Regards
    Vinod
    Edited by: Vinod Kumar on May 21, 2010 4:14 PM

  • BAPI_PO_CREATE1 Condition pricing problem

    Hi Experts,
    I  created the PO through BAPI_PO_CREAE1 according to the below code. In that PO which i created default  condition type "PBXX".But i want condition Type "PB00".so in my BAPI condtion table POCOND i gave  "U" [ POCOND-change_id = 'U' (update) ].But the default "PBXX" is again coming.
    when i give POCOND-change_id = 'I'  (insert)  two condition types are coming(PB00 & PBXX).
    I referred  our forum(sdn) throughly.I won't get solution.
      data: del_date type sy-datum.
    data: ORDER_HEADERS_OUT like BAPISDHD OCCURS 0 WITH HEADER LINE.
    data: ORDER_ITEMS_OUT like BAPISDIT OCCURS 0 WITH HEADER LINE.
    data: ORDER_SCHEDULES_OUT like BAPISDHEDU OCCURS 0 WITH HEADER LINE.
    data: ORDER_PARTNERS_OUT like BAPISDPART OCCURS 0 WITH HEADER LINE.
    data: ORDER_COND_HEAD like BAPICONDHD OCCURS 0 WITH HEADER LINE.
    data: ORDER_COND_ITEM like BAPICONDIT OCCURS 0 WITH HEADER LINE.
    data: ORDER_TEXTHEADERS_OUT like BAPISDTEHD OCCURS 0 WITH HEADER LINE.
    datA: ORDER_TEXTLINES_OUT like BAPITEXTLI OCCURS 0 WITH HEADER LINE.
    data: I_BAPI_VIEW like ORDER_VIEW OCCURS 0 WITH HEADER LINE.
      data: pohead  type bapimepoheader.
      data: poheadx type bapimepoheaderx.
      data: exp_head type bapimepoheader.
      data: return  type table of bapiret2 with header line.
      data: poitem  type table of bapimepoitem with header line.
      data: poitemx type table of bapimepoitemx with header line.
      data: posched  type table of bapimeposchedule with header line.
      data: poschedx type table of bapimeposchedulx with header line.
    data : POTEXTHEADER type table of BAPIMEPOTEXTHEADER with header line .
    data: POTEXTITEM type table of BAPIMEPOTEXT with header line.
    *data: POTEXTITEMx type table of BAPIMEPOTEXTx with header line.
    DATA: POCOND TYPE table of BAPIMEPOCOND with header line.
    DATA: POCONDX TYPE TABLE OF BAPIMEPOCONDX WITH HEADER LINE.
      data: ex_po_number type bapimepoheader-po_number.
    data: itno type i.
    i_bapi_view-HEADER = 'X'.
    i_bapi_view-ITEM = 'X'.
    i_bapi_view-SDSCHEDULE = 'X'.
    i_bapi_view-PARTNER = 'X'.
    i_bapi_view-SDCOND = 'X'.
    i_bapi_view-SDCOND_ADD = 'X'.
    i_bapi_view-TEXT = 'X'.
    *i_bapi_view- = 'X'.
    APPEND I_BAPI_VIEW.
    DATA: SONO LIKE SALES_KEY OCCURS 0 WITH HEADER LINE..
    SONO-VBELN = '0001014145'.
    APPEND SONO.
    CALL FUNCTION 'BAPISDORDER_GETDETAILEDLIST'
      EXPORTING
        i_bapi_view                   = I_BAPI_VIEW
      I_MEMORY_READ                 =
      tables
        sales_documents               = SONO
       ORDER_HEADERS_OUT             =  ORDER_HEADERS_OUT
       ORDER_ITEMS_OUT               =   ORDER_ITEMS_OUT
       ORDER_SCHEDULES_OUT           =  ORDER_SCHEDULES_OUT
      ORDER_BUSINESS_OUT            =
       ORDER_PARTNERS_OUT            =   ORDER_PARTNERS_OUT
      ORDER_ADDRESS_OUT             =
      ORDER_STATUSHEADERS_OUT       =
      ORDER_STATUSITEMS_OUT         =
      ORDER_CONDITIONS_OUT          =
       ORDER_COND_HEAD               =  ORDER_COND_HEAD
       ORDER_COND_ITEM               = ORDER_COND_ITEM
      ORDER_COND_QTY_SCALE          =
      ORDER_COND_VAL_SCALE          =
      ORDER_CONTRACTS_OUT           =
       ORDER_TEXTHEADERS_OUT         = ORDER_TEXTHEADERS_OUT
       ORDER_TEXTLINES_OUT           = ORDER_TEXTLINES_OUT
    BREAK-POINT.
      pohead-comp_code = 'SG20'.
      pohead-doc_type   = 'NB'     .
      pohead-creat_date = sy-datum   .
      pohead-vendor = '0000100040'.
      pohead-purch_org = 'SG20'.
      pohead-pur_group = '001'.
      pohead-langu      = sy-langu   .
      pohead-doc_date   = sy-datum.
      poheadx-comp_code  = c_x.
      poheadx-doc_type   = c_x.
      poheadx-creat_date = c_x.
      poheadx-vendor     = c_x.
      poheadx-langu      = c_x.
      poheadx-purch_org  = c_x.
      poheadx-pur_group  = c_x.
      poheadx-doc_date   = c_x.
    *POTEXTITEM-PO_ITEM = itno.
    *POTEXTITEM-TEXT_ID =
    *POTEXTITEM-TEXT_FORM
    POTEXTHEADER-TEXT_LINE = SONO.
    append POTEXTHEADER.
    Item Level Data
    itno = 10.
    loop at   ORDER_ITEMS_OUT.
      poitem-po_item  = itno.
      poitem-material = ORDER_ITEMS_OUT-material.
      poitem-plant    = 'SG20'.
      poitem-stge_loc = 'SA01'.
      poitem-quantity = ORDER_ITEMS_OUT-REQ_QTY .
      POITEM-NET_PRICE = ORDER_ITEMS_OUT-NET_PRICE.
      append poitem.
      poitemx-po_item    = itno.
      poitemx-po_itemx   = c_x.
      poitemx-material   = c_x.
      poitemx-plant      = c_x .
      poitemx-stge_loc   = c_x .
      poitemx-quantity   = c_x .
      poitemx-tax_code   = c_x .
      poitemx-item_cat   = c_x .
      poitemx-acctasscat = c_x .
      POITEMX-NET_PRICE = C_X.
      append poitemx.
    POTEXTITEM-PO_NUMBER =
    POTEXTITEM-PO_ITEM = itno.
    POTEXTITEM-TEXT_ID = 'F01'.
    *POTEXTITEM-TEXT_FORM
    POTEXTITEM-TEXT_LINE = SONO.
    append POTEXTITEM.
    POCOND-itm_number = ITNO.
    POCOND-cond_st_no = '001'.
    POCOND-COND_COUNT = '01'.
    POCOND-cond_type = 'PB00'.
    POCOND-cond_value = ORDER_ITEMS_OUT-REQ_QTY.
    POCOND-currency = ORDER_ITEMS_OUT-CURRENCY.
    POCOND-CONDISACTI = ' '.
    POCOND-COND_UPDAT = 'X'.
    POCOND-change_id = 'U'.
    APPEND pocond.
    POCONDX-itm_number = ITNO.
    POCONDX-cond_st_no = '001'.
    POCONDX-cond_st_nox = 'X'.
    POCONDX-itm_numberx = 'X'.
    POCONDX-COND_COUNT = 'X'.
    POCONDX-cond_type = 'X'.
    POCONDX-cond_value = 'X'.
    POCONDX-currency = 'X'.
    POCONDX-CONDISACTI =  'X'.
    POCONDX-change_id = 'X'.
    POCONDX-COND_UPDAT = 'X'.
    APPEND POCONDX.
      itno = itno + 10.
    endloop.
      call function 'BAPI_PO_CREATE1'
           EXPORTING
                poheader         = pohead
                poheaderx        = poheadx
                testrun          = ' '
           IMPORTING
                exppurchaseorder = ex_po_number
                expheader        = exp_head
           TABLES
                return           = return
                poitem           = poitem
                poitemx          = poitemx
                poschedule       = posched
                poschedulex      = poschedx
       POTEXTHEADER                 = POTEXTHEADER
       POTEXTITEM   = POTEXTITEM
    POCOND                       = POCOND
        POCONDX                     = POCONDX .
      call function 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
                wait = 'X'.
      if not ex_po_number is initial.
        call function 'DEQUEUE_ALL'.
      else.
        call function 'DEQUEUE_ALL'.
       message i036.
      endif.
      WRITE: / EX_PO_NUMBER.

    Hi Vioth,
          Did you got solution for thsi i am also facing the same problem.If you konw the solution kindly suggest the solution for this
    Thanks in Adavce,
    Regards...............Kishore

  • Problem with bapi_po_create1 missing payment terms

    Hi All,
    I am using LSMW and BAPI method to create PO. I am using BAPI_PO_CREATE1 and providing the payment terms in my load file. The PO is created succesfully but the PO doesnt have the payment terms. I have the update value X. Is there anyway to fix the problem.
    Thanks

    Hi
    Try to check if there's an user-exit where the payment terms is changed or cleared.
    Max

  • Bapi_po_create1 performance problem

    Hello All,
    I am creating multiple Purchase orders in one go from mulitple Purchase requisitions.
    For every single PR, one PO gets created.
    When i try to convert 10 PR's to 10 PO' s through bapi bapi_po_create1, only 5 or 6 PO's are getting created.
    For those PR's where PO not getting created, i get a generic error. Next time i run those faulty PR's, PO's are getting created. There is no issue in coding as all PR's are getting converted to PO's but not at one go.
    It looks to me that this is memory problem.
    Any one face the same situation earlier.
    Any pointers in this direction will be helpful.Awaiting reply at the earliest.
    Best Regards,
    Tarun

    Hi Tarun,
    Better approach would be to loop at each PR and create PO, use COMMIT WORK after each PO creation and then proceed to next one.
    I am not sure , but it might be possible that some data (material data etc) might be locked by one PO while other is trying to access it and hence error occurs.
    Regards,
    Mohaiyuddin

  • Problem net price BAPI_PO_CREATE1

    hello, I did a report that creates purchase orders (BAPI_PO_CREATE1) relates to a contract, I have a problem in the positions of the order shall be taken of the positions of contract prices, while I in the structure (poitem) I pass other prices.
      CALL FUNCTION 'BAPI_PO_CREATE1'
        EXPORTING
          poheader         = w_headercreate
          poheaderx        = w_headercreatex
        IMPORTING
          exppurchaseorder = d_oda
          expheader        = w_expheader
        TABLES
          return           = i_po_return
          poitem           = i_po_item
          poitemx          = i_po_itemx
          poaccount        = i_po_account
          poaccountx       = i_po_accountx.
    help
    Edited by: francesco aiello on Dec 17, 2009 12:17 PM
    Edited by: francesco aiello on Dec 17, 2009 12:22 PM

    risolto

  • Service fields problem in BAPI_PO_CREATE1 function

    hi all,
    I have a problem when I use BAPI_PO_CREATE1 to create a Purchasing order.
    I want to create a service PO in the system ( R3 4.6C ) .  I have the data from our key user and I can create PO sucessfully manually. But when using BAPI, It alway occurs a error.
    I use POSERVICE Structure, But i have NO idea about which field is MUST, Is there anyone have an example about these service PO??
    Any suggestion is helpful and thanks in advance.
    Regards
    Ned

    hi,
    WELCOME TO SDN.
    use this program for creating service po's using bapi.
    *& Report  ZMM_PO_CREATE1                                              *
    REPORT  ZMM_PO_CREATE1                          .
    data : POHEADER like BAPIMEPOHEADER occurs 0 with header line,
           POHEADERX like BAPIMEPOHEADERX occurs 0 with header line,
           POITEM like BAPIMEPOITEM occurs 0 with header line,
           POITEMX like BAPIMEPOITEMX occurs 0 with header line,
           POESLLC like BAPIESLLC occurs 0 with header line,
           POACCOUNT like BAPIMEPOACCOUNT occurs 0 with header line,
           POACCOUNTX like BAPIMEPOACCOUNTX occurs 0 with header line,
           POCONDHEADER like BAPIMEPOCONDHEADER occurs 0 with header line,
           POCONDHEADERX like BAPIMEPOCONDHEADERX occurs 0 with header line,
           POCOND like BAPIMEPOCOND occurs 0 with header line,
           RETURN like BAPIRET2 occurs 0 with header line.
    data : po_no(10).
    data : begin of it_head occurs 0,
           ref(10),
           bsart like ekko-bsart,
           lifnr like ekko-lifnr,
           ekorg like ekko-ekorg,
           ekgrp like ekko-ekgrp,
           bukrs like ekko-bukrs,
           verkf like ekko-verkf,
           telf1 like ekko-telf1,
           ihrez like ekko-ihrez,
           unsez like ekko-unsez,
           kdatb(10),
           kdate(10),
           end of it_head.
    data : begin of it_det occurs 0,
           ref(10),
           knttp like ekpo-knttp,
           pstyp like ekpo-pstyp,
           txz01 like ekpo-txz01,
           matkl like ekpo-matkl,
           werks like ekpo-werks,
           afnam like ekpo-afnam,
           ktext1 like esll-ktext1,
           srvpos like esll-srvpos,
           frmval1 like esll-frmval1,
           frmval2 like esll-frmval2,
           menge like esll-menge,
           kostl like eskn-kostl,
           sakto like eskn-sakto,
           zzcode like eskn-zzcode,
           kbetr like konv-kbetr,
           end of it_det.
    data : c_col1 TYPE i VALUE '0001',
           c_col2 TYPE i VALUE '0002',
           c_col3 TYPE i VALUE '0003',
           c_col4 TYPE i VALUE '0004',
           c_col5 TYPE i VALUE '0005',
           c_col6 TYPE i VALUE '0006',
           c_col7 TYPE i VALUE '0007',
           c_col8 TYPE i VALUE '0008',
           c_col9 TYPE i VALUE '0009',
           c_col10 TYPE i VALUE '0010',
           c_col11 TYPE i VALUE '0011',
           c_col12 TYPE i VALUE '0012',
           c_col13 TYPE i VALUE '0013',
           c_col14 TYPE i VALUE '0014',
           c_col15 TYPE i VALUE '0015',
           c_col16 TYPE i VALUE '0016'.
    data : v_currentrow type i,
           v_currentrow1 type i.
    data : itab_head like ALSMEX_TABLINE occurs 0 with header line,
           itab_det like ALSMEX_TABLINE occurs 0 with header line.
    data : file_head type RLGRAP-FILENAME,
           file_item type RLGRAP-FILENAME.
    file_head = 'C:\Documents and Settings\Desktop\head.xls'.
    file_item = 'C:\Documents and Settings\Desktop\item.xls'.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = file_head
        i_begin_col                   = 1
        i_begin_row                   = 1
        i_end_col                     = 12
        i_end_row                     = 50
      tables
        intern                        = itab_head
    EXCEPTIONS
      INCONSISTENT_PARAMETERS       = 1
      UPLOAD_OLE                    = 2
      OTHERS                        = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = file_item
        i_begin_col                   = 1
        i_begin_row                   = 1
        i_end_col                     = 16
        i_end_row                     = 50
      tables
        intern                        = itab_det
    EXCEPTIONS
      INCONSISTENT_PARAMETERS       = 1
      UPLOAD_OLE                    = 2
      OTHERS                        = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF itab_head[] IS INITIAL.
       WRITE:/ 'No Header Data  Exists '.
       STOP.
    ELSE.
    sort itab_head by row col.
    read table itab_head index 1.
    v_currentrow = itab_head-row.
    loop at itab_head.
    if itab_head-row ne v_currentrow.
       APPEND it_head.
       v_currentrow = itab_head-row.
       ENDIF.
    CASE itab_head-col.
            WHEN  c_col1.
              it_head-ref = itab_head-value.
            WHEN  c_col2.
              it_head-bsart = itab_head-value.
            WHEN c_col3.
              it_head-lifnr = itab_head-value.
            WHEN c_col4.
              it_head-ekorg = itab_head-value.
            WHEN c_col5.
              it_head-ekgrp = itab_head-value.
            WHEN c_col6.
              it_head-bukrs = itab_head-value.
            WHEN c_col7.
              it_head-verkf = itab_head-value.
            WHEN c_col8.
              it_head-telf1 = itab_head-value.
            WHEN c_col9.
              it_head-ihrez = itab_head-value.
            WHEN c_col10.
              it_head-unsez = itab_head-value.
            WHEN c_col11.
              it_head-kdatb = itab_head-value.
            WHEN c_col12.
              it_head-kdate = itab_head-value.
    ENDCASE.
    ENDLOOP.
    APPEND it_head.
    CLEAR it_head.
    ENDIF.
    IF itab_det[] IS INITIAL.
       WRITE:/ 'No Item Data  Exists '.
       STOP.
    ELSE.
    sort itab_det by row col.
    read table itab_det index 1.
    v_currentrow1 = itab_det-row.
    loop at itab_det.
    if itab_det-row ne v_currentrow1.
       APPEND it_det.
       v_currentrow1 = itab_det-row.
       ENDIF.
    CASE itab_det-col.
            WHEN  c_col1.
              it_det-ref = itab_det-value.
            WHEN  c_col2.
              it_det-knttp = itab_det-value.
            WHEN c_col3.
              it_det-pstyp = itab_det-value.
            WHEN c_col4.
              it_det-txz01 = itab_det-value.
            WHEN c_col5.
              it_det-matkl = itab_det-value.
            WHEN c_col6.
              it_det-werks = itab_det-value.
            WHEN c_col7.
              it_det-afnam = itab_det-value.
            WHEN c_col8.
              it_det-srvpos = itab_det-value.
            WHEN c_col9.
              it_det-ktext1 = itab_det-value.
            WHEN c_col10.
              it_det-frmval1 = itab_det-value.
            WHEN c_col11.
              it_det-frmval2 = itab_det-value.
            WHEN c_col12.
              it_det-menge = itab_det-value.
            WHEN c_col13.
              it_det-kostl = itab_det-value.
            WHEN c_col14.
              it_det-sakto = itab_det-value.
            WHEN c_col15.
              it_det-zzcode = itab_det-value.
            WHEN c_col16.
              it_det-kbetr = itab_det-value.
    ENDCASE.
    ENDLOOP.
    APPEND it_det.
    CLEAR it_det.
    ENDIF.
    loop at it_head.
    poheader-doc_type = it_head-bsart.
    poheader-vendor = it_head-lifnr.
    poheader-purch_org = it_head-ekorg.
    poheader-pur_group = it_head-ekgrp.
    poheader-comp_code = it_head-bukrs.
    poheader-sales_pers = it_head-verkf.
    poheader-telephone = it_head-telf1.
    poheader-REF_1 = it_head-ihrez.
    poheader-OUR_REF = it_head-unsez.
    poheader-VPER_START = it_head-kdatb.
    poheader-VPER_END = it_head-kdate.
    loop at it_det where ref = it_head-ref.
      poitem-acctasscat = it_det-knttp.
      poitem-item_cat = it_det-pstyp.
      poitem-short_text = it_det-txz01.
      poitem-matl_group = it_det-matkl.
      poitem-plant = it_det-werks.
      poitem-PREQ_NAME = it_det-afnam.
      POESLLC-SERVICE = it_det-srvpos.
      POESLLC-SHORT_TEXT = it_det-ktext1.
      POESLLC-FORM_VAL1 = it_det-frmval1.
      POESLLC-FORM_VAL2 = it_det-frmval2.
      POESLLC-QUANTITY = it_det-menge.
      POACCOUNT-COSTCENTER = it_det-kostl.
      POACCOUNT-GL_ACCOUNT = it_det-sakto.
      POCONDHEADER-COND_TYPE = 'R000'.
      POCONDHEADER-COND_VALUE = it_det-kbetr.
    endloop.
    endloop.
    poheaderx-doc_type = 'X'.
    poheaderx-vendor = 'X'.
    poheaderx-purch_org = 'X'.
    poheaderx-pur_group = 'X'.
    poheaderx-comp_code = 'X'.
    poheaderx-sales_pers = 'X'.
    poheaderx-telephone = 'X'.
    poheaderx-REF_1 = 'X'.
    poheaderx-OUR_REF = 'X'.
    poheaderx-VPER_START = 'X'.
    poheaderx-VPER_END = 'X'.
    poitemx-acctasscat = 'X'.
    poitemx-item_cat = 'X'.
    poitemx-short_text = 'X'.
    poitemx-matl_group = 'X'.
    poitemx-plant = 'X'.
    poitemx-PREQ_NAME = 'X'.
    *POESLLCx-SHORT_TEXT = 'X'.
    POACCOUNTx-COSTCENTER = 'X'.
    POACCOUNTx-GL_ACCOUNT = 'X'.
    POCONDHEADER-cond_type = 'X'.
    CALL FUNCTION 'BAPI_PO_CREATE1'
      EXPORTING
        poheader                     = poheader
       POHEADERX                    = poheaderx
      POADDRVENDOR                 =
      TESTRUN                      =
      MEMORY_UNCOMPLETE            =
      MEMORY_COMPLETE              =
      POEXPIMPHEADER               =
      POEXPIMPHEADERX              =
      VERSIONS                     =
      NO_MESSAGING                 =
      NO_MESSAGE_REQ               =
      NO_AUTHORITY                 =
      NO_PRICE_FROM_PO             =
    IMPORTING
       EXPPURCHASEORDER             = po_no
      EXPHEADER                    =
      EXPPOEXPIMPHEADER            =
    TABLES
       RETURN                       = return
       POITEM                       = poitem
       POITEMX                      = poitemx
      POADDRDELIVERY               =
      POSCHEDULE                   =
      POSCHEDULEX                  =
       POACCOUNT                    = poaccount
      POACCOUNTPROFITSEGMENT       =
       POACCOUNTX                   = poaccountx
       POCONDHEADER                 = pocondheader
       POCONDHEADERX                = pocondheaderx
      POCOND                       =
      POCONDX                      =
      POLIMITS                     =
      POCONTRACTLIMITS             =
       POSERVICES                   = poesllc
      POSRVACCESSVALUES            =
      POSERVICESTEXT               =
      EXTENSIONIN                  =
      EXTENSIONOUT                 =
      POEXPIMPITEM                 =
      POEXPIMPITEMX                =
      POTEXTHEADER                 =
      POTEXTITEM                   =
      ALLVERSIONS                  =
      POPARTNER                    =
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
       WAIT          =
    IMPORTING
       RETURN        =
    if sy-subrc = 0.
    loop at return.
    write return-MESSAGE_V1.
    write po_no.
    endloop.
    endif.

  • Problem while Error Handling thru BAPI_PO_CREATE1

    Hi,
    currently im facing problem while generating error thru BAPI_PO_CREATE1
    im calling bapi two times thru loop iteration,
    as my data is faulty , so for 1st iteration im getting 3 error in it_return structure.
    now in 2nd iteration im getting (3+3)
    repeted error which is geenarated earlier(old 3 err) +(new 3 err).
    im refreshing all internal table,work areas and variables, still im getting same problem,
    please provide ur kind suggestion on this.
    refresh : <all it>
    clear  : <all wa>
    Loop at it into wa.
    refresh : it_return.
    CALL FUNCTION 'BAPI_PO_CREATE1'
    Tables = IT_RETURN
    endloop.
    Regards
    Vivek Khobragade

    hi,
    I found that Im getting duplicates error because of  passing
    BAPIMEPOITEM - PREQ_NO (Purchase Requisition Number)
    BAPIMEPOITEM - PREQ_ITEM (Item Number of Purchase Requisition)
    . if I dont pass these then I wont get duplicates error.
    but as functional told its mandatory to update it?
    please have eye on it?
    regards
    Vivek

  • Problems in the EXTENSIONIN Parameter of BAPI_PO_CREATE1

    Hello Experts,
    I have a cfeild in the table EKKO and want to fill it.
    I have try it over the EXTENSIONIN Parameter of BAPI_PO_CREATE1, but it doesn't work.
    The strucurtes BAPI_TE_MEPOHEADER and BAPI_TE_MEPOHEADERX has also the required customerfields included
    Some Ideas? why it doesn'works ?
    Thanx in Advance
    REPORT  Z_BAPI_PO_CREATE1.
    DATA: LS_POHEADER   TYPE TABLE OF BAPIMEPOHEADER WITH HEADER LINE  .
    DATA: LS_POHEADERX  TYPE TABLE OF BAPIMEPOHEADERX WITH HEADER LINE.
    DATA: LT_RETURN     type TABLE OF BAPIRET2.
    DATA: LT_POITEM     TYPE TABLE OF BAPIMEPOITEM  WITH HEADER LINE.
    DATA: LT_POITEMX    type TABLE OF BAPIMEPOITEMX WITH HEADER LINE .
    DATA: LT_ACCOUNT    type TABLE OF BAPIMEPOACCOUNT WITH HEADER LINE .
    DATA: LT_ACCOUNTX   TYPE TABLE OF BAPIMEPOACCOUNTX WITH HEADER LINE .
    DATA: LT_ADDRDELIV  type BAPIMEPOADDRDELIVERY .
    *********************Setze HEADER**************************
    LS_POHEADER-DOC_TYPE      = 'Z028'.
    LS_POHEADER-CREAT_DATE    = '01032006'.
    LS_POHEADER-ITEM_INTVL    = '00001'.
    *LS_POHEADER-VENDOR       = '0021000000'.
    LS_POHEADER-SUPPL_PLNT    = '4700' .
    LS_POHEADER-PURCH_ORG     = '2700' .
    LS_POHEADER-PUR_GROUP     = '701' .
    LS_POHEADER-CURRENCY      = 'EUR' .
    APPEND LS_POHEADER .
    *********************Setze HEADERX**************************
    LS_POHEADERX-DOC_TYPE    = 'X' .
    LS_POHEADERX-CREAT_DATE  = 'X' .
    LS_POHEADERX-ITEM_INTVL  = 'X' .
    LS_POHEADERX-SUPPL_PLNT  = 'X' .
    *LS_POHEADERX-VENDOR     = 'X' .
    LS_POHEADERX-PURCH_ORG   = 'X' .
    LS_POHEADERX-PUR_GROUP   = 'X' .
    LS_POHEADERX-CURRENCY    = 'X' .
    APPEND LS_POHEADERX .
    *********************Setze ITEMS**************************
    LT_POITEM-PO_ITEM                     = '00001' .
    LT_POITEM-MATERIAL                    = '023JK513' .
    LT_POITEM-PLANT                       = '4700' .
    LT_POITEM-STGE_LOC                    = '7001' .
    LT_POITEM-QUANTITY                    = '1' .
    LT_POITEM-PO_UNIT                     = 'PC' .
    LT_POITEM-ACCTASSCAT                  = 'K' .
    LT_POITEM-PERIOD_IND_EXPIRATION_DATE  = 'D' .
    APPEND LT_POITEM .
    *********************Setze ITEMSX**************************
    LT_POITEMX-PO_ITEM        = '00001' .
    LT_POITEMX-PO_ITEMX       = 'X' .
    LT_POITEMX-MATERIAL       = 'X' .
    LT_POITEMX-PLANT          = 'X' .
    LT_POITEMX-STGE_LOC       = 'X' .
    LT_POITEMX-QUANTITY       = 'X' .
    LT_POITEMX-PO_UNIT        = 'X' .
    LT_POITEMX-PERIOD_IND_EXPIRATION_DATE = 'X' .
    LT_POITEMX-ACCTASSCAT                  = 'X' .
    APPEND LT_POITEMX .
    *********************Setze ACCOUNTPARAMETER**************************
    LT_ACCOUNT-COSTCENTER = '1301000001' .
    LT_ACCOUNT-PO_ITEM    = '00001' .
    APPEND LT_ACCOUNT .
    LT_ACCOUNTX-COSTCENTER = 'X' .
    LT_ACCOUNTX-PO_ITEM    = '00001' .
    APPEND LT_ACCOUNTX .
    DATA:       ls_bapi_te_po_header    type          BAPI_TE_MEPOHEADER,
                ls_bapi_te_po_headerx    type          BAPI_TE_MEPOHEADERX,
                ls_bapi_extension       type          BAPIPAREX,
                it_bapi_extension       type table of BAPIPAREX           WITH HEADER LINE.
    ********************Setze EXTENSIONIN**************************
    ls_bapi_extension-structure     = 'BAPI_TE_MEPOHEADER' .
    *ls_bapi_te_po_header-po_number  = '' .
    ls_bapi_te_po_header-cfield    = '8204' .
    ls_bapi_extension-valuepart1    = ls_bapi_te_po_header .
    append ls_bapi_extension to it_bapi_extension .
    clear ls_bapi_extension .
    ls_bapi_extension-structure     = 'BAPI_TE_MEPOHEADERX' .
    *ls_bapi_te_po_header-po_number  =  '' .
    ls_bapi_te_po_headerx-cfield    = 'X' .
    ls_bapi_extension-valuepart1     = ls_bapi_te_po_headerx .
    append ls_bapi_extension to it_bapi_extension .
    CALL FUNCTION 'BAPI_PO_CREATE1'
      EXPORTING
        POHEADER    = LS_POHEADER
        POHEADERX   = LS_POHEADERX
      TABLES
        RETURN      = LT_RETURN
        POITEM      = LT_POITEM
        POITEMX     = LT_POITEMX
        POACCOUNT   = LT_ACCOUNT
        POACCOUNTX  = LT_ACCOUNTX
        EXTENSIONIN = it_bapi_extension
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

    Hello,
    thank you for your response
    The Problem was on the BADI below:
    it wasn't implemented.
    BAPI_PO_CREATE1->PERFORM move_data_in ->PERFORM move_extensionin->PERFORM move_container_in->CALL BADI lr_badi->map2i_extensionin
    CALL BADI lr_badi->map2i_extensionin
            EXPORTING
              im_container = im_container
              im_name      = im_name
              im_error     = lf_exit
            CHANGING
              ch_struc     = ch_struc.
    Best Regards

  • Problem while creating service PO using bapi_po_create1

    hi all,
        i am getting error :
    In case of account assignment, please enter acc. assignment data for item
    what does this mean?
    please help,,
    thanks,
    Siddhartha Prakash

    Hi Sid.
    I'm having this same problems on creating PO Service. Did you solve it? How did you do that?
    I'm using a PR and the Category is 'Y', and I cant find where is the problem.
    The tables that I'm passing to the BAPI_PO_CREATE1 are:
    POITEM/ POITEMX
    POACCOUNT/ POACCOUNTX
    POSERVICES
    POSRVACCESSVALUES
    Please, if you have any idea, let me know!
    Tks a lot!
    Renata

  • Problem creating Header Condition in BAPI_PO_CREATE1

    Hello Gurus,
       I am having problems with creating a header conditions using the BAPI BAPI_PO_CREATE1. I am filling up table such as: POCONDHEADER, POCONDHEADERX.
    It creates a PO document but the header conditions I supplied is not included.
    How do I go about this?
    Can you guys give a sample code for this?
    Need your urgent response on this matter.
    Thanks,
    Jeffrey

    Hai
    Check the following Code
    DATA: g_s_poheader    TYPE bapimepoheader,
          g_s_poheaderx   TYPE bapimepoheaderx.
    DATA: l_no_messaging       TYPE char1.  
    DATA: bednr                LIKE wvfb-bednr.
    DATA: l_t_return            LIKE bapiret2  OCCURS 0.
    DATA: l_t_poitem          STRUCTURE bapimepoitem,
          l_t_poitemx         STRUCTURE bapimepoitemx,
          l_t_poschedule      STRUCTURE bapimeposchedule,
          l_t_poschedulex     STRUCTURE bapimeposchedulx,
          l_t_poaccount       STRUCTURE bapimepoaccount,
          l_t_poaccountx      STRUCTURE bapimepoaccountx,
          l_t_pocond          STRUCTURE bapimepocond,
          l_t_pocondx         STRUCTURE bapimepocondx.
      CALL FUNCTION 'BAPI_PO_CREATE1'
        EXPORTING
          poheader                     = g_s_poheader
          poheaderx                    = g_s_poheaderx
          no_messaging                 = l_no_messaging  "RWI-47-20-messaging
       IMPORTING
          exppurchaseorder             = bednr
      EXPHEADER                    =
       TABLES
          return                       = l_t_return
          poitem                       = l_t_poitem
          poitemx                      = l_t_poitemx
      POADDRDELIVERY               =
          poschedule                   = l_t_poschedule
          poschedulex                  = l_t_poschedulex
          poaccount                    = l_t_poaccount
      POACCOUNTPROFITSEGMENT       =
          poaccountx                   = l_t_poaccountx
          pocond                       = l_t_pocond
          pocondx                      = l_t_pocondx.
    Thanks & regards
    Sreenivasulu P

Maybe you are looking for

  • I have airport extreme 802.11AC as a base that connect to Cable modem. How can I connect D-link DIR-655 to AE to utilize as an extender or repeat?

    Hello- I have wireless router Airport Extreme 802.11AC that connect direct to Cable modem...how can I setup the D-Link DIR-655 wireless router to AE and act as extender or repeater?. Thanks in advance.

  • F-30 Post with clearing screen 734, need document number with line item

    We are trying to use the 'line item' selection for F-30 transfer postings, for when we are only clearing certain line items for a document number. I have seen this done at other clients, but when we go to the line item in additional selections, it gi

  • 9.3.0 Update Failed.

    Hi all, Trying to update Acrobat Pro to 9.3.0 has consistently failed. Any idea how this can be fixed? Attached log showing failure at a specific file. Executing ApplyOperation.py for payload: 2 Start Time-   02/09/10  14:21:09 /bin/mkdir -p -m 775 '

  • Flash ad not working in MACS...

    Hi. I created a banner ad in flash. I followed the instructions to make a button in the tutorial. For one layer I created an invisible button, etc. Then on another layer I added a keyframe at the very beginning and entered this actionscript: inv_btn.

  • ITunes does not "populate" in ilife

    When I attempt to create a slideshow with music in iphoto, my itunes music does not show up in the "music" area.  itunes is open, and I have created a playlist specific to this slideshow.  I can chose the themes and the settings, but the itunes windo