‎2006 Aug 29 7:47 PM
I have created LLD, but do not know how to convert it to actual coding. Please help me out in same. please help me in as much points in which you can.
this custom table i have already created, now need to do abap programming for the points given below.
1. Created Custom Table named as ZPRICE
Field name Data Element Length
Description
VBELN VBELN CHAR 10 Contract Number
POSNR POSNR NUM 6 Contract Item
WAERK WAERK CUKY5 Currency
NETPR NETPR CURR11 Net Price
MEINS MEINS UNIT3 Base Unit of Measure
ZEFF_DATE DATE CHAR8 Effective date
ZENT_DATE DATE CHAR8 Entered Date
1) Update pricing for all customer menus using tomorrows date and determine the net price (VBAP.NETPR).
***To create the function for update pricing within the contract, use function SD_BULK_CHANGE (function MPRF = New Pricing) as a template. The difference would be that the function also needs to update the pricing date (VBKD.PRSDT) with tomorrows date prior to updating the pricing
A.1) Update the pricing date:-
VBKD-PRSDT = tomorrows date.
A.2) To update the price:-
Part of standard function SD_BULK_CHANGE:-
WHEN 'MPRF'.
CLEAR FLAG.
CLEAR NEW_VBELN.
CLEAR PREISFINDUNG.
LOOP AT DOCUMENTS WHERE SELKZ NE SPACE.
*.... Kopfpreisfindung
IF DOCUMENTS-POSNR IS INITIAL.
PERFORM PREISFINDUNG_KOPF.
ELSE.
PERFORM PREISFINDUNG_POSITION.
ENDIF.
ENDLOOP.
*.. Falls Preisfindung auf Positionsebene, dann nochmal Sichern
CHECK PREISFINDUNG = 'P'.
*.. Sichern Beleg
PERFORM DOCUMENT_SAVE.
ENDCASE.
1) Select line within the new ZPRICE table
Where VBAK.VBELN = ZPRICE.VBELN (Contract #)
VBAK.POSNR = ZPRICE.POSNR (Item#)
2) Compare net price (NETPR) for that line within the ZPRICE table to the calculated tomorrows price determined in step 1 above. If price is the same do nothing. If price has changed delete previous entry and make a new entry. If no entry is found in the ZPRICE table for a specific contract and item combination make a new entry. Populate the new entry using the following logic.
ZPRICE.VBELN = VBAP.VBELN (Contract #)
ZPRICE.POSNR = VBAP.POSNR (Item #)
ZPRICE. WAERK = VBAP.WAERK (Document Currency)
ZPRICE.NETPR = VBAP.NETPR (Net Price)
ZPRICE.MEINS VBAP.MEINS (Item base unite of measure)
ZPRICE.DATAB = Tomorrows Date
ZPRICE.ERDAT = Todays Date
3) Select price condition records that were created today and have effective dates in the past
Select KONH.KNUMH (Condition record number)
KONH.DATAB (Valid-From Date)
Where KONH.KVEWE = A (Usage = Pricing)
KONH.KAPPL = V (Application = Sales/Distribution)
KONH.ERDAT = Todays Date (Created on date)
KONH.DATAB < Todays Date (Valid-From Date is in the past)
4) Select customer menus associated with the retroactive pricing condition record
Select VBAP.VBELN (Contract #)
VBAP.POSNR (Item #)
Where KONV.KNUMH = KONH.KNUMH (Condition record number)
VBAK.KNUMV = KONV.KNUMV (Document condition number)
VBAK.AUART = ZMNU (Document Type)
VBAP.POSNR = KONV.KPOSN (Item #)
5) Select net price for contract line item within the new ZPRICE table
Select ZPRICE.NETPR (Net Price)
Where VBAK.VBELN = ZPRICE.VBELN (Contract #)
VBAK.POSNR = ZPRICE.POSNR (Item#)
Determine and compare the net price of the contract line item for each previous day until the net price no longer equals the net price within the ZPRICE table. When complete, Use Function from which is used step A
6) Within ZPRICE table change the effective date (ZPRICE.DATAB) to the last day the price equalled ZPRICE.NETPR. In the above example the date would be 8/01/2006 since the price was different on 7/31/2006.
7) Select all customer menu and item combinations that are associated with each customer pricing contact that have an associated output condition record in table B504 (Customer Pricing Contact PARNR)
Select B504.PARNR (Contact #)
VBPA.VBELN (Contract #),
VBPA.POSNR (Item #)
Where VBPA.PARNR = B504.PARNR (Contact #)
VBPA.PARVW = Z8
VBAK.AUART = ZMNU
Inner Join VBAK.VBELN = VBPA.VBELN
😎 Per pricing contact determine if the price has changed for any contract and item combination assigned to that pricing contact. If price has changed, then trigger price change notification for the pricing contact.
 If at least one of the pricing contacts assigned contract and item combinations within the ZPRICE table has an entry date (ZPRICE.ERDAT) equal to todays date trigger the output for this pricing contact.
‎2006 Aug 29 7:53 PM
The time which you spent writing this post could have been spent trying to write the program on your own first. Have you given it a try yet? Not many contributors here are interested in writing your programs for you, but they have no problems helping out with syntax or confusing logic, but usually only after you have tried it yourself. You will learn more this way!
Regards,
Rich Heilman
‎2006 Aug 29 7:53 PM
The time which you spent writing this post could have been spent trying to write the program on your own first. Have you given it a try yet? Not many contributors here are interested in writing your programs for you, but they have no problems helping out with syntax or confusing logic, but usually only after you have tried it yourself. You will learn more this way!
Regards,
Rich Heilman
‎2006 Aug 29 8:47 PM
Thanx Rich for your valuable suggestion,
Well i have tried but as I am new to abap so do not what to use and how, i am reading lot of books and materials it's taking lot of time and i need to give it tomorrow only , if u want to be sure whether i have tried it or not I am sending the code which i have tried. please can u help confirming if code is written correctly or not.
For now i have i am sendinf the coding for first 3 points.plz correct me if i am wrong.
q.1) unable to understand you pass tomorrow's date in where condition
1) select single * from zprice into table itab_zprice where vbak-vbeln = zprice-vbeln and vbak-posnr = zprice-posnr.
2) read table itab_zprice with key vbak-vbeln = zprice-vbeln.
Select * from zprice into table zprice-vbeln where zprice-netpr = new_price.
If zprice-netpr NE new_price or itab_vbeln is initial.
Delete from zprice.
ZPRICE-VBELN = VBAP-VBELN (Contract #)
ZPRICE-POSNR = VBAP-POSNR (Item #)
ZPRICE-WAERK = VBAP-WAERK (Document Currency)
ZPRICE-NETPR = VBAP-NETPR (Net Price)
ZPRICE-MEINS = VBAP-MEINS (Item base unite of measure)
ZPRICE-DATAB = Tomorrows Date (do not how to cal
ZPRICE-ERDAT = sy-datum
endif.
Commit work.
3) seletc knumh datab from konh where kvewe = 'A' and kappl = 'V' and konh erdat = sy-datum and konh < todays's date (valid from date is in past) unable to understand