Purchase order clearing
Hi Experts,
We have some purchase orders for all those users has not done migo postings they have done miro. now they want to clear those purchase orders is it possible?
there should be corresponding posting right for clearing?
is it possible to clear manually?
if possible what are the steps?
please suggest its high priority issue.
Regards,
chandra
Edited by: c naidu on Feb 25, 2010 4:11 AM
Hi,
First reverse those MIRO invoices with transaction MR8M.
Then only you can delete the items in your PO.
This is the only way to clearing a PO item.
Thanks,
Srinu
Similar Messages
-
Error Message not getting clear while creation of purchase order
Hi All,
I am facing one problem while creating purchasing order.
I have written one user-exit for purchase order. User has to enter purchase requisition number for certain purchase order type. If he doesnt enter PR number, we have to throw an error message.
I have used the MM06E005 for the same. User exit is working fine, but the problem is, all error messages are collected in log and it will be displayed in a dialog screen when you check the document (Transaction ME21N).
When I enter PR number and check the document, the error message is still there, system is not clearing the error log. I have created Z message class and have used in User exit.
Do you guys have any solution for this? Am I using the right user exit? What should I do to clear the error message?
If you dont have answer, please pass it to your friends also .
Thanks a lot in advanceHi Rob,
Your inforamtion was good enough to start. thanks a lot for that. I tried to implement the same but no luck this time also.
FYI..
The FM exit name is EXIT_SAPMM06E_012 and see the following code, i used.
TYPES: BEGIN OF type_my,
subrc TYPE sysubrc,
msgid TYPE symsgid,
msgty TYPE symsgty,
msgno TYPE symsgno,
msgv1 TYPE symsgv,
msgv2 TYPE symsgv,
msgv3 TYPE symsgv,
msgv4 TYPE symsgv,
END OF type_my.
DATA: my TYPE type_my.
DATA : GV_PO(10) TYPE I.
if I_EKKO-BSART = 'Z005'.
GV_PO = I_EKKO-EBELN.
loop at TEKPO.
if TEKPO-BANFN is initial.
message E000(ZBC_MESSAGES) with TEKPO-EBELP.
my-subrc = sy-subrc.
my-msgid = sy-msgid.
my-msgty = sy-msgty.
my-msgno = sy-msgno.
my-msgid = 'ZBC_MESSAGES'.
my-msgty = 'E'.
my-msgno = '000'..
my-msgv1 = sy-msgv1.
my-msgv2 = sy-msgv2.
my-msgv3 = sy-msgv3.
my-msgv4 = sy-msgv4.
Cleaning
CLEAR:
sy-subrc,
sy-msgid,
sy-msgty,
sy-msgno,
sy-msgv1,
sy-msgv2,
sy-msgv3,
sy-msgv4.
Generate message
mmpur_message my-msgty my-msgid my-msgno
my-msgv1 my-msgv2 my-msgv3 my-msgv4.
Remove message from message list
mmpur_remove_messages_by_id GV_PO.
endif.
endloop.
It is still not working. Moreover i don't have PO number at run time.
I hope this clarify the problem in more detail.
Meanwhile i am searching for OSS as suggested by Michael Bennett. -
F-58 posting using spl gl indicator G 7 clear purchase order amount
Hi sap gurus
Requirement is as below:
fi -p2p-scenario- Usi ng spl gl indicator as G-which is configured
1. Create a Payment term for
I. Part Payment as advance u2013 10%-on creation of PO
II. Part payment against Proof of Dispatch; and -15%-create inbound delivery, make some advance payment
III. Balance against receipt of material on production of Invoice, MDCC u2013 75%-at time of GR/IR-final invoice
2. Use this payment term in the Purchase order(say rs.100)
3. Create advance payment request u2013 F-47 for 10%-say rs.10
4. Make advance payment for the request u2013 F-58-
5. On Receiving the Proof of dispatch, Create an Request again for 15% - F-47-say rs.15
6. Make payment for the request for 15% - F-58
7. After GRN and Make LIV for 100%
8. Make the Final payment for 75% after adjusting 10% and 15% payment line items
in F-58 directly.
9. Display the accounting document.
with one payment term,i have done the partial payments for rs.10 & rs.15 using f-47 & f-48.Finally
how to clear the payments in F-58 -the adv amounts posted through spl gl indicator say 10 & 15 -shows cr against vendor & also the case after MIGO-for the 100 being a credit item ,how to clear the items as the amounts are getting reflected as" not assigned" in partial paym ent tab.
Please suggest if i am wrong with flow or entries.
Please suggest the is there any other to clear using spl gl indicators.
thanks
Nageshplease clear those open items by giving spl GL indicator in the inut screen as G.
System will shows open items.and you can clear those. -
Purchase Order Number in Vendor Line Item (FBl1N) and Clear Vendor (F-44)
Hello,
I am not getting the Purchase Order Number in Vendor Line Item.(FBl1N).
Also during Clear of Vendor through F-44 i am not able to identify the Line item on the basis of Purchase Order Number.
Could any one pleae help me out on this issue as i have to clear the vendor Line item in mass.
Thanks
Nitin Jindal
Moderator: Please, respect the rules of the forum and search SDN before posting new thread. This question has been answered several times. Also, please choose proper forum to post your questions; this one is related to Financials and not to ControllingBased on my experience std feature from SD-FI . Depending on the SD Billing config which can be by delivery(VTFL) or sales order(VTFA). You can assign options of A: Cust PO No. B Sales order no. C Delivery no. D External delivery no. E Actual invoice number to available header fields of Assignment No. or Reference No. Try it out
-
Clearing error messages in Purchase Order
Hi All,
Can anybody tell me how to clear error messages in user exits when changing the error message?
My problem is like this and using the exit 016.
I want to make sure Plant in all line items are same. If the user changes one Plant, then I am comparing that with other line item plants and giving error message if they are wrong.
Then, instead of changing the line item 10, if user changes Plant for 20, in this situation both plants are same. Hence, should able to save the purchase order.
But it is not able to save the PO because, it is not able to clear the error message on line item 10.
Can somebody suggest, how to clear the error message?
Hope, I made the question clear.
ShyleshHi Friend,
Fire an information message instead of error message.
Because you can not handle error message in user exit / BADi.
Standard way of handling error message in screen by CHAIN ENDCHAIN.
But you do not have control on the table control of PO.
So it is better to fire an information message.
Regards
Krishnendu -
Purchase Orders with outstanding invoice - How to clear these down?
Hi,
We have a large number of purchase orders with an outstanding invoice which will never be fulfilled. I would like to know what is the process for clearing these down so the purchase orders will be marked for archiving, and so they will not be visible when running me2m with selection parameter RECHNUNG. I've tried setting the final invoice flag but I can still see the order.
Thanks,
Steph.you have to clear the GR/IR account with MR11.
-
Clear the field INFOUPDATE and UNLIMITED in Purchasing Order
Hi experts,
I have a request to clear the 2 fields Infoupdate and Unlimited in the Purchasing Order.
I understand that this can be done in the customizing. However I need to have some condition which the customizing cannot be fulfiled.
For example, the request only require to clear the 2 fields, when creating new item and for a particular plant only.
Is there a customer exit, bapi, etc that can someone think of?
Thanks in advance.Hi,
Could you please go through the below link and check the same.
Adding Reusable Fields - Application Enhancement Tool - SAP Library
It may help you.
Regards, -
MR11 - can't clear a Purchase order amount
Hi,
When we try to execute the transaction MR11 for a specific purchase order, we have the following error message:
System status CLSD is active (ORD 13002723)
Message no. BS013
Diagnosis
Object ORD 13002723 has system status CLSD (Closed). According to this status, transaction 'Incoming invoice' is not allowed.
Procedure
You can only carry out the requested function if this is allowed according to the status of the object.
How can I change this status?
Thanks,
JulienI tried, but I get this error message:
Order 13002723 is not an internal order
Message no. KO101
Diagnosis
You can only process orders belonging to the following categories using the menu "Controlling -> Internal orders":
01 Internal order
02 Imputed cost order
Order 13002723 belongs to neither of these categories.
System Response
You can display order 13002723 but you cannot maintain it. -
Hi Experts,
Due to some other reasons we tried clear GR/IR clearing a/c. i will explain clearly.
We have some purchase orders pertaining to 2006 year. we have not done MIGO and we did MIRO, So that we could not able to clear GR/IR A/C. SO, we have posted manual entry with fb50 same as MIGO posting then we cleared both documents with f-03 its done every thing was fine now But if we see purchase order report status showing OPEN
How to change the status please some one let me know.this is high priority issue.
Regards,
JCHi,
First make sure that you will not receive goods against your PO..Then go to me22n and delete the item in your PO.
This will resolve your issue.
Thanks,
Srinu -
Error in Bapi_GoodsMvt_Create using Purchase order
Hi Friends,
I am using Bapi_goodsmvt_create for Goods Receipts against Purchase order.
The below code i have given for Goods receipts
It shows the error like
ID : 8J
Err No.:182
Message : Entry 4500000344 00040 0000 not valid; correct entry
Please help me to correct this error.
Thanks
Shankar
===================================
Heading Structure
st_gm_code-gm_code = '01'.
st_gm_header-pstng_date = '20070930'.
st_gm_header-doc_date = '20070930'.
st_gm_header-gr_gi_slip_no = '970015'.
st_gm_header-bill_of_lading = '527213'.
st_gm_header-header_txt = 'AIR'.
st_gm_header-ref_doc_no = '4500000344'.
Tables - ITEM CREATE.
itab_afs_gm_itemx-plant = '2000'.
itab_afs_gm_itemx-deliv_numb = '80100121'.
itab_afs_gm_itemx-stge_loc = '2110'.
itab_afs_gm_itemx-move_stloc = '2110'.
itab_afs_gm_itemx-po_number = '4500000344'.
itab_afs_gm_itemx-po_item = '00040'.
itab_afs_gm_itemx-vendor = '0000650003'.
itab_afs_gm_itemx-vendrbatch = 'ABC123'.
itab_afs_gm_itemx-move_type = '101'.
itab_afs_gm_itemx-mvt_ind = 'B'.
itab_afs_gm_itemx-material = '000000000030000227'.
itab_afs_gm_itemx-entry_qnt = 10.
APPEND itab_afs_gm_itemx .
****&& Grid values
gr_afs-matdoc_itm = '0001'.
gr_afs-grid_value = '205'.
gr_afs-withdrawn_sku = 'X'. "Final issue at sku level
gr_afs-stock_cat = '0000000001000366'.
APPEND gr_afs.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = st_gm_header
goodsmvt_code = st_gm_code
TESTRUN = ' '
IMPORTING
goodsmvt_headret = st_gm_headret
materialdocument = mat_doc
matdocumentyear = doc_year
TABLES
goodsmvt_item = itab_afs_gm_itemx
afs_goodsmvt_sku = gr_afs
return = bapi_return.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
CLEAR itab_afs_gm_itemx.
REFRESH itab_afs_gm_itemx.
CLEAR gr_afs.
REFRESH gr_afs.Hi,
Here is some sample code from one of my programs, which does a 551 movement type. This should get you started. Just check the RETURN table for messages, they should tell you what you are missing.
code
Structures for BAPI
data: gm_header type bapi2017_gm_head_01.
data: gm_code type bapi2017_gm_code.
data: gm_headret type bapi2017_gm_head_ret.
data: gm_item type table of
bapi2017_gm_item_create with header line.
data: gm_return type bapiret2 occurs 0.
data: gm_retmtd type bapi2017_gm_head_ret-mat_doc.
clear: gm_return, gm_retmtd. refresh gm_return.
Setup BAPI header data.
gm_header-pstng_date = sy-datum.
gm_header-doc_date = sy-datum.
gm_code-gm_code = '06'. " MB11
Write 551 movement to table
clear gm_item.
move '551' to gm_item-move_type .
move '000000000040001234' to gm_item-material.
move '1' to gm_item-entry_qnt.
move 'EA' to gm_item-entry_uom.
move '0004' to gm_item-plant.
move '4000' to gm_item-stge_loc.
move '201' to gm_item-move_reas.
Determine cost center per plant
case xresb-werks.
when '0004'.
move '0000041430' to gm_item-costcenter.
when '0006'.
move '0000041630' to gm_item-costcenter.
when '0007'.
move '0000041731' to gm_item-costcenter.
when '0008'.
move '0000041830' to gm_item-costcenter.
endcase.
append gm_item.
Call goods movement BAPI
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gm_header
goodsmvt_code = gm_code
importing
goodsmvt_headret = gm_headret
materialdocument = gm_retmtd
tables
goodsmvt_item = gm_item
return = gm_return.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
[/code]
Welcome to SDN! Please remember to award points for helpful answers and mark you post as solved when solved completely. Thanks.
REgards,
Raj. -
Goods receipt for purchase order with account assignment 'K'
Hello All,
There are couple of purchase orders with acc.*** "K". On doing the GR for these PO's they have been done with mvt type 103 & mvt typ 105.
I understand that material has been directly consumed to the respective cost center.
How do track the internal movement for these materials??
I need to view the stock for these materials at the cost center as in MMBE the stock is seen as ZERO.
All these materials are with QM proc ACTIVE. So a goods receipt is done 105, then the inspection lot is cleared. However, in this case as the material is directly consumed, it is NOT displayed in QA32.
Is the above procedure correct??? Is it better to receive stock against mvt type 101 & then do a 201 mvt ??
Request your inputs.....
Regards,
Manoj ReddyAccount assignment inventories are not maintained. To maintain a report for cost center receiving/issuing you need to make a customized report with help of ABAP.
Other way is to pull report in MB51, with selection criteria COST CENTER and it will give you result of stocks available on cost center. For stocks received on cost center, you can pull report with cost center and movement 101.
201 is used for goods issue to cost center from warehouse, the stock you receive from PO against 101 is directly charged to cost center, so no need to issue later to cost center.
Edited by: Afshad Irani on May 17, 2010 2:17 PM -
Error in : Purchase order Creation using BAPI_PO_CREATE1
Hell guys,
I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
I want the new PO to have all the characteristics of an existing PO. whose PO # is stored in wa_order_split_create-docnr and for the new PO, i want the quantity from wa_order_split_create-qty_acptd and the delivery data to be wa_order_split_create-dly_date. But this process and code below gives a short dump in the std FM - MEPO_DOC_ITEM_GET . It raises an exception of failure. I am trying to create many new PO's in the loop below. If there is just one row, sometimes, it creates the PO even with the exception failure ( which is pretty weird).
Am i making any mistake while filling the header or item or schedule lines for the BAPI_PO_CREATE1 ? Any tips or clues why I am getting a dump ?
DATA: i_insert,
i_create_order,
i_cycle TYPE cycle,
i_qty_acpt TYPE dzmeng,
i_dly_date TYPE vbak-vdatu,
i_item TYPE roijnomiio .
DATA: i_order TYPE symsgv,
i_return TYPE swd_return .
DATA: i_vbak TYPE vbak,
i_vbap TYPE vbap,
i_ekko TYPE ekko,
i_ekpo TYPE ekpo,
i_bsoh TYPE bapisdhd1,
i_bsohx TYPE bapisdhd1x,
i_bpoh TYPE bapimepoheader,
i_bpohx TYPE bapimepoheaderx,
i_vbeln TYPE vbeln_va,
i_posnr TYPE posnr_va,
i_contr TYPE vbeln_va,
i_conit TYPE posnr_va,
i_ebeln TYPE ebeln,
i_ebelp TYPE ebelp,
i_pargr TYPE pargr,
i_thead TYPE thead,
i_line TYPE tline,
i_note TYPE txw_note,
i_new_vbeln TYPE vbeln_va,
i_new_ebeln TYPE ebeln,
i_wa_bsoi TYPE bapisditm,
i_wa_bsoix TYPE bapisditmx,
i_wa_bsop TYPE bapiparnr,
i_wa_bsos TYPE bapischdl,
i_wa_bsosx TYPE bapischdlx,
i_wa_vbpa TYPE vbpa,
i_wa_vbkd TYPE vbkd,
i_wa_bpoi TYPE bapimepoitem,
i_wa_bpoix TYPE bapimepoitemx,
i_wa_bpos TYPE bapimeposchedule,
i_wa_bposx TYPE bapimeposchedulx,
i_wa_bpop TYPE bapiekkop,
i_wa_ekpa TYPE ekpa,
i_message TYPE char72,
i_bapiretn TYPE bapiret2,
i_bapiret2 TYPE TABLE OF bapiret2 INITIAL SIZE 1,
i_vbpa TYPE TABLE OF vbpa INITIAL SIZE 1,
i_vbkd TYPE TABLE OF vbkd INITIAL SIZE 1,
i_ekpa TYPE TABLE OF ekpa INITIAL SIZE 1,
i_bsoi TYPE TABLE OF bapisditm INITIAL SIZE 1,
i_bsoix TYPE TABLE OF bapisditmx INITIAL SIZE 1,
i_bsos TYPE TABLE OF bapischdl INITIAL SIZE 1,
i_bsosx TYPE TABLE OF bapischdlx INITIAL SIZE 1,
i_bsop TYPE TABLE OF bapiparnr INITIAL SIZE 1,
i_bpoi TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
i_bpoix TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
i_bpos TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
i_bposx TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
i_bpop TYPE TABLE OF bapiekkop INITIAL SIZE 1,
i_text_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_line_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_txw_note TYPE TABLE OF txw_note INITIAL SIZE 1,
i_oij_el_doc_mot TYPE oij_el_doc_mot .
CONSTANTS: c_char_c VALUE 'C',
c_char_e VALUE 'E',
c_char_p VALUE 'P',
c_char_g VALUE 'G',
c_char_i VALUE 'I',
c_char_s VALUE 'S',
c_char_x VALUE 'X',
c_zsw(3) VALUE 'ZSW',
c_nomit_stat(4) VALUE 'ZDNY' .
DATA : lv_nomtk_split TYPE oij_nomtk.
DATA : i_order_split_create TYPE TABLE OF zsws_order_split.
DATA : wa_order_split_create TYPE zsws_order_split.
LOOP AT i_order_split_create INTO wa_order_split_create.
IF NOT i_create_order IS INITIAL .
CLEAR: i_create_order .
MOVE: wa_order_split_create-docnr TO i_ebeln,
wa_order_split_create-docitm TO i_ebelp .
CALL FUNCTION 'ME_EKKO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
IMPORTING
po_ekko = i_ekko
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
ENDIF .
* Fill PO Header
i_bpoh-comp_code = i_ekko-bukrs .
i_bpoh-doc_type = i_ekko-bsart .
i_bpoh-vendor = i_ekko-lifnr .
i_bpoh-langu = i_ekko-spras .
i_bpoh-pmnttrms = i_ekko-zterm .
i_bpoh-purch_org = i_ekko-ekorg .
i_bpoh-pur_group = i_ekko-ekgrp .
i_bpoh-currency = i_ekko-waers .
i_bpoh-agreement = i_ekko-konnr .
i_bpoh-incoterms1 = i_ekko-inco1 .
i_bpoh-incoterms2 = i_ekko-inco2 .
* Fill PO update indicator 'X'
i_bpohx-comp_code = c_char_x .
i_bpohx-doc_type = c_char_x .
i_bpohx-vendor = c_char_x .
i_bpohx-langu = c_char_x .
i_bpohx-pmnttrms = c_char_x .
i_bpohx-purch_org = c_char_x .
i_bpohx-pur_group = c_char_x .
i_bpohx-currency = c_char_x .
i_bpohx-agreement = c_char_x .
i_bpohx-incoterms1 = c_char_x .
i_bpohx-incoterms2 = c_char_x .
CALL FUNCTION 'ME_EKPO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
pi_ebelp = i_ebelp
IMPORTING
po_ekpo = i_ekpo
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF .
* Fill PO Item
i_wa_bpoi-po_item = i_ekpo-ebelp .
i_wa_bpoi-material = i_ekpo-matnr .
i_wa_bpoi-plant = i_ekpo-werks .
i_wa_bpoi-stge_loc = i_ekpo-lgort .
i_wa_bpoi-quantity = wa_order_split_create-qty_acptd .
i_wa_bpoi-po_unit = i_ekpo-meins .
i_wa_bpoi-tax_code = i_ekpo-mwskz .
i_wa_bpoi-val_type = i_ekpo-bwtar .
i_wa_bpoi-item_cat = i_ekpo-pstyp .
i_wa_bpoi-acctasscat = i_ekpo-knttp .
i_wa_bpoi-agreement = i_ekpo-konnr .
i_wa_bpoi-agmt_item = i_ekpo-ktpnr .
APPEND i_wa_bpoi TO i_bpoi .
* Fill PO Item update indicator 'X'
i_wa_bpoix-po_item = i_ekpo-ebelp .
i_wa_bpoix-po_itemx = c_char_x .
i_wa_bpoix-material = c_char_x .
i_wa_bpoix-plant = c_char_x .
i_wa_bpoix-stge_loc = c_char_x .
i_wa_bpoix-quantity = c_char_x .
i_wa_bpoix-po_unit = c_char_x .
i_wa_bpoix-tax_code = c_char_x .
i_wa_bpoix-val_type = c_char_x .
i_wa_bpoix-item_cat = c_char_x .
i_wa_bpoix-acctasscat = c_char_x .
i_wa_bpoix-agreement = c_char_x .
i_wa_bpoix-agmt_item = c_char_x .
APPEND i_wa_bpoix TO i_bpoix .
* Fill PO Item Schedule
i_wa_bpos-po_item = i_ekpo-ebelp .
i_wa_bpos-sched_line = '0001' .
i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
i_wa_bpos-quantity = wa_order_split_create-qty_acptd .
APPEND i_wa_bpos TO i_bpos .
* Fill PO Item schedule update indicator 'X'
i_wa_bposx-po_item = i_ekpo-ebelp .
i_wa_bposx-sched_line = '0001' .
i_wa_bposx-delivery_date = c_char_x .
i_wa_bposx-quantity = c_char_x .
APPEND i_wa_bposx TO i_bposx .
CLEAR: i_pargr .
SELECT SINGLE pargr
INTO i_pargr
FROM t161
WHERE bstyp = i_ekko-bstyp
AND bsart = i_ekko-bsart .
CLEAR i_ekpa[].
CALL FUNCTION 'MM_READ_PARTNERS'
EXPORTING
application = c_char_p
ebeln = i_ebeln
bstyp = i_ekko-bstyp
pargr = i_pargr
TABLES
x_ekpa = i_ekpa[].
LOOP AT i_ekpa INTO i_wa_ekpa .
i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
i_wa_bpop-langu = sy-langu .
IF NOT i_wa_ekpa-lifn2 IS INITIAL .
i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
ELSE .
i_wa_bpop-buspartno = i_wa_ekpa-parnr .
ENDIF .
APPEND i_wa_bpop TO i_bpop .
CLEAR: i_wa_ekpa, i_wa_bpop .
ENDLOOP .
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = i_bpoh
poheaderx = i_bpohx
IMPORTING
exppurchaseorder = i_new_ebeln
TABLES
return = i_bapiret2
poitem = i_bpoi[]
poitemx = i_bpoix[]
poschedule = i_bpos[]
poschedulex = i_bposx[].
i_order = i_new_ebeln .
SHIFT i_order LEFT DELETING LEADING '0' .
i_return-errortype = c_char_i .
i_return-workarea = c_zsw .
i_return-message = '064' .
i_return-variable1 = i_order .
loop at i_bapiret2 into i_bapiretn where type ca 'EAX' .
append i_bapiretn to t_bapi_return .
endloop .
if t_bapi_return[] is initial .
i_create_order = c_char_x .
CALL FUNCTION 'SWD_POPUP_MESSAGE_SEND'
EXPORTING
act_return = i_return. "Popup with new PO no.
ENDCASE . " Docind
ENDIF .
ENDLOOP.Hi Shareen,
I think in the following parts of the code,
CALL FUNCTION 'MM_READ_PARTNERS'
EXPORTING
application = c_char_p
ebeln = i_ebeln
bstyp = i_ekko-bstyp
pargr = i_pargr
TABLES
x_ekpa = i_ekpa[].
Error in : Purchase order Creation using BAPI_PO_CREATE1
Posted: Mar 20, 2006 7:39 PM Reply E-mail this post
Hell guys,
I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
I want the new PO to have all the characteristics of an existing PO. whose PO # is stored in wa_order_split_create-docnr and for the new PO, i want the quantity from wa_order_split_create-qty_acptd and the delivery data to be wa_order_split_create-dly_date. But this process and code below gives a short dump in the std FM - MEPO_DOC_ITEM_GET . It raises an exception of failure. I am trying to create many new PO's in the loop below. If there is just one row, sometimes, it creates the PO even with the exception failure ( which is pretty weird).
Am i making any mistake while filling the header or item or schedule lines for the BAPI_PO_CREATE1 ? Any tips or clues why I am getting a dump ?
DATA: i_insert,
i_create_order,
i_cycle TYPE cycle,
i_qty_acpt TYPE dzmeng,
i_dly_date TYPE vbak-vdatu,
i_item TYPE roijnomiio .
DATA: i_order TYPE symsgv,
i_return TYPE swd_return .
DATA: i_vbak TYPE vbak,
i_vbap TYPE vbap,
i_ekko TYPE ekko,
i_ekpo TYPE ekpo,
i_bsoh TYPE bapisdhd1,
i_bsohx TYPE bapisdhd1x,
i_bpoh TYPE bapimepoheader,
i_bpohx TYPE bapimepoheaderx,
i_vbeln TYPE vbeln_va,
i_posnr TYPE posnr_va,
i_contr TYPE vbeln_va,
i_conit TYPE posnr_va,
i_ebeln TYPE ebeln,
i_ebelp TYPE ebelp,
i_pargr TYPE pargr,
i_thead TYPE thead,
i_line TYPE tline,
i_note TYPE txw_note,
i_new_vbeln TYPE vbeln_va,
i_new_ebeln TYPE ebeln,
i_wa_bsoi TYPE bapisditm,
i_wa_bsoix TYPE bapisditmx,
i_wa_bsop TYPE bapiparnr,
i_wa_bsos TYPE bapischdl,
i_wa_bsosx TYPE bapischdlx,
i_wa_vbpa TYPE vbpa,
i_wa_vbkd TYPE vbkd,
i_wa_bpoi TYPE bapimepoitem,
i_wa_bpoix TYPE bapimepoitemx,
i_wa_bpos TYPE bapimeposchedule,
i_wa_bposx TYPE bapimeposchedulx,
i_wa_bpop TYPE bapiekkop,
i_wa_ekpa TYPE ekpa,
i_message TYPE char72,
i_bapiretn TYPE bapiret2,
i_bapiret2 TYPE TABLE OF bapiret2 INITIAL SIZE 1,
i_vbpa TYPE TABLE OF vbpa INITIAL SIZE 1,
i_vbkd TYPE TABLE OF vbkd INITIAL SIZE 1,
i_ekpa TYPE TABLE OF ekpa INITIAL SIZE 1,
i_bsoi TYPE TABLE OF bapisditm INITIAL SIZE 1,
i_bsoix TYPE TABLE OF bapisditmx INITIAL SIZE 1,
i_bsos TYPE TABLE OF bapischdl INITIAL SIZE 1,
i_bsosx TYPE TABLE OF bapischdlx INITIAL SIZE 1,
i_bsop TYPE TABLE OF bapiparnr INITIAL SIZE 1,
i_bpoi TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
i_bpoix TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
i_bpos TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
i_bposx TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
i_bpop TYPE TABLE OF bapiekkop INITIAL SIZE 1,
i_text_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_line_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_txw_note TYPE TABLE OF txw_note INITIAL SIZE 1,
i_oij_el_doc_mot TYPE oij_el_doc_mot .
CONSTANTS: c_char_c VALUE 'C',
c_char_e VALUE 'E',
c_char_p VALUE 'P',
c_char_g VALUE 'G',
c_char_i VALUE 'I',
c_char_s VALUE 'S',
c_char_x VALUE 'X',
c_zsw(3) VALUE 'ZSW',
c_nomit_stat(4) VALUE 'ZDNY' .
DATA : lv_nomtk_split TYPE oij_nomtk.
DATA : i_order_split_create TYPE TABLE OF zsws_order_split.
DATA : wa_order_split_create TYPE zsws_order_split.
LOOP AT i_order_split_create INTO wa_order_split_create.
IF NOT i_create_order IS INITIAL .
CLEAR: i_create_order .
MOVE: wa_order_split_create-docnr TO i_ebeln,
wa_order_split_create-docitm TO i_ebelp .
CALL FUNCTION 'ME_EKKO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
IMPORTING
po_ekko = i_ekko
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
ENDIF .
Fill PO Header
i_bpoh-comp_code = i_ekko-bukrs .
i_bpoh-doc_type = i_ekko-bsart .
i_bpoh-vendor = i_ekko-lifnr .
i_bpoh-langu = i_ekko-spras .
i_bpoh-pmnttrms = i_ekko-zterm .
i_bpoh-purch_org = i_ekko-ekorg .
i_bpoh-pur_group = i_ekko-ekgrp .
i_bpoh-currency = i_ekko-waers .
i_bpoh-agreement = i_ekko-konnr .
i_bpoh-incoterms1 = i_ekko-inco1 .
i_bpoh-incoterms2 = i_ekko-inco2 .
Fill PO update indicator 'X'
i_bpohx-comp_code = c_char_x .
i_bpohx-doc_type = c_char_x .
i_bpohx-vendor = c_char_x .
i_bpohx-langu = c_char_x .
i_bpohx-pmnttrms = c_char_x .
i_bpohx-purch_org = c_char_x .
i_bpohx-pur_group = c_char_x .
i_bpohx-currency = c_char_x .
i_bpohx-agreement = c_char_x .
i_bpohx-incoterms1 = c_char_x .
i_bpohx-incoterms2 = c_char_x .
CALL FUNCTION 'ME_EKPO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
pi_ebelp = i_ebelp
IMPORTING
po_ekpo = i_ekpo
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF .
Fill PO Item
i_wa_bpoi-po_item = i_ekpo-ebelp .
i_wa_bpoi-material = i_ekpo-matnr .
i_wa_bpoi-plant = i_ekpo-werks .
i_wa_bpoi-stge_loc = i_ekpo-lgort .
i_wa_bpoi-quantity = wa_order_split_create-qty_acptd .
i_wa_bpoi-po_unit = i_ekpo-meins .
i_wa_bpoi-tax_code = i_ekpo-mwskz .
i_wa_bpoi-val_type = i_ekpo-bwtar .
i_wa_bpoi-item_cat = i_ekpo-pstyp .
i_wa_bpoi-acctasscat = i_ekpo-knttp .
i_wa_bpoi-agreement = i_ekpo-konnr .
i_wa_bpoi-agmt_item = i_ekpo-ktpnr .
APPEND i_wa_bpoi TO i_bpoi .
Fill PO Item update indicator 'X'
i_wa_bpoix-po_item = i_ekpo-ebelp .
i_wa_bpoix-po_itemx = c_char_x .
i_wa_bpoix-material = c_char_x .
i_wa_bpoix-plant = c_char_x .
i_wa_bpoix-stge_loc = c_char_x .
i_wa_bpoix-quantity = c_char_x .
i_wa_bpoix-po_unit = c_char_x .
i_wa_bpoix-tax_code = c_char_x .
i_wa_bpoix-val_type = c_char_x .
i_wa_bpoix-item_cat = c_char_x .
i_wa_bpoix-acctasscat = c_char_x .
i_wa_bpoix-agreement = c_char_x .
i_wa_bpoix-agmt_item = c_char_x .
APPEND i_wa_bpoix TO i_bpoix .
Fill PO Item Schedule
i_wa_bpos-po_item = i_ekpo-ebelp .
i_wa_bpos-sched_line = '0001' .
i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
i_wa_bpos-quantity = wa_order_split_create-qty_acptd .
APPEND i_wa_bpos TO i_bpos .
Fill PO Item schedule update indicator 'X'
i_wa_bposx-po_item = i_ekpo-ebelp .
i_wa_bposx-sched_line = '0001' .
i_wa_bposx-delivery_date = c_char_x .
i_wa_bposx-quantity = c_char_x .
APPEND i_wa_bposx TO i_bposx .
CLEAR: i_pargr .
SELECT SINGLE pargr
INTO i_pargr
FROM t161
WHERE bstyp = i_ekko-bstyp
AND bsart = i_ekko-bsart .
CLEAR i_ekpa[].
CALL FUNCTION 'MM_READ_PARTNERS'
EXPORTING
application = c_char_p
ebeln = i_ebeln
bstyp = i_ekko-bstyp
pargr = i_pargr
TABLES
x_ekpa = <b>i_ekpa[].</b>
LOOP AT i_ekpa INTO i_wa_ekpa .
i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
i_wa_bpop-langu = sy-langu .
IF NOT i_wa_ekpa-lifn2 IS INITIAL .
i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
ELSE .
i_wa_bpop-buspartno = i_wa_ekpa-parnr .
ENDIF .
APPEND i_wa_bpop TO i_bpop .
CLEAR: i_wa_ekpa, i_wa_bpop .
ENDLOOP .
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = i_bpoh
poheaderx = i_bpohx
IMPORTING
exppurchaseorder = i_new_ebeln
TABLES
return = i_bapiret2
<b> poitem = i_bpoi[]
poitemx = i_bpoix[]
poschedule = i_bpos[]
poschedulex = i_bposx[].</b>
it should be only i_bpoi, i_bpoix, i_bpos, i_bposx but not i_bpoi[], i_bpoix[], i_bpos[], i_bposx[].
CHange the code as follows:
DATA: i_insert,
i_create_order,
i_cycle TYPE cycle,
i_qty_acpt TYPE dzmeng,
i_dly_date TYPE vbak-vdatu,
i_item TYPE roijnomiio .
DATA: i_order TYPE symsgv,
i_return TYPE swd_return .
DATA: i_vbak TYPE vbak,
i_vbap TYPE vbap,
i_ekko TYPE ekko,
i_ekpo TYPE ekpo,
i_bsoh TYPE bapisdhd1,
i_bsohx TYPE bapisdhd1x,
i_bpoh TYPE bapimepoheader,
i_bpohx TYPE bapimepoheaderx,
i_vbeln TYPE vbeln_va,
i_posnr TYPE posnr_va,
i_contr TYPE vbeln_va,
i_conit TYPE posnr_va,
i_ebeln TYPE ebeln,
i_ebelp TYPE ebelp,
i_pargr TYPE pargr,
i_thead TYPE thead,
i_line TYPE tline,
i_note TYPE txw_note,
i_new_vbeln TYPE vbeln_va,
i_new_ebeln TYPE ebeln,
i_wa_bsoi TYPE bapisditm,
i_wa_bsoix TYPE bapisditmx,
i_wa_bsop TYPE bapiparnr,
i_wa_bsos TYPE bapischdl,
i_wa_bsosx TYPE bapischdlx,
i_wa_vbpa TYPE vbpa,
i_wa_vbkd TYPE vbkd,
i_wa_bpoi TYPE bapimepoitem,
i_wa_bpoix TYPE bapimepoitemx,
i_wa_bpos TYPE bapimeposchedule,
i_wa_bposx TYPE bapimeposchedulx,
i_wa_bpop TYPE bapiekkop,
i_wa_ekpa TYPE ekpa,
i_message TYPE char72,
i_bapiretn TYPE bapiret2,
i_bapiret2 TYPE TABLE OF bapiret2 INITIAL SIZE 1,
i_vbpa TYPE TABLE OF vbpa INITIAL SIZE 1,
i_vbkd TYPE TABLE OF vbkd INITIAL SIZE 1,
i_ekpa TYPE TABLE OF ekpa INITIAL SIZE 1,
i_bsoi TYPE TABLE OF bapisditm INITIAL SIZE 1,
i_bsoix TYPE TABLE OF bapisditmx INITIAL SIZE 1,
i_bsos TYPE TABLE OF bapischdl INITIAL SIZE 1,
i_bsosx TYPE TABLE OF bapischdlx INITIAL SIZE 1,
i_bsop TYPE TABLE OF bapiparnr INITIAL SIZE 1,
i_bpoi TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
i_bpoix TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
i_bpos TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
i_bposx TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
i_bpop TYPE TABLE OF bapiekkop INITIAL SIZE 1,
i_text_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_line_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_txw_note TYPE TABLE OF txw_note INITIAL SIZE 1,
i_oij_el_doc_mot TYPE oij_el_doc_mot .
CONSTANTS: c_char_c VALUE 'C',
c_char_e VALUE 'E',
c_char_p VALUE 'P',
c_char_g VALUE 'G',
c_char_i VALUE 'I',
c_char_s VALUE 'S',
c_char_x VALUE 'X',
c_zsw(3) VALUE 'ZSW',
c_nomit_stat(4) VALUE 'ZDNY' .
DATA : lv_nomtk_split TYPE oij_nomtk.
DATA : i_order_split_create TYPE TABLE OF zsws_order_split.
DATA : wa_order_split_create TYPE zsws_order_split.
LOOP AT i_order_split_create INTO wa_order_split_create.
IF NOT i_create_order IS INITIAL .
CLEAR: i_create_order .
MOVE: wa_order_split_create-docnr TO i_ebeln,
wa_order_split_create-docitm TO i_ebelp .
CALL FUNCTION 'ME_EKKO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
IMPORTING
po_ekko = i_ekko
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
ENDIF .
Fill PO Header
i_bpoh-comp_code = i_ekko-bukrs .
i_bpoh-doc_type = i_ekko-bsart .
i_bpoh-vendor = i_ekko-lifnr .
i_bpoh-langu = i_ekko-spras .
i_bpoh-pmnttrms = i_ekko-zterm .
i_bpoh-purch_org = i_ekko-ekorg .
i_bpoh-pur_group = i_ekko-ekgrp .
i_bpoh-currency = i_ekko-waers .
i_bpoh-agreement = i_ekko-konnr .
i_bpoh-incoterms1 = i_ekko-inco1 .
i_bpoh-incoterms2 = i_ekko-inco2 .
Fill PO update indicator 'X'
i_bpohx-comp_code = c_char_x .
i_bpohx-doc_type = c_char_x .
i_bpohx-vendor = c_char_x .
i_bpohx-langu = c_char_x .
i_bpohx-pmnttrms = c_char_x .
i_bpohx-purch_org = c_char_x .
i_bpohx-pur_group = c_char_x .
i_bpohx-currency = c_char_x .
i_bpohx-agreement = c_char_x .
i_bpohx-incoterms1 = c_char_x .
i_bpohx-incoterms2 = c_char_x .
CALL FUNCTION 'ME_EKPO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
pi_ebelp = i_ebelp
IMPORTING
po_ekpo = i_ekpo
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF .
Fill PO Item
i_wa_bpoi-po_item = i_ekpo-ebelp .
i_wa_bpoi-material = i_ekpo-matnr .
i_wa_bpoi-plant = i_ekpo-werks .
i_wa_bpoi-stge_loc = i_ekpo-lgort .
i_wa_bpoi-quantity = wa_order_split_create-qty_acptd .
i_wa_bpoi-po_unit = i_ekpo-meins .
i_wa_bpoi-tax_code = i_ekpo-mwskz .
i_wa_bpoi-val_type = i_ekpo-bwtar .
i_wa_bpoi-item_cat = i_ekpo-pstyp .
i_wa_bpoi-acctasscat = i_ekpo-knttp .
i_wa_bpoi-agreement = i_ekpo-konnr .
i_wa_bpoi-agmt_item = i_ekpo-ktpnr .
APPEND i_wa_bpoi TO i_bpoi .
Fill PO Item update indicator 'X'
i_wa_bpoix-po_item = i_ekpo-ebelp .
i_wa_bpoix-po_itemx = c_char_x .
i_wa_bpoix-material = c_char_x .
i_wa_bpoix-plant = c_char_x .
i_wa_bpoix-stge_loc = c_char_x .
i_wa_bpoix-quantity = c_char_x .
i_wa_bpoix-po_unit = c_char_x .
i_wa_bpoix-tax_code = c_char_x .
i_wa_bpoix-val_type = c_char_x .
i_wa_bpoix-item_cat = c_char_x .
i_wa_bpoix-acctasscat = c_char_x .
i_wa_bpoix-agreement = c_char_x .
i_wa_bpoix-agmt_item = c_char_x .
APPEND i_wa_bpoix TO i_bpoix .
Fill PO Item Schedule
i_wa_bpos-po_item = i_ekpo-ebelp .
i_wa_bpos-sched_line = '0001' .
i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
i_wa_bpos-quantity = wa_order_split_create-qty_acptd .
APPEND i_wa_bpos TO i_bpos .
Fill PO Item schedule update indicator 'X'
i_wa_bposx-po_item = i_ekpo-ebelp .
i_wa_bposx-sched_line = '0001' .
i_wa_bposx-delivery_date = c_char_x .
i_wa_bposx-quantity = c_char_x .
APPEND i_wa_bposx TO i_bposx .
CLEAR: i_pargr .
SELECT SINGLE pargr
INTO i_pargr
FROM t161
WHERE bstyp = i_ekko-bstyp
AND bsart = i_ekko-bsart .
CLEAR i_ekpa[].
CALL FUNCTION 'MM_READ_PARTNERS'
EXPORTING
application = c_char_p
ebeln = i_ebeln
bstyp = i_ekko-bstyp
pargr = i_pargr
TABLES
x_ekpa = i_ekpa.
LOOP AT i_ekpa INTO i_wa_ekpa .
i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
i_wa_bpop-langu = sy-langu .
IF NOT i_wa_ekpa-lifn2 IS INITIAL .
i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
ELSE .
i_wa_bpop-buspartno = i_wa_ekpa-parnr .
ENDIF .
APPEND i_wa_bpop TO i_bpop .
CLEAR: i_wa_ekpa, i_wa_bpop .
ENDLOOP .
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = i_bpoh
poheaderx = i_bpohx
IMPORTING
exppurchaseorder = i_new_ebeln
TABLES
return = i_bapiret2
poitem = i_bpoi
poitemx = i_bpoix
poschedule = i_bpos
poschedulex = i_bposx.
i_order = i_new_ebeln .
SHIFT i_order LEFT DELETING LEADING '0' .
i_return-errortype = c_char_i .
i_return-workarea = c_zsw .
i_return-message = '064' .
i_return-variable1 = i_order .
loop at i_bapiret2 into i_bapiretn where type ca 'EAX' .
append i_bapiretn to t_bapi_return .
endloop .
if t_bapi_return[] is initial .
i_create_order = c_char_x .
CALL FUNCTION 'SWD_POPUP_MESSAGE_SEND'
EXPORTING
act_return = i_return. "Popup with new PO no.
ENDCASE . " Docind
ENDIF .
ENDLOOP. -
Goods Receipt against account assigned Purchase Order
Respected members,
I am doing the good receipt with movement type 101 and special stock E with ref to po.
In my purchase order in account assignment there is everything like sales order,internal order and profit centre and inventory gl account.
The inventory gl account made as a cost element 90.Account assigment category i am usingis M.
My problem is when i am doing good receipt it is generating only accounting document and in that value of profit centre and internal order is not coming for inventory gl account.It is not generating the profit centre document and co document.
But in Material Document everything is getting , I am able to have the all the values for the respective field.
I am not understanding where the values getting cleared off when it is generating a accounting document and why it is not geneating a controlling document.
The accounting document is posted to both balance sheet accounts
that is debit and credit entry.
I have checked the all configurations in obyc and omjj. but i am notgetting any clue.
And interesting thing is previously it is picking the values but now settings have been disturbed and now it is not picking ,why it so.
Please help me out as soon as possible.
Thanks a lot.dear,
kindly ckeck in omjj in "gbb" account whether your g/l acc..has been assigned or not..
kindly also check whether you have maintained profit center and cost center in"okb9" ..
also see in mm03 costing views 1 you have entered correct profit center...
or create a new g/l acc in fr00 and see its postings..
regards
rewa -
Purchase order no not getting displayed in FBL3N for doucment type RE
Dear all,
We have done a settings in FBL3N t.code. We have added BSEG-EBELN in the special fields and saved the layout. The purpose is to make the purchase order number to display when we are executing line item display for GR/IR clearing and Cenvat clearing gl account. Purchase order number is correctly getting displayed in Gr/ir clearing account. But in cenvat clearing gl account the transactions that are related to doucment type SA(that is J1IEX transaction), the purchase order number is getting displayed, but in the transactions that are related to document type RE(MIRO transactions), the purcahse order number is not getting displayed.
We have checked the BSEG table for the gl account. The purchase order number is not getting updated for the MIRO transactions in the cenvat clearing gl account.
Please suggest us so that the above issue can be solved.
Thanks & Regards,
AnandHi,
Could you please add field BSEG-EBELN as a special field in FBL3N (from menu path Settings -> Special fields). Then, select the Purchase order field again from "Change Layout" (Ctrl+F8). Now this field is available for display variants, it has the technical name 1-U_EBELN and the description 'Purchase Document'. The other field has the same description but as technical name
'1-EBELN'. When you create a display variant be aware that you select 1-U_EBELN and not 1-EBELN.
Please also refer to note 215798.
Regards
Ravinagh Boni -
Hi all,
i have two doubts related to the purchase order.
1. How to know the Status of the purchase order
ex: Open , Closed
2. How to get the Purchasing Quantity (KOMV-KAWRT)
Please Advice me..
Many thanks for all of your help.
Regards,
Lakshma.Hi
Here is the code to find out the open purchase order.
List of open purchase orders for a given plant/delivery period *
A purchase order is open when the delivery completed indicator = ' '*(field elikz.ekpo = space)
Tables
TABLES: EKKO, "Purchase order - header"
EKPO, "Purchase order - lines"
EKET, "Purchase order - delivery date"
EKBE, "Purchase order - history
LFA1, "Supplier - general info"
STXH, "Text table - header info"
T001W, "Plant description table
MARA, "Material master
MAKT, "Material description table
T163X.
DATA: BEGIN OF TXTF_HEADER. "Purchase order header texts
INCLUDE STRUCTURE THEAD.
DATA: END OF TXTF_HEADER.
DATA: BEGIN OF TXTF_LINES OCCURS 2. "Purchase order header texts
INCLUDE STRUCTURE TLINE.
DATA: END OF TXTF_LINES.
DATA: WNAME(70),
WLPEIN(1),
WEINDT(10),
WMENGE LIKE EKET-MENGE,
WBISMT LIKE MARA-BISMT,
W_HISTORY(1).
SELECT-OPTIONS : S-EINDT FOR EKET-EINDT.
SELECT-OPTIONS : S-WAERS FOR EKKO-WAERS.
FIELD-GROUPS : HEADER, GROUP1.
INSERT EKPO-WERKS
EKET-LPEIN
EKET-EINDT
EKPO-EBELN
EKPO-EBELP
EKPO-MATNR
EKKO-WAERS
EKKO-WKURS
EKKO-KUFIX
EKKO-BEDAT INTO HEADER.
INSERT EKKO-SPRAS
EKKO-EKGRP
T163X-EPSTP
EKPO-TXZ01
EKPO-KONNR
EKPO-KTPNR
EKET-MENGE
EKPO-MEINS
EKPO-LGORT
EKET-WEMNG
EKPO-NETPR
EKPO-PEINH
EKPO-BPRME
EKPO-NETWR
EKKO-LIFNR
W_HISTORY INTO GROUP1.
General data
INITIALIZATION.
EM_SELKB = 'X'.
EM_SELKK = ' '.
EM_SELKL = ' '.
EM_SELKA = ' '.
Start of program
START-OF-SELECTION.
Read purchase order items for this plant with delivery completed
indicator = space
GET EKPO.
SELECT * FROM T163X WHERE SPRAS EQ SY-LANGU
AND PSTYP EQ EKPO-PSTYP.
EXIT.
ENDSELECT.
IF SY-SUBRC NE 0.
T163X-EPSTP = EKPO-PSTYP.
ENDIF.
CHECK S-WAERS.
GET EKET.
CHECK S-EINDT.
IF EKPO-ELIKZ = ' ' AND EKPO-LOEKZ = ' '.
if eket-wemng = 0 and eket-wamng = 0.
CLEAR : W_HISTORY.
SELECT * FROM EKBE WHERE EBELN = EKPO-EBELN
AND EBELP = EKPO-EBELP.
EXIT.
ENDSELECT.
IF SY-SUBRC = 0.
MOVE '*' TO W_HISTORY.
ENDIF.
EXTRACT GROUP1.
endif.
ENDIF.
END-OF-SELECTION.
Sort by plant - delivery date
SORT.
FORMAT INTENSIFIED OFF. "PPL26041995
LOOP.
read vendor
SELECT SINGLE * FROM LFA1
WHERE LIFNR = EKKO-LIFNR.
IF SY-SUBRC <> 0.
MOVE '???' TO LFA1-NAME1.
ENDIF.
search old materialnumber if needed
SELECT SINGLE * FROM MARA
WHERE MATNR = EKPO-MATNR.
IF SY-SUBRC <> 0.
MOVE '???' TO WBISMT.
ELSE.
MOVE MARA-BISMT TO WBISMT.
ENDIF.
read purchase order header text - first 2 lines of delivery text
CLEAR TXTF_LINES.
CLEAR TXTF_HEADER.
REFRESH TXTF_LINES.
MOVE EKPO-EBELN TO WNAME.
MOVE EKPO-EBELP TO WNAME+10.
SELECT SINGLE * FROM STXH
WHERE TDID = 'F04' AND
TDOBJECT = 'EKPO' AND
TDNAME = WNAME AND
TDSPRAS = EKKO-SPRAS.
IF SY-SUBRC = 0.
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = 'F04 '
LANGUAGE = EKKO-SPRAS
OBJECT = 'EKPO '
NAME = WNAME
IMPORTING
HEADER = TXTF_HEADER
TABLES
LINES = TXTF_LINES
EXCEPTIONS
ID = 01
LANGUAGE = 02
NAME = 03
NOT_FOUND = 04
OBJECT = 05
REFERENCE_CHECK = 06.
ENDIF.
READ TABLE TXTF_LINES INDEX 1.
print list
RESERVE 3 LINES.
AT NEW EKPO-WERKS.
SELECT SINGLE * FROM T001W WHERE WERKS = EKPO-WERKS.
IF SY-SUBRC NE 0. CLEAR T001W. ENDIF.
NEW-PAGE.
ENDAT.
CLEAR WEINDT.
CLEAR WLPEIN.
AT NEW EKET-EINDT.
CALL FUNCTION 'PERIOD_AND_DATE_CONVERT_OUTPUT'
EXPORTING
INTERNAL_DATE = EKET-EINDT
INTERNAL_PERIOD = EKET-LPEIN
IMPORTING
EXTERNAL_DATE = WEINDT
EXTERNAL_PERIOD = WLPEIN.
ENDAT.
WRITE: / WLPEIN,
3 WEINDT,
13 SY-VLINE(1),
14 EKPO-EBELN,
25 EKPO-EBELP+3(2),
28 T163X-EPSTP,
31 EKPO-MATNR,
add old material number
52 wbismt,
62 EKET-MENGE,
80 EKPO-MEINS,
85 EKKO-LIFNR,
116 SY-VLINE(1),
127 txtf_lines-tdline(40),
118 EKKO-WAERS,
122 EKPO-NETPR,
142 EKPO-PEINH,
152 EKPO-BPRME,
157 EKPO-NETWR,
177 EKKO-WKURS,
190 EKKO-KUFIX,
193 EKKO-BEDAT,
206 EKKO-EKGRP,
211 SY-VLINE,
216 W_HISTORY.
add storage location
171 sy-vline, ekpo-lgort,
178 sy-vline.
READ TABLE TXTF_LINES INDEX 2.
SELECT SINGLE * FROM MAKT WHERE MATNR = EKPO-MATNR
AND SPRAS = SY-LANGU.
IF SY-SUBRC NE 0.
MOVE EKPO-TXZ01 TO MAKT-MAKTX.
ENDIF.
WMENGE = EKET-MENGE - EKET-WEMNG.
IF EKPO-KONNR = SPACE.
WRITE:/13 SY-VLINE(1),
MAKT-MAKTX(30) UNDER EKPO-MATNR,
WMENGE UNDER EKET-MENGE,
LFA1-NAME1 UNDER EKKO-LIFNR,
126 sy-vline(1),
txtf_lines-tdline(40) under txtf_lines-tdline,
116 SY-VLINE(1),
171 sy-vline(1),
211 SY-VLINE(1).
ELSE.
WRITE:/13 SY-VLINE(1),
ekpo-konnr under ekpo-ebeln,
ekpo-ktpnr+3(2) under ekpo-ebelp,
MAKT-MAKTX(30) UNDER EKPO-MATNR,
WMENGE UNDER EKET-MENGE,
LFA1-NAME1 UNDER EKKO-LIFNR,
126 sy-vline(1),
txtf_lines-tdline(40) under txtf_lines-tdline,
167 sy-vline(1),
116 SY-VLINE(1),
211 SY-VLINE(1).
ENDIF.
ULINE /13(207).
AT END OF EKET-EINDT.
ULINE 1(12).
ENDAT.
ENDLOOP.
print delivery date with first line.
TOP-OF-PAGE.
CALL FUNCTION 'PERIOD_AND_DATE_CONVERT_OUTPUT'
EXPORTING
INTERNAL_DATE = EKET-EINDT
INTERNAL_PERIOD = EKET-LPEIN
IMPORTING
EXTERNAL_DATE = WEINDT
EXTERNAL_PERIOD = WLPEIN.
CALL FUNCTION 'Z_PRINT_TITEL' "PPL24041995
EXPORTING PROGNAME = 'ZMCH0089' "PPL24041995
TEXTTYPE = 'T' "PPL24041995
ORG_PROGNAME = ' '
PARAM_1 = EKPO-WERKS "PPL24041995
PARAM_2 = T001W-NAME2 "PPL24041995
PARAM_3 = ' ' "PPL24041995
PARAM_4 = ' ' "PPL24041995
PARAM_5 = ' '. "PPL24041995
Reward if helpful.
Chandralekha
Maybe you are looking for
-
Trying to load firefox and I get a message saying it can't create a file
I have tried loading firefox and it tells me that it can not create a file. How do I fix this problem?
-
copy link 0.1.7 addon is working with firefox 19.0, what can I do for open all url at a time with help of short key.
-
Can't log in through the web controller
i am operating the mac x server 10.5, it works well with the podcast capture. I install the podcast capture web controller just now. When i try to log in through the safari with https://myserver:8143/ with username and password(username:pcastadmin, p
-
I ran pacman -Sy to upgrade the database - and as usual it worked perfectly. I then ran pacman -Su to upgrade (I do it once a week) and there is nothing. Pacman will not respond to any command. I made no changes. To be sure, I edited /etc/pacman.conf
-
Resetting account's Security questions
How can I reset my security questions. I have forgotten them.... Please help!