Skip to Content
author's profile photo Former Member
Former Member

Bapi_po_create1

CONSTANTS : c_x VALUE 'X'.

DATA: del_date TYPE sy-datum.

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: ex_po_number TYPE bapimepoheader-po_number.

PARAMETERS: p_matnr TYPE ekpo-matnr.

PARAMETERS: p_werks TYPE ekpo-werks.

PARAMETERS: p_lgort TYPE ekpo-lgort.

PARAMETERS: p_menge TYPE ekpo-menge.

PARAMETERS: p_lifnr TYPE ekko-lifnr.

PARAMETERS: p_ekorg TYPE ekko-ekorg.

PARAMETERS: p_ekgrp TYPE ekko-ekgrp.

PARAMETERS: p_bukrs TYPE ekko-bukrs.

parameters: p_KNTTP type ekpo-KNTTP.

parameters: p_pr type ekpo-banfn.

  • Header Level Data

pohead-comp_code = p_bukrs.

pohead-doc_type = 'NB'.

pohead-creat_date = sy-datum.

pohead-vendor = p_lifnr.

pohead-purch_org = p_ekorg.

pohead-pur_group = p_ekgrp.

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.

  • Item Level Data

poitem-po_item = 00010.

poitem-material = p_matnr.

poitem-plant = p_werks.

poitem-stge_loc = p_lgort.

poitem-quantity = p_menge.

*poitem-ITEM_CAT = 'TAS'.

poitem-ACCTASSCAT = p_KNTTP.

poitem-PREQ_NO = p_pr.

poitem-preq_item = 00010.

APPEND poitem.

poitemx-po_item = 00010.

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-preq_no = c_x.

poitemx-preq_item = c_x.

APPEND poitemx.

  • Schedule Line Level Data

posched-po_item = 00010.

posched-sched_line = 0100.

posched-del_datcat_ext = 'D'.

del_date = sy-datum + 1.

WRITE del_date TO posched-delivery_date.

posched-deliv_time = '000001'.

posched-quantity = p_menge.

posched-PREQ_NO = p_pr.

posched-preq_item = 0010.

APPEND posched.

poschedx-po_item = 00010.

poschedx-sched_line = 0100.

poschedx-po_itemx = c_x.

poschedx-sched_linex = c_x.

poschedx-del_datcat_ext = c_x.

poschedx-delivery_date = c_x.

poschedx-quantity = c_x.

poschedx-preq_no = c_x.

poschedx-preq_item = c_x.

APPEND poschedx.

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.

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.

I used this program to create a purchase order with reference to purchase requisiton but im getting the Error>

1 E BAPI 001 No instance of object type PurchaseOrder has been created. External reference:

2 E MEPO 001 Purchase order item 00010 still contains faulty schedule lines

3 E 06 054 Doc. type/item cat. NB/S (requisition) <-> NB/ (purch. order)

4 E 8W 162 No schedule line exists for schedule line number 0010000030 00010 0000.

Could you please tell wats the error how to correct it?

I want to create purchase order with reference to purchase requisition number?

Thanks & Regards,

Azhar

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Nov 26, 2007 at 04:44 AM

    hi azhar,

    Better u ask ur functional consultant , for these error.hope he will help u, these data can be verified by them, and if u want to check, u again check the test data.

    regads

    karthik

    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.