Skip to Content

Me21 Bapi

Hi Experts,

I am Trying to use a Bapi for Po , by me21,

I am using flat file to import a po no.

I am getting Eror like

1. Please Enter Material no. and Account Assignment

2. Document Contain no items.

DcDATE DcTYP COCOD porg PGRP VENDOR ITEM MATERIAL AC.ASSIGN PLANT ITPRICE DELIV DATE

23012010 ZINC 1200 1200 JOB 0000150013 100 W40SS930 D 1210 19.00 25012010

Thanks..

Regards:

Heman

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jan 25, 2010 at 04:38 AM

    Dear Heman,

    I think u r using BAPI_PO_CREATE. Read the Documentation of that BAPI . Then u come to know that where to insert the values.

    See the Structures of the BAPI .

    With Regards,

    Sumodh.P

    Add a comment
    10|10000 characters needed characters exceeded

    • hi Niraj I am doing the same procedure,

      i a sending you my sorce code,

      if there I am doing some thing wrong plz tell me.

      REPORT ZBAPI_CREATE_PO.

      DATA:

      PO_HEADER TYPE TABLE OF BAPIMEPOHEADER WITH HEADER LINE,

      PO_HEADERX TYPE TABLE OF BAPIMEPOHEADERX WITH HEADER LINE,

      PURITEM TYPE TABLE OF BAPIMEPOITEM WITH HEADER LINE,

      PURITEMX TYPE TABLE OF BAPIMEPOITEMX WITH HEADER LINE,

      RETURN TYPE TABLE OF BAPIRET2 WITH HEADER LINE.

      DATA: PURORDNUMBER LIKE BAPIMEPOHEADER-PO_NUMBER,

      CTR type I ,

      CTR2 TYPE STRING,

      CTR1 TYPE STRING.

      SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE HEADERS.

      PARAMETERS:

      P_LIFNR TYPE EKKO-LIFNR, "Vendor Account Number

      P_BUKRS TYPE EKKO-BUKRS, "Company Code

      P_BSART TYPE EKKO-BSART default 'NB', "Purchasing Document Type

      P_AEDAT TYPE EKKO-AEDAT DEFAULT sy-datum, "Date on Which Record Was Created

      P_EKORG TYPE EKKO-EKORG, "Purchasing Organization

      P_EKGRP TYPE EKKO-EKGRP. "Purchasing Group

      SELECTION-SCREEN END OF BLOCK B1.

      SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE ITEMZ.

      PARAMETERS:

      P_MATNR TYPE EKPO-MATNR, "Material Number

      P_WERKS TYPE EKPO-WERKS, "Plant

      P_MENGE TYPE EKPO-MENGE. "Purchase Order Quantity

      SELECTION-SCREEN PUSHBUTTON /10(08) CMD1 USER-COMMAND NE1.

      SELECTION-SCREEN END OF BLOCK B2.

      SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE ACTZ.

      PARAMETERS:

      P_PONUMB TYPE BAPIMEPOHEADER-PO_NUMBER.

      SELECTION-SCREEN PUSHBUTTON /10(08) CMD2 USER-COMMAND CR1.

      SELECTION-SCREEN END OF BLOCK B3.

      INITIALIZATION.

      HEADERS = 'Purchase Header Data'.

      ITEMZ = 'Purchase Item Data'.

      ACTZ = 'Actions'.

      CMD1 = 'Next'.

      CMD2 = 'Create'.

      CTR = 10.

      AT SELECTION-SCREEN.

      CASE SY-UCOMM.

      WHEN 'NE1'.

      PERFORM ClearItems.

      WHEN 'CR1'.

      PERFORM createpurchaseorder.

      ENDCASE.

      START-OF-SELECTION.

      FORM CREATEPURCHASEORDER .

      PO_HEADER-VENDOR = P_LIFNR. "VENDOR

      PO_HEADER-COMP_CODE = P_BUKRS. "COMPANY CODE

      PO_HEADER-DOC_TYPE = P_BSART. "DOCUMENT TYPE

      PO_HEADER-CREAT_DATE = P_AEDAT. "DATE ON WHICH RECORD WAS CREATED

      PO_HEADER-PURCH_ORG = P_EKORG. "PURCHASING ORGANIZATION

      PO_HEADER-PUR_GROUP = P_EKGRP. "PURCHASING GROUP

      APPEND PO_HEADER.

      PO_HEADERX-VENDOR = 'X'.

      PO_HEADERX-COMP_CODE = 'X'.

      PO_HEADERX-DOC_TYPE = 'X'.

      PO_HEADERX-CREAT_DATE = 'X'.

      PO_HEADERX-PURCH_ORG = 'X'.

      PO_HEADERX-PUR_GROUP = 'X'.

      PO_HEADERX-LANGU = 'X'.

      APPEND PO_HEADERX.

      *

      *CTR2 = CTR.

      *CONCATENATE '00' CTR2 INTO CTR1. .

      PURITEM-PO_ITEM = '10'.

      PURITEM-MATERIAL = P_MATNR.

      PURITEM-PLANT = P_WERKS.

      PURITEM-QUANTITY = P_MENGE.

      APPEND PURITEM.

      .

      PURITEMX-PO_ITEM = 'X'.

      PURITEMX-MATERIAL = 'X'.

      PURITEMX-PLANT = 'X'.

      PURITEMX-QUANTITY = 'X'.

      APPEND PURITEMX.

      CALL FUNCTION 'BAPI_PO_CREATE1'

      EXPORTING

      POHEADER = PO_HEADER

      POHEADERX = PO_HEADERX

      IMPORTING

      EXPPURCHASEORDER = PURORDNUMBER

      TABLES

      RETURN = RETURN

      POITEM = PURITEM

      POITEMX = PURITEMX

      .

      IF sy-subrc = 0.

      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

      EXPORTING

      WAIT = 'X'

      IMPORTING

      RETURN = RETURN.

      MESSAGE 'Purchase order created and stored' TYPE 'S'.

      P_PONUMB = PURORDNUMBER.

      ELSE.

      MESSAGE 'Purchase order not created' TYPE 'S'.

      ENDIF.

      ENDFORM. " CREATEPURCHASEORDER

      &----


      *& Form CLEARITEMS

      &----


      • text

      ----


      • --> p1 text

      • <-- p2 text

      ----


      FORM CLEARITEMS .

      CTR2 = CTR.

      CONCATENATE '00' CTR2 INTO CTR1.

      PURITEM-PO_ITEM = CTR1.

      PURITEM-MATERIAL = P_MATNR.

      PURITEM-PLANT = P_WERKS.

      PURITEM-QUANTITY = P_MENGE.

      APPEND PURITEM.

      PURITEMX-PO_ITEM = CTR1.

      PURITEMX-MATERIAL = 'X'.

      PURITEMX-PLANT = 'X'.

      PURITEMX-QUANTITY = 'X'.

      APPEND PURITEMX.

      CTR = CTR + 10.

      CLEAR P_MATNR.

      CLEAR P_WERKS.

      CLEAR P_MENGE.

      ENDFORM. " CLEARITEMS

      END-OF-SELECTION.

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2010 at 04:38 AM

    Hi,

    Check:

    BAPI_PO_CREATE1

    Thanks,

    Krishna

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.