on 07-30-2007 7:32 AM
I have specified the correct parameter but i still get Deliver_Date = sy-datum. So, I used BAPI_PO_CHANGE just to modify the delivery date. But why does po_create alone cannot specify the user-defined delivery date?
* Header
* i_header-doc_date = sy-datum. "Doc Date
i_header-comp_code = c_bukrs. "Company Code
i_header-purch_org = 'AGPP'. "Country
i_header-pur_group = '001'. "Purchasing Group
i_header-vendorno = '100034'. "Vendor No.
i_header-currency = 'PHP'. "Currency"
APPEND i_header.
CLEAR i_header.
* Item Details
i_itemdtl-po_item = '00010'.
i_itemdtl-material = ''.
i_itemdtl-short_text = 'ticket Adult'.
i_itemdtl-plant = 'AGP1'.
i_itemdtl-quantity = '10'. "*
i_itemdtl-po_unit = c_ea.
i_itemdtl-net_price = '10'. "*
i_itemdtl-acctasscat = c_project.
* account
i_itemdtl-gl_account = c_glact.
i_itemdtl-wbs_element = c_wbs.
i_itemdtl-delivery_date = '08/30/2007'.
i_itemdtl-tax_code = ''.
i_itemdtl-gr_rcpt = 'PF456'.
i_itemdtl-unload_pt = 'MID111'.
APPEND i_itemdtl.
CLEAR i_itemdtl.
DATA: lv_lifnr(10) TYPE n VALUE '0000000000',
lv_saknr(10) TYPE n VALUE '0000000000'.
* transfer of data
READ TABLE i_header INDEX 1.
* Header
lt_header-comp_code = i_header-comp_code. "Company Code
lt_header-doc_type = 'NB'. "Doc Type
lt_header-creat_date = '20070827'. "sy-datum.
"Created Date
lt_header-created_by = sy-uname. "Created By
lt_header-item_intvl = '00010'. "Ite Interval
lv_lifnr = i_header-vendorno.
SELECT SINGLE lifnr
INTO lt_header-vendor
FROM lfa1
WHERE lifnr = lv_lifnr.
* lt_header-vendor = i_header-vendorno. "Vendor No
lt_header-langu = sy-langu. "Language
lt_header-purch_org = i_header-purch_org. "Country
lt_header-pur_group = i_header-pur_group. "Purchasing Group
lt_header-currency = i_header-currency. "Currency"
* lt_header-doc_date = i_header-doc_date. "Doc Date
APPEND lt_header.
* CLEAR lt_header.
LOOP AT i_itemdtl.
* item detail
lt_detail-po_item = i_itemdtl-po_item.
lt_detail-material = i_itemdtl-material.
lt_detail-short_text = i_itemdtl-short_text.
lt_detail-acctasscat = i_itemdtl-acctasscat.
lt_detail-quantity = i_itemdtl-quantity.
lt_detail-po_unit = i_itemdtl-po_unit.
lt_detail-net_price = i_itemdtl-net_price.
lt_detail-matl_group = c_matkl.
lt_detail-plant = i_itemdtl-plant.
lt_detail-tax_code = i_itemdtl-tax_code.
* delivery
lt_schedule-po_item = '00010'.
lt_schedule-delivery_date = i_itemdtl-delivery_date.
lt_schedule-stat_date = i_itemdtl-delivery_date.
lt_schedule-quantity = i_itemdtl-quantity.
* account
lt_account-po_item = '00010'.
lt_account-wbs_element = i_itemdtl-wbs_element.
lv_saknr = i_itemdtl-gl_account.
lt_account-gl_account = lv_saknr.
lt_account-gr_rcpt = i_itemdtl-gr_rcpt. "Proflight Code
lt_account-unload_pt = i_itemdtl-unload_pt. "Migrant ID
APPEND: lt_detail,
lt_schedule,
lt_account.
lt_headerx-comp_code = c_true. "Company Code
lt_headerx-doc_type = c_true. "Doc Type
lt_headerx-creat_date = c_true. "Created Date
lt_headerx-created_by = c_true. "Created By
lt_headerx-item_intvl = c_true. "Ite Interval
lt_headerx-vendor = c_true. "Vendor No
lt_headerx-langu = c_true. "Language
lt_headerx-purch_org = c_true. "Country
lt_headerx-pur_group = c_true. "Purchasing Group
lt_headerx-currency = c_true. "Currency"
* lt_headerx-doc_date = c_true. "Doc Date
APPEND lt_headerx.
lt_detailx-po_item = '00010'.
* lt_detailx-material = c_true.
lt_detailx-short_text = c_true.
lt_detailx-acctasscat = c_true.
lt_detailx-quantity = c_true.
lt_detailx-po_unit = c_true.
lt_detailx-net_price = c_true.
lt_detailx-matl_group = c_true.
lt_detailx-plant = c_true.
lt_detailx-tax_code = c_true.
lt_schedulex-po_item = '00010'.
lt_schedulex-sched_line = c_True.
lt_schedulex-delivery_date = c_true.
lt_schedulex-stat_date = c_true.
lt_schedulex-quantity = c_true.
lt_accountx-po_item = '00010'.
lt_accountx-gl_account = c_true.
lt_accountx-wbs_element = c_true.
lt_accountx-gr_rcpt = c_true.
lt_accountx-unload_pt = c_true.
APPEND: lt_detailx,
lt_schedulex,
lt_accountx.
*** Fillup the transaction
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = lt_header
poheaderx = lt_headerx
IMPORTING
exppurchaseorder = po_number
TABLES
return = return
poitem = lt_detail
poitemx = lt_detailx
* poschedule = lt_schedule
* poschedulex = lt_schedulex
poaccount = lt_account
poaccountx = lt_accountx.
COMMIT WORK AND WAIT.
IF po_number IS NOT INITIAL.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = po_number
TABLES
return = return
poschedule = lt_schedule
poschedulex = lt_schedulex.
COMMIT WORK AND WAIT.
ENDIF.
Hi,
Here you are not filling corresponding X fields for item number,schedule line number.
i.e for po item you are filling as
lt_detail-po_item = i_itemdtl-po_item.
but there is no corresponding X for this.
So you need to add the following line
lt_detailx-po_itemx = 'X'.
for schedule lines
lt_schedulex-po_itemx = 'X'.
Do the same for accounting details also.
This should work.
Regards,
Sunitha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Here you are not filling corresponding X fields for item number,schedule line number.
i.e for po item you are filling as
lt_detail-po_item = i_itemdtl-po_item.
but there is no corresponding X for this.
So you need to add the following line
lt_detailx-po_itemx = 'X'.
for schedule lines
lt_schedulex-po_itemx = 'X'.
Do the same for accounting details also.
This should work.
Regards,
Sunitha.
poschedulex-po_itemx = 'X'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
10 | |
9 | |
6 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.