SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Change PO conditions



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Wed Oct 10, 2007 11:19 pm    Post subject: Change PO conditions Reply with quote

See notes:
Note 439110 - Enjoy PO BAPI: Conditions
Note 428621 - EnjoySAP purchase order BAPIs - price det. & cond. change
Which functions are available and how to fill the new structures/fields

1. Two new condition structures were introduced, POCONDHEADER and POCONDHEADERX. These can be used to change header conditions.
When you use this function, you should fill the following fields:
COND_TYPE (condition type, for example, FRA1)
COND_VALUE (condition value, for example, 200.00)
CURRENCY (currency, for example, USD, enter % for percent in this field).
CHANGE_ID (input values: I insert, U update, D delete)

2. Structures POCOND and POCONDX are now only responsible for the item conditions.
When you use this function, you should fill the following fields:
ITM_NUMBER (line item number in the purchase order)
COND_VALUE (condition value, for example, 150.000)
CURRENCY (currency key, for example, USD; enter % for percent in this field)
CHANGE_ID (input values: I insert, U update, D delete)

3. In the ABAP Dictionary structure BAPIMEPOCOND, an indicator CHANGE_ID was included that you can use to control whether it is an update (U), a new entry (I) or a deletion (D).

Note 399791 - Enjoy-BAPI_PO...: Condition values are not transferred
Note 197958 - BAPIs for purchase orders - Missing functions

Code:
REPORT ZPRUEBAPO2 .

data: POITEM like BAPIMEPOITEM occurs 0 with header line,
     RETURN like BAPIRET2 occurs 0 with header line,
     ITEM_HEADER like BAPIMEPOITEMX occurs 0 with header line,
*"      POADDRDELIVERY STRUCTURE  BAPIMEPOADDRDELIVERY OPTIONAL
    POSCH like BAPIMEPOSCHEDULE occurs 0 with header line,
    POSCHX like BAPIMEPOSCHEDULX occurs 0 with header line,
     POACCOUNT like BAPIMEPOACCOUNT occurs 0 with header line,
*"      POACCOUNTPROFITSEGMENT STRUCTURE  BAPIMEPOACCOUNTPROFITSEGMENT
*"         OPTIONAL
     item_accx like BAPIMEPOACCOUNTX occurs 0 with header line,
*"      POCONDHEADER STRUCTURE  BAPIMEPOCONDHEADER OPTIONAL
*"      POCONDHEADERX STRUCTURE  BAPIMEPOCONDHEADERX OPTIONAL
     POCOND like BAPIMEPOCOND occurs 0 with header line,
     condxx like  BAPIMEPOCONDX occurs 0 with header line.
*"      POLIMITS STRUCTURE  BAPIESUHC OPTIONAL
*"      POCONTRACTLIMITS STRUCTURE  BAPIESUCC OPTIONAL
*"      POSERVICES STRUCTURE  BAPIESLLC OPTIONAL
*"      POSRVACCESSVALUES STRUCTURE  BAPIESKLC OPTIONAL
*"      POSERVICESTEXT STRUCTURE  BAPIESLLTX OPTIONAL
*"      EXTENSIONIN STRUCTURE  BAPIPAREX OPTIONAL
*"      EXTENSIONOUT STRUCTURE  BAPIPAREX OPTIONAL
*"      POTEXTHEADER STRUCTURE  BAPIMEPOTEXTHEADER OPTIONAL
*"      POTEXTITEM STRUCTURE  BAPIMEPOTEXT OPTIONAL
*"      POPARTNER STRUCTURE  BAPIEKKOP OPTIONAL

data po_item(2) value '10'.

poitem-po_item = po_item.
poitem-material = '000000000000000168'.
poitem-plant = '0003'.
poitem-quantity = '1'.
*poitem-net_price = '4.00'.
poitem-po_unit = 'UD'.
poitem-ACCTASSCAT = 'Z'.
poitem-item_cat = '3'.
APPEND poitem.

item_header-po_item = po_item.
item_header-po_itemx = 'X'.
item_header-material = 'X'.
item_header-quantity = 'X'.
*item_header-net_price = 'X'.
item_header-po_unit = 'X'.
item_header-plant = 'X'.
item_header-ACCTASSCAT = 'X'.
item_header-item_cat = 'X'.
APPEND item_header.
*
*posch-po_item = po_item.
*posch-sched_line = '0001'.
*posch-DEL_DATCAT_EXT = 'D'.
*posch-delivery_date = sy-datum + 1.
*posch-quantity = '1'.
*posch-deliv_time = '000000'.
*posch-STAT_DATE = sy-datum + 1.
*APPEND posch.
*
*poschx-po_item = po_item.
*poschx-sched_line = '0001'.
*poschx-po_itemx = 'X'.
*poschx-sched_linex = 'X'.
*APPEND poschx.

pocond-itm_number = po_item.
*pocond-cond_st_no = '001'.
*pocond-cond_count = '01'.
pocond-cond_type = 'PB00'.
pocond-cond_value = '35.10'.
pocond-currency = 'EUR'.
pocond-change_id = 'U'.
APPEND pocond.

condxx-itm_number = po_item.
*condxx-cond_st_no = '001'.
condxx-cond_type = 'X'.
condxx-cond_value = 'X'.
condxx-currency = 'X'.
condxx-change_id = 'X'.
APPEND condxx.

poaccount-po_item = po_item.
*poaccount-gl_account = '0601215012'.
poaccount-sd_doc = '0000000255'.
poaccount-itm_number = '00010'.
APPEND poaccount.

item_accx-po_item = po_item.
item_accx-itm_number = 'X'.
item_accx-sd_doc = 'X'.
APPEND item_accx.

CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
 purchaseorder                = '4500009781'
*  POHEADER                     =  HEADER
*  POHEADERX                    =  HEADERXX
* IMPORTING
*  EXPHEADER
 TABLES
 RETURN                       = RETURN
 POITEM                       = POITEM
 POITEMX                      = ITEM_HEADER
 POSCHEDULE                   = POSCH
 POSCHEDULEX                  = POSCHX
 POACCOUNT                    = POACCOUNT
*  POACCOUNTPROFITSEGMENT       = PROF
 POACCOUNTX                   = ITEM_ACCX
 POCOND                       = POCOND
 POCONDX                      = CONDXX.

*  IF sy-subrc = 0.
*    DESCRIBE TABLE return LINES sy-tfill.
*    IF sy-tfill = 0.
     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
*    ENDIF.
*  ENDIF.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.