BAPI to get the Purchase Order Details
Hi Folks,
Which BAPI is used for retriving the details of a particulare Purchase Order? Please also mention how the same is used? Sample code will be helpful.
Thanks
Siddarth
Hi Sid,
Try this out...
Report ZBapi .
data: po_items type table of bapiekpo with header line.
parameters: p_ebeln type ekko-ebeln.
call function 'BAPI_PO_GETDETAIL'
exporting
purchaseorder = p_ebeln
ITEMS = 'X'
ACCOUNT_ASSIGNMENT = ' '
SCHEDULES = ' '
HISTORY = ' '
ITEM_TEXTS = ' '
HEADER_TEXTS = ' '
SERVICES = ' '
CONFIRMATIONS = ' '
SERVICE_TEXTS = ' '
EXTENSIONS = ' '
IMPORTING
PO_HEADER =
PO_ADDRESS =
tables
PO_HEADER_TEXTS =
po_items = po_items
PO_ITEM_ACCOUNT_ASSIGNMENT =
PO_ITEM_SCHEDULES =
PO_ITEM_CONFIRMATIONS =
PO_ITEM_TEXTS =
PO_ITEM_HISTORY =
PO_ITEM_HISTORY_TOTALS =
PO_ITEM_LIMITS =
PO_ITEM_CONTRACT_LIMITS =
PO_ITEM_SERVICES =
PO_ITEM_SRV_ACCASS_VALUES =
RETURN =
PO_SERVICES_TEXTS =
EXTENSIONOUT =
check sy-subrc = 0.
loop at po_items.
write:/ po_items.
endloop.
<b>Reward Points if Useful</b>
Regards
Gokul
Similar Messages
-
Function module or BAPI to get the sales order details.
Hi,
Can any one revert back with the FM or BAPI to get the sales order details.
I tried using BS01_SALESORDER_GETDETAIL, in my driver program of smartform but when i execute the form using VA03 -> Sales Document -> Issue output to -> Print preview, I am getting the required output.
if i see the print preview in the overview of the sales order (enter sales order and press enter), the above specified FM is not populating any data.
Thanks,
PrathapHi Prathap,
The above specified FM BAPISDORDER_GETDETAILEDLIST should work. As you need the item conditions,
Fill the I_BAPI_VIEW with header = 'X', item = 'X' and sdcond = 'X'.
Fill the SALES_DOCUMENTS-vbeln = sales order number.
Regards,
Shylaja -
How to get the Purchase order Qty in the object dependency
Hi,
We are using variant pricing in the purchase order. I have condition type say u201CZVBPu201D for Pallet cost. I defined Pallet cost as 5 USD per each (pallet). I have to calculate Number of pallets = Purchase order Qty/ 5. The number of pallets should be rounded to nearest integer.
My question is how to get the Purchase order Qty in the object dependency?
Is there any reference table and field can be used to get Purchase order Qty just like we use MMCOM-VKOND for variant pricing.
Appreciate your help
Thanks,
SriniHi,
1. I do not have system now so I can not conclusively tell about table field .
2. Since I did it long back so I also do not exactly remember it, there are more than one place where PO qty appears for example Item overview and Item details - one of the PO qty when used in the characteristic do pull the PO qty which can be used for variant pricing (so request to please update the forum with the correct table and field once you find it - in the meantime if I get opportunity to get to system I will also try and find out ). -
HOW CAN I GET THE PURCHASE ORDER RELEASE DATE
Dear All,
HOW CAN I GET THE PURCHASE ORDER RELEASE DATE - any reprot is there?
Thank you
AhmadHi,
u goto that PO and select Environment on top line .under that select header changes if u click on that u will get entire details who reased when released, date , time etc
regards,
Srinivas Kona -
I Need interactive report to list the purchase orders details for a vendor
I Need interactive report to list the purchase orders details for a vendor that has interactive drill down options to give the detail of vendor from vendor master.
Hi
see this sample report
this is Customer wise sales orders
just make similar report just using LFA1, EKKO and EKPO tables instead of KNA1,VBAK,VBAP
REPORT ZTEJ_INTAB1 LINE-SIZE 103 LINE-COUNT 35(5) NO STANDARD PAGE
HEADING.
*TABLES DECLARATION
TABLES : KNA1, VBAK, VBAP.
*SELECT OPTIONS
SELECT-OPTIONS: CUST_NO FOR KNA1-KUNNR.
*INITIALIZATION
INITIALIZATION.
CUST_NO-LOW = '01'.
CUST_NO-HIGH = '5000'.
CUST_NO-SIGN = 'I'.
CUST_NO-OPTION = 'BT'.
APPEND CUST_NO.
*SELECTION SCREEN VALIDATION
AT SELECTION-SCREEN ON CUST_NO.
LOOP AT SCREEN.
IF CUST_NO-LOW < 1 OR CUST_NO-HIGH > 5000.
MESSAGE E001(ZTJ1).
ENDIF.
ENDLOOP.
*BASIC LIST SELECTION
START-OF-SELECTION.
SELECT KUNNR NAME1 ORT01 LAND1 INTO
(KNA1-KUNNR, KNA1-NAME1,KNA1-ORT01,KNA1-LAND1)
FROM KNA1
WHERE KUNNR IN CUST_NO.
WRITE:/1 SY-VLINE,
KNA1-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
16 SY-VLINE,
KNA1-NAME1 UNDER 'NAME',
61 SY-VLINE,
KNA1-ORT01 UNDER 'CITY',
86 SY-VLINE,
KNA1-LAND1 UNDER 'COUNTRY',
103 SY-VLINE.
HIDE: KNA1-KUNNR.
ENDSELECT.
ULINE.
*SECONDARY LIST ACCESS
AT user-command.
IF SY-UCOMM = 'IONE'.
PERFORM SALES_ORD.
ENDIF.
IF SY-UCOMM = 'ITWO'.
PERFORM ITEM_DET.
ENDIF.
*TOP OF PAGE
TOP-OF-PAGE.
FORMAT COLOR 1.
WRITE : 'CUSTOMER DETAILS'.
FORMAT COLOR 1 OFF.
ULINE.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'CUSTOMER NO.',
16 SY-VLINE,
18 'NAME',
61 SY-VLINE,
63 'CITY',
86 SY-VLINE,
88 'COUNTRY',
103 SY-VLINE.
ULINE.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR SECONDARY LISTS
TOP-OF-PAGE DURING LINE-SELECTION.
*TOP OF PAGE FOR 1ST SECONDARY LIST
IF SY-UCOMM = 'IONE'.
ULINE.
FORMAT COLOR 1.
WRITE : 'SALES ORDER DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'CUSTOMER NO.',
16 SY-VLINE,
18 'SALES ORDER NO.',
40 SY-VLINE,
42 'DATE',
60 SY-VLINE,
62 'CREATOR',
85 SY-VLINE,
87 'DOC DATE',
103 SY-VLINE.
ULINE.
ENDIF.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR 2ND SECONDARY LIST
IF SY-UCOMM = 'ITWO'.
ULINE.
FORMAT COLOR 1.
WRITE : 'ITEM DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'SALES ORDER NO.',
40 SY-VLINE,
42 'SALES ITEM NO.',
60 SY-VLINE,
62 'ORDER QUANTITY',
103 SY-VLINE.
ULINE.
ENDIF.
FORMAT COLOR 3 OFF.
*END OF PAGE
END-OF-PAGE.
ULINE.
WRITE :'USER :',SY-UNAME,/,'DATE :', SY-DATUM, 85 'END OF PAGE:',
SY-PAGNO.
SKIP.
*& Form SALES_ORD
*& FIRST SECONDARY LIST FORM
FORM SALES_ORD .
SELECT KUNNR VBELN ERDAT ERNAM AUDAT INTO
(VBAK-KUNNR, VBAK-VBELN, VBAK-ERDAT, VBAK-ERNAM, VBAK-AUDAT)
FROM VBAK
WHERE KUNNR = KNA1-KUNNR.
WRITE:/1 SY-VLINE,
VBAK-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
16 SY-VLINE,
VBAK-VBELN UNDER 'SALES ORDER NO.' HOTSPOT ON,
40 SY-VLINE,
VBAK-ERDAT UNDER 'DATE',
60 SY-VLINE,
VBAK-ERNAM UNDER 'CREATOR',
85 SY-VLINE,
VBAK-AUDAT UNDER 'DOC DATE',
103 SY-VLINE.
HIDE : VBAK-VBELN.
ENDSELECT.
ULINE.
ENDFORM. " SALES_ORD
*& Form ITEM_DET
*& SECOND SECONDARY LIST FORM
FORM ITEM_DET .
SELECT VBELN POSNR KWMENG INTO
(VBAP-VBELN, VBAP-POSNR, VBAP-KWMENG)
FROM VBAP
WHERE VBELN = VBAK-VBELN.
WRITE : /1 SY-VLINE,
VBAP-VBELN UNDER 'SALES ORDER NO.',
40 SY-VLINE,
VBAP-POSNR UNDER 'SALES ITEM NO.',
60 SY-VLINE,
VBAP-KWMENG UNDER 'ORDER QUANTITY',
103 SY-VLINE.
ENDSELECT.
ULINE.
ENDFORM. " ITEM_DET
REPORT demo_list_at_pf.
START-OF-SELECTION.
WRITE 'Basic List, Press PF5, PF6, PF7, or PF8'.
AT pf5.
PERFORM out.
AT pf6.
PERFORM out.
AT pf7.
PERFORM out.
AT pf8.
PERFORM out.
FORM out.
WRITE: 'Secondary List by PF-Key Selection',
/ 'SY-LSIND =', sy-lsind,
/ 'SY-UCOMM =', sy-ucomm.
ENDFORM.
After executing the program, the system displays the basic list. The user can press the function keys F5 , F6 , F7 , and F8 to create secondary lists. If, for example, the 14th key the user presses is F6 , the output on the displayed secondary list looks as follows:
Secondary List by PF-Key Selection
SY-LSIND = 14
SY-UCOMM = PF06
Example for AT USER-COMMAND.
REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
START-OF-SELECTION.
WRITE: 'Basic List',
/ 'SY-LSIND:', sy-lsind.
TOP-OF-PAGE.
WRITE 'Top-of-Page'.
ULINE.
TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-pfkey.
WHEN 'TEST'.
WRITE 'Self-defined GUI for Function Codes'.
ULINE.
ENDCASE.
AT LINE-SELECTION.
SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
PERFORM out.
sy-lsind = sy-lsind - 1.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'FC1'.
PERFORM out.
WRITE / 'Button FUN 1 was pressed'.
WHEN 'FC2'.
PERFORM out.
WRITE / 'Button FUN 2 was pressed'.
WHEN 'FC3'.
PERFORM out.
WRITE / 'Button FUN 3 was pressed'.
WHEN 'FC4'.
PERFORM out.
WRITE / 'Button FUN 4 was pressed'.
WHEN 'FC5'.
PERFORM out.
WRITE / 'Button FUN 5 was pressed'.
ENDCASE.
sy-lsind = sy-lsind - 1.
FORM out.
WRITE: 'Secondary List',
/ 'SY-LSIND:', sy-lsind,
/ 'SY-PFKEY:', sy-pfkey.
ENDFORM.
When you run the program, the system displays the following basic list with a the page header defined in the program:
You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to pushbuttons in the application toolbar. The page header of the detail list depends on the status.
Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined pushbuttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each pushbutton.
For each interactive event, the system decreases the SY-LSIND system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, SY-LSIND still has the value 1.
Regards
Anji -
How to get the Purchase Order sample form to have 2 detail regions?
I would like to use the "Purchase Order" sample form as the base, and add one more "detail header" and "detail" subform to it.
So I copy and paste the "detail header" + "detail" subforms, and position them right beneath the first "detail" subform.
It works to certain extend. I can click the "Add Item" button(s), and it would expand the respective "detail" region.
The problem comes when things get expanded to the 2nd page.
Say, I first add 5 rows to the 2nd "detail" region, everything still fits in one page;
then I keep adding rows to the 1st "detail" region, and it begins to expand to the 2nd page....
everything in the first "detail" region can still fit in the first page,
the rows in the 2nd "detail" region should get pushed to the 2nd page...
but when I look at the 2nd page of the form, the "detail header" on the 2nd page is that of the "FIRST" detail header, not the 2nd detail header!!
So, when you look at the entire form, you have
First Detail Header
some First Detail Rows
2nd Detail Header
some 2nd Detail rows
--- end of page 1---
--- page 2---
First Detail Header
some detail rows (can't tell if they belong to the first detail region or 2nd detail region)
This obviously is not right.
So, how do I fix it such that the Detail Header on the 2nd page is that of the 2nd Detail header???an update:
I have found out that the detail rows on the 2nd page are all that of the 2nd detail region.
so, it's like this:
when you look at the entire form, you have
First Detail Header
all the First Detail Rows
2nd Detail Header
some 2nd Detail rows
--- end of page 1---
--- page 2---
First Detail Header
some 2nd detail rows -
BAPI to get the Sales order line item details
Hi,
My program gets Sale sorder and item as the input and I need to fetch all the item (Given item) details for this Sales Order from VBAP. Is there any BAPI to get the item details?Hi,
This is a sample code of BAPI.Try to map it to your requirement.This is not related to vendor.This is related to sales order.
Constants
CONSTANTS: c_contract LIKE vbak-vbeln VALUE '0020000720',
c_item LIKE vbap-posnr VALUE '000010'.
Structures
Structure to hold BAPI Header
DATA: st_bapisdhd1 LIKE bapisdhd1.
Internal Tables
Sales Order Create BAPI Return Messages
DATA: tbl_return TYPE STANDARD TABLE OF bapiret2
WITH HEADER LINE.
Sales Order BAPI Line Item
DATA: tbl_bapisditm TYPE STANDARD TABLE OF bapisditm
WITH HEADER LINE.
Sales Order BAPI Line Item
DATA: tbl_bapisditmx TYPE STANDARD TABLE OF bapisditmx
WITH HEADER LINE.
Sales Order BAPI Pricing Conditions
DATA: tbl_bapicond TYPE STANDARD TABLE OF bapicond
WITH HEADER LINE.
Sales Order BAPI Partner Functions
DATA: tbl_bapiparnr TYPE STANDARD TABLE OF bapiparnr
WITH HEADER LINE.
Sales Order BAPI Schedule Lines
DATA: tbl_bapischdl TYPE STANDARD TABLE OF bapischdl
WITH HEADER LINE.
Sales Order BAPI Schedule Lines
DATA: tbl_bapischdlx TYPE STANDARD TABLE OF bapischdlx
WITH HEADER LINE.
Sales Order BAPI Pricing Conditions
DATA: tbl_bapicondx TYPE STANDARD TABLE OF bapicondx
WITH HEADER LINE.
Customer Enhancement for VBAK, VBAP, VBEP
DATA: tbl_bapiparex TYPE STANDARD TABLE OF bapiparex
WITH HEADER LINE.
Table to hold BAPI Detail Conditions
DATA: tbl_bapisdcond TYPE STANDARD TABLE OF bapisdcond
WITH HEADER LINE.
Table to hold Return Messages from Sales Order Change BAPI
DATA: tbl_return_chg TYPE STANDARD TABLE OF bapiret2
WITH HEADER LINE.
Variables
DATA: g_vbeln_created LIKE vbak-vbeln,
g_valid_contract TYPE c,
g_cont_price_date TYPE d.
Start of Selection
START-OF-SELECTION.
PERFORM validate_contract.
PERFORM create_sales_ord.
PERFORM update_sales_ord.
End of Selection
END-OF-SELECTION.
PERFORM write_output_report.
Subroutines
*& Form create_sales_ord
Create the Sales Order
FORM create_sales_ord .
PERFORM populate_bapi_tables.
PERFORM call_create_sales_ord_bapi.
ENDFORM. " create_sales_ord
*& Form populate_bapi_tables
Fill up the BAPI Tables
FORM populate_bapi_tables .
PERFORM populate_bapi_header.
PERFORM build_bapi_partners.
PERFORM build_bapi_items.
PERFORM build_bapi_sched_lines.
ENDFORM. " populate_bapi_tables
*& Form populate_bapi_header
Build BAPI Header Details
FORM populate_bapi_header .
CLEAR st_bapisdhd1.
st_bapisdhd1-doc_type = 'ZOC'. "Order type
st_bapisdhd1-sales_org = '026'. "Sales Org
st_bapisdhd1-distr_chan = '00'. "Dist Channel
st_bapisdhd1-division = '00'. "Division
st_bapisdhd1-purch_no_c = 'Cust Po No'. "Cust PO No
st_bapisdhd1-name = 'Orderer'. "Name of Orderer
st_bapisdhd1-ord_reason = ''. "Order Reason
st_bapisdhd1-sales_off = '3001'. "Sales Office
st_bapisdhd1-sales_grp = '301'. "Market Area
IF g_valid_contract = 'X'.
st_bapisdhd1-price_date = g_cont_price_date.
ENDIF.
ENDFORM. " populate_bapi_header
*& Form build_bapi_partners
Build BAPI Partner Functions
FORM build_bapi_partners .
CLEAR tbl_bapiparnr.
tbl_bapiparnr-partn_role = 'AG'.
tbl_bapiparnr-partn_numb = '0000100750'.
APPEND tbl_bapiparnr.
CLEAR tbl_bapiparnr.
tbl_bapiparnr-partn_role = 'WE'.
tbl_bapiparnr-partn_numb = '0000504472'.
APPEND tbl_bapiparnr.
ENDFORM. " build_bapi_partners
*& Form build_bapi_items
Build The BAPI Line Items
FORM build_bapi_items .
DATA: l_matnr LIKE mara-matnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = '10000072'
IMPORTING
output = l_matnr.
CLEAR tbl_bapisditm.
tbl_bapisditm-itm_number = c_item.
IF g_valid_contract = 'X'.
tbl_bapisditm-ref_doc = c_contract.
tbl_bapisditm-ref_doc_it = c_item.
tbl_bapisditm-ref_doc_ca = 'G'. "Contract
ENDIF.
tbl_bapisditm-material = l_matnr.
tbl_bapisditm-plant = '3012'.
tbl_bapisditm-target_qty = '5.000'.
tbl_bapisditm-target_qu = 'M3'.
tbl_bapisditm-item_categ = 'ZZOC'.
tbl_bapisditm-sales_dist = '301'.
tbl_bapisditm-dlv_prio = '02'.
tbl_bapisditm-prc_group5 = '080'.
tbl_bapisditm-cust_mat35 = 'kdmat'.
tbl_bapisditm-route = 'TESYS'.
tbl_bapisditm-usage_ind = 'CIV'.
APPEND tbl_bapisditm.
CLEAR tbl_bapisditmx.
tbl_bapisditmx-itm_number = c_item.
tbl_bapisditmx-ref_doc = 'X'.
tbl_bapisditmx-ref_doc_it = 'X'.
tbl_bapisditmx-ref_doc_ca = 'X'.
tbl_bapisditmx-material = 'X'.
tbl_bapisditmx-updateflag = 'I'.
tbl_bapisditmx-plant = 'X'.
tbl_bapisditmx-target_qty = 'X'.
tbl_bapisditmx-target_qu = 'X'.
tbl_bapisditmx-item_categ = 'X'.
tbl_bapisditmx-sales_dist = 'X'.
tbl_bapisditmx-dlv_prio = 'X'.
tbl_bapisditmx-prc_group5 = 'X'.
tbl_bapisditmx-cust_mat35 = 'X'.
tbl_bapisditmx-usage_ind = 'X'.
tbl_bapisditmx-route = 'X'.
APPEND tbl_bapisditmx.
ENDFORM. " build_bapi_items
*& Form build_bapi_sched_lines
Build the BAPI Schedule Lines
FORM build_bapi_sched_lines .
CLEAR tbl_bapischdl.
tbl_bapischdl-itm_number = c_item.
tbl_bapischdl-req_qty = '1'.
tbl_bapischdl-req_date = sy-datum.
APPEND tbl_bapischdl.
ENDFORM. " build_bapi_sched_lines
*& Form build_bapi_conditions
Pull the BAPI Pricing Conditions from the Contract
FORM build_bapi_conditions .
LOOP AT tbl_bapisdcond.
CLEAR tbl_bapicond.
MOVE-CORRESPONDING tbl_bapisdcond TO tbl_bapicond.
APPEND tbl_bapicond.
CLEAR tbl_bapicondx.
tbl_bapicondx-itm_number = tbl_bapicond-itm_number.
tbl_bapicondx-cond_st_no = tbl_bapicond-cond_st_no.
tbl_bapicondx-cond_count = tbl_bapicond-cond_count.
tbl_bapicondx-cond_type = tbl_bapicond-cond_type.
tbl_bapicondx-updateflag = 'I'.
tbl_bapicondx-cond_value = 'X'.
tbl_bapicondx-currency = 'X'.
tbl_bapicondx-cond_unit = 'X'.
tbl_bapicondx-cond_p_unt = 'X'.
tbl_bapicondx-varcond = tbl_bapicond-varcond.
APPEND tbl_bapicondx.
ENDLOOP.
ENDFORM. " build_bapi_conditions
*& Form call_create_sales_ord_bapi
Call the Sales Order Create BAPI
FORM call_create_sales_ord_bapi .
CLEAR g_vbeln_created.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = st_bapisdhd1
IMPORTING
salesdocument = g_vbeln_created
TABLES
return = tbl_return
order_items_in = tbl_bapisditm
order_items_inx = tbl_bapisditmx
order_partners = tbl_bapiparnr
order_schedules_in = tbl_bapischdl.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDFORM. " call_create_sales_ord_bapi
*& Form update_sales_ord
Update the newly created Sales Order with the Pricing Conditions
from the Contract
FORM update_sales_ord .
CHECK g_valid_contract EQ 'X'.
PERFORM get_contract_details.
PERFORM build_bapi_conditions.
PERFORM call_change_sales_ord_bapi.
ENDFORM. " update_sales_ord
*& Form get_contract_details
Get Contract Details
FORM get_contract_details .
Need to manually get the relevant Pricing Conditions as the BAPI
BAPISDORDER_GETDETAILEDLIST causes problems when we call the BAPI
BAPI_SALESORDER_CREATEFROMDAT2 and BAPI_SALESORDER_CHANGE (I think
this is due to the fact that these BAPIs belong to the same Function
Group and there must be some common structures that are not cleared
causing us all sorts of grief when we try and call the next BAPI)
DATA: tbl_konv TYPE STANDARD TABLE OF konv WITH HEADER LINE.
DATA: tbl_komv TYPE STANDARD TABLE OF komv WITH HEADER LINE.
DATA: tbl_vbak TYPE STANDARD TABLE OF vbak WITH HEADER LINE.
Pricing Condition Master
DATA: BEGIN OF tbl_t685a OCCURS 0,
kschl LIKE t685a-kschl,
kaend_wrt LIKE t685a-kaend_wrt,
END OF tbl_t685a.
SELECT *
INTO TABLE tbl_vbak
FROM vbak
WHERE vbeln = c_contract.
READ TABLE tbl_vbak INDEX 1.
SELECT *
INTO TABLE tbl_konv
FROM konv
WHERE knumv = tbl_vbak-knumv AND
kposn = c_item.
CHECK sy-subrc EQ 0.
We now need to make sure we only bring across the Condition Types that
are EDITABLE. If we bring across non editable conditions (such as
'ZPR1') the Change Sales Order BAPI will fail
SELECT kschl kaend_wrt
INTO TABLE tbl_t685a
FROM t685a
FOR ALL ENTRIES IN tbl_konv
WHERE kappl EQ 'V' AND "Sales
kschl EQ tbl_konv-kschl AND
kaend_wrt EQ 'X' AND "Value is Editable
kmanu NE 'D'. "Process manually
Prepare for Binary Search
SORT tbl_t685a BY kschl.
LOOP AT tbl_konv.
READ TABLE tbl_t685a WITH KEY kschl = tbl_konv-kschl BINARY SEARCH.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING tbl_konv TO tbl_komv.
APPEND tbl_komv.
ENDIF.
ENDLOOP.
CHECK NOT tbl_komv[] IS INITIAL.
Map KOMV into the more BAPI friendly BAPISDCOND structure
CALL FUNCTION 'MAP_INT_TO_EXT_STRUCTURE'
TABLES
fxvbak = tbl_vbak
fxkomv = tbl_komv
fxbapikomv = tbl_bapisdcond
EXCEPTIONS
entry_missing = 1
OTHERS = 2.
ENDFORM. " get_contract_details
*& Form call_change_sales_ord_bapi
Call the Change Sales Order BAPI
FORM call_change_sales_ord_bapi .
DATA: st_head_chg LIKE bapisdh1x,
st_logic_switch TYPE bapisdls.
CHECK NOT g_vbeln_created IS INITIAL.
CHECK g_valid_contract EQ 'X'.
st_head_chg-updateflag = 'U'.
st_logic_switch-cond_handl = 'X'.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = g_vbeln_created
order_header_inx = st_head_chg
logic_switch = st_logic_switch
TABLES
return = tbl_return_chg
conditions_in = tbl_bapicond
conditions_inx = tbl_bapicondx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDFORM. " call_change_sales_ord_bapi
*& Form write_output_report
Produce Output Report
FORM write_output_report .
IF NOT g_vbeln_created IS INITIAL.
WRITE:/ 'Success! Sales Order', g_vbeln_created, 'was created!'.
ELSE.
WRITE:/ 'Failure! Sales Order was not created!'.
ENDIF.
SKIP.
WRITE:/ 'Sales Order Create Log'.
LOOP AT tbl_return.
WRITE:/ tbl_return-type, tbl_return-id, tbl_return-number,
tbl_return-message.
ENDLOOP.
SKIP.
WRITE:/ 'Sales Order Change Log'.
LOOP AT tbl_return_chg.
WRITE:/ tbl_return_chg-type, tbl_return_chg-id,
tbl_return_chg-number, tbl_return_chg-message.
ENDLOOP.
ENDFORM. " write_output_report
*& Form validate_contract
Make sure that the Contract is Valid
FORM validate_contract .
DATA: l_gueen LIKE vbak-gueen,
l_prsdt LIKE vbkd-prsdt.
SELECT SINGLE vbakgueen vbkdprsdt
INTO (l_gueen, l_prsdt)
FROM vbak
INNER JOIN vbkd
ON vbakvbeln = vbkdvbeln
WHERE vbak~vbeln = c_contract AND
vbkd~posnr = '000000'.
IF sy-datum LE l_gueen.
Contract is valid! Set Order Price Date
g_valid_contract = 'X'.
g_cont_price_date = l_prsdt.
ENDIF.
ENDFORM. " validate_contract
Regards
Rajesh Kumar -
Is there any function module to get the purchase order conditions from EONP
Hi,
I want to get the EONP and EONH table details for the purchase orders with the help of function module. Can anyone tell me any function module name which would give me those details.
Thanks,
AtanuHi
Check with BAPI function module BAPI_PO_GETDETAIL and BAPI_PO_GETDETAIL1.
Regards
Srilaxmi -
How to get the purchase order's delivery completed date in the dictionary
Hi consutant :
In me23n transaction code ,I set the delivery completed indicator mannul . I can see the state of
delivery completeed by click environment->item changes menu . But I don't find the date that I set
the state of delivery completed in the abap dictionary .
How to find that table store the date of delivery completed about purchase order ?
thanks .hi
you will get delivery date from
eket table .
and field name is eindt.
how to go there. ?
ans===>
SELECT ebeln ebelp eindt " For Delivery Date EKET
FROM eket
INTO TABLE it_eket
FOR ALL ENTRIES IN it_ekpo
WHERE ebeln = it_ekpo-ebeln
AND ebelp = it_ekpo-ebelp.
reward point if its usefull. -
How to get the Purchased item details in R12
Hello everyone, am using Oracle Application R12,
I need the following details for the all purchased item,
how to get the item_id,item_name,vendor_name,ordered_quantity,rec eived_quantity,
returned_quantity.
Thank you.
Regards,
Gurujothi.Hi Gurujothi,
pl.try the following SQL. it will give you complete details of purchasing.
SELECT A.SEGMENT1 PO_NO, B.LINE_NUM, C.SHIPMENT_NUM,
C.QUANTITY,C.QUANTITY_ACCEPTED,C.QUANTITY_BILLED,C.QUANTITY_CANCELLED,C.QUANTITY_RECEIVED,C.QUANTITY_REJECTED,D.QUANTITY QUANTITY_RETURNED,
B.ITEM_ID,E.DESCRIPTION,F.VENDOR_NAME
FROM PO_HEADERS_ALL A , PO_LINES_ALL B , PO_LINE_LOCATIONS_ALL C , RCV_TRANSACTIONS D, MTL_SYSTEM_ITEMS_B E , PO_VENDORS F
WHERE A.ORG_ID = &OU_NAME
AND A.PO_HEADER_ID = &PO_HEADER_ID
AND B.PO_HEADER_ID = A.PO_HEADER_ID
AND C.PO_LINE_ID = B.PO_LINE_ID
AND D.PO_LINE_LOCATION_ID (+) = C.LINE_LOCATION_ID
AND D.TRANSACTION_TYPE (+) ='RETURN TO VENDOR'
AND E.INVENTORY_ITEM_ID = B.ITEM_ID
AND E.ORGANIZATION_ID = C.SHIP_TO_ORGANIZATION_ID
AND F.VENDOR_ID=A.VENDOR_ID
regards
sanjay -
Help with purchase order detail
Hello Experts,
I am currently trying to get information on a purchase order, but not having any luck. I need to find the PO Number, and PO Approval Date. I cannot find either of these. I have tried using BBP_PD_PO_GETDETAIL, but have no luck with this. here is what I have:
move w_result-sc_guid TO lv_guid.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
I_GUID = lv_guid
I_OBJECT_ID = w_zwkflw_rep-object_id
I_WITH_ITEMDATA = 'X'
I_READ_FROM_ARCHIVE = 'X'
IMPORTING
E_HEADER = ls_e_header
TABLES
E_ITEM = lt_e_item
All I have available is shopping cart number. Can anyone assist please? Thank you.hi,
try below steps to retrieve purchase order details from a shopping cart.
get the purchase order GUID in ET_HEADER_REL parameter of BBP_PD_SC_GETDETAIL fm using the shopping cart number or GUID.
then to get the purchase order details, use BBP_PD_PO_GETDETAIL importing I_GUID = purchase order GUID from ET_HEADER_REL.
regards. -
Extracting Purchase order details
Hai All,
I am workng on a report in which I have to display the purchase order and GRN details for a given Purchase Requisition number.
If the PR has 5 line items and PO is made only for 2 line items, then the purchase order details for only those 2 line items should be displayed, but I am getting default purch ord data for all those 5 line items even though PO is not made for 3 line items.
Can anyone pls help me on this....Hi ,
Here goes ur solution , Only u have to use EBAN and EKBE for the purpose.The report displays item no wise details of PR with PO and GR. selection options for PR REQ or REQ Date is used .
types: begin of int_pr,
banfn like eban-banfn,
bnfpo like eban-bnfpo,
badat like eban-badat,
ebeln like eban-ebeln,
bedat like eban-bedat,
matnr like eban-matnr,
end of int_pr.
declaring work area.
data: pr_wa type table of int_pr,
pr_wa1 like line of pr_wa,
prnum(10),prval(10),tot type n.
types: begin of type_ekbe,
ebeln like ekbe-ebeln, " PO NO
ebelp like ekbe-ebelp, " ITEM NO IN PO
belnr like ekbe-belnr, " GR NO
end of type_ekbe.
data: itab_gr type table of type_ekbe,
wa_gr like line of itab_gr.
giving selection crieteria
select-options pr_no for eban-banfn. " for purchase requistion no.
select-options pr_dt for eban-badat. " for pr date
start-of-selection.
if pr_no is not initial.
select banfn bnfpo badat ebeln bedat matnr into corresponding fields of table pr_wa from eban where
banfn in pr_no and loekz ne 'x'.
select ebeln ebelp belnr into table itab_gr from ekbe for all entries in pr_wa where ebeln = pr_wa-ebeln and ebelp = pr_wa-bnfpo.
elseif pr_dt is not initial.
select banfn bnfpo badat ebeln bedat matnr into corresponding fields of table pr_wa from eban where
badat in pr_dt and loekz ne 'x' order by badat.
select ebeln ebelp belnr into table itab_gr from ekbe for all entries in pr_wa where ebeln = pr_wa-ebeln and ebelp = pr_wa-bnfpo.
endif.
loop at pr_wa into pr_wa1.
read table itab_gr into wa_gr with key ebeln = pr_wa1-ebeln ebelp = pr_wa1-bnfpo.
if pr_wa1-ebeln ne ' '.
write: / sy-vline,2(10) pr_wa1-banfn color 2, sy-vline,14(12) pr_wa1-badat color 2, sy-vline, 28(9) pr_wa1-bnfpo color 2, sy-vline, 40(13) pr_wa1-matnr color 2, sy-vline, 55(16) pr_wa1-ebeln color 2, sy-vline, 74(15) pr_wa1-bedat color 2, sy-vline,
wa_gr-belnr,sy-vline.
else.
write: / sy-vline,2(10) pr_wa1-banfn color 2, sy-vline,14(12) pr_wa1-badat color 2, sy-vline, 28(9) pr_wa1-bnfpo color 2, sy-vline, 40(13) pr_wa1-matnr color 2, sy-vline, 55(16) 'not processed' color 6, sy-vline, 74(15) pr_wa1-bedat color 2, sy-vline,
wa_gr-belnr,sy-vline.
endif.
endloop.
uline at /1(90).
thats all u have to do for getting the required output. -
Change of Sales Order automatically changes the purchase order
Hi
I am working on a scenario where a as soon as a sales order is created it will also create a purchase order on plant which will supply the item to the plant on which sales order is created.This works fine.
Now when I change sales order( order qty ,requested delivery date, new item added) . On saving the sales order it should change the purchase order which has already been created by updating the schdule lines in the purchase order with new values from the sales order. It is all in same SAP instance.
Here are possible ways I can think of:-
1 Change of SO will create a SO IDOC . The SO IDOC should supply required values to the PO Idoc . The PO IDOC should get posted to SAP to change the existing PO. Client does not have XI so we cant use XI for conversion.
2 Changing a SO will trigger workflow.The Workflow executes ABAP program which takes data from SO and calls BAPI to change the purchase order and sends notification that PO has changed. Which BAPI?
Any thoughts are welcome. We are on 4.7 and we dont have XI. So please do not suggest XI based solution.
PrashantaPrashanta,
For your 2nd part of question, you can use 'BAPI_PO_CHANGE' to change the PO.
Thanks -
hi all
i want to look purchase order from year 2008, but there data are archieve, how can i look backP
THX abap_begin.Hey,
Check for the Archive Documentation. SAP ADK.
To get the Purchase order, there are set of FM's given by SAP. I don't remember the exact name but you can check with the following: ASHdoc* for ARCHIVEEKKO* (not able to recollect the exact names)
Use SARE and SARJ transaction to go to the archiving tables. Provide your Archiving object name, click display, click on technical details and you can get archiving table names as well. Never use table name directly but use FM's given by SAP. -
How to get the Process order Number (Deatials by providing Salese order)
Hi
I want help to get the Process order details against with sales order number
in which table i ll get this information and any particular Function module is available???
Regards
Jagadishhere KDAUF is empty
Any other table is there i checked AUFK also AFKO also i ma not getting.
Maybe you are looking for
-
YouTube/Vimeo degrading the quality of my video!
I have created videos in After Effects, rendered them in Adobe Media Encoder, and uploaded them to YouTube with no problem many times over the years. For a reason I cannot determine, my most recent project, no matter how I render it, loses an enorm
-
Need Text variable for Bex which take values from another variable
Hello , I have a requirement to show date values in query description. User want to run a query which runs for 5 sept till last sunday. I have one exit which provides last week date range ( low= last week monday & high = last week sunday ) i have ac
-
Camera Orientation in Air for android
Hello, i look for a way to setting the camera orientation. If i get the camera , and attach it to a video, the camera is always on landscape orientation. If i try to rotate the video to have a pseudo portrait orientation, nothing appear on the video.
-
Cp6 - effects (how to fade in from top to bottom?)
Hello all, I am attempting to simulate an effect I often used in Lectora. I used this effect on text bullets where the text would slowly appear (fade in) one line at a time from top to bottom. Is there a similar effect in Captivate 6. I gave up looki
-
I have students who have just purchased Elements 11. Do they need to update Camera RAW immediately? I would think that a new version would be up-to-date. Is there any way to make Windows software show thumbnails for images processed in Elements? Ma