Product Information
process to automatic re-price sales order through program.
Hope you’re doing Good!
I would like to share with some information regarding the adjustment of the sales order under a custom program.
Please follow these steps below.
What is meant by an Pricing?
Pricing in Sales and Distribution is used to define the calculation of prices for external vendors or customers and cost. This condition is defined as a set of conditions when a price is calculated.
When we re-price the sales order we have to go for Tcode VA02 and enter sales order number and click on item number and navigate into conditions tab select condition type click on update button and select Pricing type as “B” then the re-pricing will done.
if its single sales order we can re-price. if its multiple then we can use below program there we can re-price multiple sales orders at a time.
Step 1:
Go to table VKDFS(Billing Initiator) take any one sales order intial the net value is positive i need to re-price this amount.
Initially the net value look like this:
Step 2:
Go to program and enter the sales order and Sales org and execute the program.
After the execution program will get an message called “Re-price Has done successfully”.
Step 3:
Again open table VKDFS and enter the sales order lets look whether re-price is done or not using our program.
If we want to revert the amount into positive goto tcode VK12.Enter condition type and press enter select org material. Enter sales org and material execute.
After entered above required fields and execute then the below screen will appears.
Pseudocode:
*&———————————————————————*
*& Report ZREPRICE_SO
*&———————————————————————*
*&
*&———————————————————————*
REPORT zreprice_so.
*Data Declaration
***Data Declarations******
DATA: lti_vkdfs TYPE TABLE OF vkdfs,
wa_pie_task TYPE zpie_task,
ti_return TYPE TABLE OF zpie_return,
wa_return TYPE zpie_return.
*Tables Declaration
TABLES:vbco7,
vbkd,
vbak.
*Range declaration
RANGES: r_fkdat FOR vkdfs-fkdat.
*Selection screen declarations
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-a01.
SELECT-OPTIONS : s_vkorg FOR vbco7-vkorg. “sales org
SELECT-OPTIONS : s_vtweg FOR vbco7-vtweg, “Dist channel
s_spart FOR vbco7-spart. “Division
SELECT-OPTIONS: s_fkdat FOR vbkd-fkdat. “billing date from
SELECT-OPTIONS: s_fkart FOR vbco7-fkart, “billing type
s_auart FOR vbak-auart. “Sales order type
SELECT-OPTIONS: p_kunnr FOR vbco7-kunnr MATCHCODE OBJECT debi, “sold to party
s_vbeln FOR vbco7-vbeln.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: p_allea LIKE vbco7-allea DEFAULT ‘X’. “Order
SELECTION-SCREEN COMMENT (15) TEXT-p11.
PARAMETERS: p_allei LIKE vbco7-allei. “intercompany
SELECTION-SCREEN COMMENT (15) TEXT-p12.
PARAMETERS: no_faksk LIKE vbco7-no_faksk. “No bill block
SELECTION-SCREEN COMMENT (15) TEXT-p13.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
wa_pie_task-task = ‘Reprice Sales Order’.
IF NOT ( p_kunnr[] IS INITIAL AND
NOT s_vkorg-low IS INITIAL AND
NOT s_vtweg-low IS INITIAL AND
NOT s_spart-low IS INITIAL ) OR
NOT ( s_vbeln[] IS INITIAL ).
*——Reprice sales order—–
IF NOT s_vbeln IS INITIAL.
**** To fetch data from vkdfs table pass those values********
SELECT *
FROM vkdfs
INTO CORRESPONDING FIELDS OF TABLE lti_vkdfs
WHERE fktyp = ‘A’ AND
vkorg IN s_vkorg AND
kunnr IN p_kunnr AND
spart IN s_spart AND
vbeln IN s_vbeln AND
sortkri IN s_auart AND
fkart IN s_fkart AND
faksk = space.
ELSE.
SELECT *
FROM vkdfs
INTO CORRESPONDING FIELDS OF TABLE lti_vkdfs
WHERE fktyp = ‘A’ AND
vkorg IN s_vkorg AND
fkdat IN s_fkdat AND
kunnr IN p_kunnr AND
spart IN s_spart AND
vbeln IN s_vbeln AND
sortkri IN s_auart AND
fkart IN s_fkart AND “Billing Type
faksk = space.
ENDIF.
* Calling the FM for update sales order pricing
IF sy-subrc = 0.
CALL FUNCTION ‘ZPIE_MASS_SO_UPDATE_PRICING’
IN BACKGROUND TASK
AS SEPARATE UNIT
EXPORTING
im_task = wa_pie_task
TABLES
imt_vkdfs = lti_vkdfs
ext_return = ti_return
EXCEPTIONS
error_occured = 1
OTHERS = 2.
COMMIT WORK.
ELSE.
CALL FUNCTION ‘ZPIE_MASS_SO_UPDATE_PRICING’
EXPORTING
im_task = wa_pie_task
TABLES
imt_vkdfs = lti_vkdfs
ext_return = ti_return
EXCEPTIONS
error_occured = 1
OTHERS = 2.
ENDIF.
IF sy-subrc = 0.
MESSAGE: TEXT-001 TYPE ‘S’.
ENDIF.
ENDIF.
From above custom function module i have created as per my requirement inside the FM there is a standard include called ” LZPIEMPOWERUSERF01″.
Hope this Blog Might Helps. Thank you…
Hi Ramu, I have also got similar requirement. Can you share source code of FM ZPIE_MASS_SO_UPDATE_PRICING
Hi Ramu -share source code of FM ZPIE_MASS_SO_UPDATE_PRICING . Can not find include called ” LZPIEMPOWERUSERF01″ as you mentioned in your blog.