Posted: Tue Sep 18, 2007 10:38 am Post subject: FAQ
SD document flow
SD: the flow of SD will be Inquiry, Quotation, Sales Order, Delivery, Goods Issue, Billing.
Inquiry and quotation are presales documents. The sales order will confirm the delivery date and what are all the goods required and how much quantity they required. After that what happens is there are two processing activities. One is shipping department and another is procure department. The shipping department will see the time sufficient for shipping and loading. The procure department will see the stock levels and advises for inadequate stock. For that purchase requisitions are sent to the inventory or purchasing department. It will go to the MM module. The picking involves taking the goods from the storage location and shifted to the shipping area. Here the batch numbers and serial numbers, valuation types and quantities of the material are noted. The packing is a part of delivery and shipment. Select the items and loading deliver to the customers. Then you can create billing documents with respect to sales order, delivery, external transactions.
It is basically an entire sales cycle.
A customer orders some items from your company by creating a sales order (Tcodes: VA01, VA02, VA03, Tables:VBAK, VBAP etc).
Your company decides to deliver the items ordered by the customer. This is recorded by creating an outbound delivery document (TCodes:VL01N, VL02N, VL03N, Tables: LIKP, LIPS etc).
Once the items are available for sending to the customer, you post goods issue which reduces your inventory and puts the delivery in transit. This will create a material document. You will post goods issue using VL02N but the material document created will be stored in tables MKPF, MSEG.
You will then create shipment document to actually ship the items.(Tcodes: VT01N, VT02N, VT03N, Tables: VTTK, VTTP etc).
You finally create a sales billing document. (TCodes: VF01, VF02, VF03, Tables: VBRK, VBRP etc). This will have a corresponding accounting document created that will be in BKPF, BSEG tables.
When customer pays to your invoice, it will directly hit your AR account in FI.
You will have to remember that these are not a required sequence. Some times, you may configure your system to create a SD invoice as soon as you create a sales order or you may not create a shipping document at all. This is where your functional consultant will come into picture to study your order-to-cash process and design/configure the system to do so.
Sales Order Creation : VA01,VA02,VA03
Tables : VBAK,VBAP,VBEP,VBUK,VBUP
SMOD
SDVFX001 User exit: строка заголовка при переносе в учет и отчетность
SDVFX002 User exit: строка дебитора при переносе в учет и отчетность
SDVFX008 Программа пользователя: обработка структур переноса SD-FI
Important Tables for SAP SD Sales and Distribution:
Table Description
Customers KNA1 General Data
KNB1 Customer Master – Co. Code Data (payment method, reconciliation acct)
KNB4 Customer Payment History
KNB5 Customer Master – Dunning info
KNBK Customer Master Bank Data
KNKA Customer Master Credit Mgmt.
KNKK Customer Master Credit Control Area Data (credit limits)
KNVV Sales Area Data (terms, order probability)
KNVI Customer Master Tax Indicator
KNVP Partner Function key
KNVD Output type
KNVS Customer Master Ship Data
KLPA Customer/Vendor Link
Sales Documents VBAKUK VBAK + VBUK
VBUK Header Status and Administrative Data
VBAK Sales Document - Header Data
VBKD Sales Document - Business Data
VBUP Item Status
VBAP Sales Document - Item Data
VBPA Partners
VBFA Document Flow
VBEP Sales Document Schedule Line
VBBE Sales Requirements: Individual Records
SD Delivery DocumeLIPS Delivery Document item data, includes referencing PO
LIKP Delivery Document Header data
SD Shipping Unit VEKP Shipping Unit Item (Content)
VEPO Shipping Unit Header
SD Function modules RV_ORDER_FLOW_INFORMATION - Reads sales document flow of sales document after delivery and billing
Don't forget also check direct reference documents for the both starting document # and preceding/following document types that you are searching for (For example, if you search delivery for the given SO, check also LIPS-VGBEL and LIPS-VGPOS, if it's possible with regard to performance).
Code:
report zworkflw line-size 255.
*---- Selection Screen -------------------------------------------------
parameters: vbeln like vbuk-vbeln memory id aun obligatory,
posnr like vbap-posnr memory id pid.
*---- Variables --------------------------------------------------------
data: w_comwa like vbco6,
it_doc like vbfa occurs 0 with header line,
it_txt like dd07v occurs 0 with header line,
begin of it_type occurs 0,
vbtyp like vbuk-vbtyp,
text like dd07v-ddtext,
end of it_type.
*-----------------------------------------------------------------------
start-of-selection.
w_comwa-mandt = sy-mandt.
w_comwa-vbeln = vbeln.
w_comwa-posnr = posnr.
call function 'RV_ORDER_FLOW_INFORMATION'
exporting
comwa = w_comwa
tables
vbfa_tab = it_doc
exceptions
no_vbfa = 1
no_vbuk_found = 2
others = 3.
case sy-subrc.
when 1. write: / 'No VBFA found.'.
when 2. write: / 'No VBUK found. Check selection criteria...'.
when 3. write: / 'Unknown Error!'.
when 0. perform write_docs.
endcase.
*-----------------------------------------------------------------------
form write_docs.
call function 'GET_DOMAIN_VALUES'
exporting
domname = 'VBTYP'
tables
values_tab = it_txt
exceptions
no_values_found = 1
others = 2.
case sy-subrc.
when 1. write: / 'Warning: No texts found for Sales Docs types!'.
when 2. write: / 'Warning: Cannot retrieve SD types descriptions!'.
when 0. perform sort_texts.
endcase.
write: / 'Order Flow Information:'.
loop at it_doc.
write: / it_doc-stufe,
it_doc-vbelv,
it_doc-posnv.
perform write_type using it_doc-vbtyp_v.
write: it_doc-vbeln,
it_doc-posnn.
perform write_type using it_doc-vbtyp_n.
write: it_doc-matnr,
it_doc-rfmng unit it_doc-meins,
it_doc-meins.
endloop.
endform.
*-----------------------------------------------------------------------
form sort_texts.
loop at it_txt.
it_type-vbtyp = it_txt-domvalue_l.
it_type-text = it_txt-ddtext.
append it_type.
clear it_type.
endloop.
sort it_type.
endform.
*-----------------------------------------------------------------------
form write_type using value(p_vbtyp) like vbuk-vbtyp.
data w_txt(30) type c.
read table it_type with key vbtyp = p_vbtyp binary search.
case sy-subrc.
when 0. w_txt = it_type-text.
when others. w_txt = '?'.
endcase.
write w_txt intensified off.
endform.
*-----------------------------------------------------------------------
SD_SALES_DOCUMENT_READ - Reads sales document header and business data: tables VBAK, VBKD and VBPA (Sold-to (AG), Payer (RG) and Ship-to (WE) parties)
SD_DOCUMENT_PARTNER_READ - partner information including address. Calls SD_PARTNER_READ
SD_DETERMINE_CONTRACT_TYPE - Determines, if document is service contract or quantity contract
In: at least VBAK-VBELN
Exceptions: NO CONTRACT | SERVICE_CONTRACT | QUANTITY_CONTRACT
SD_SALES_DOCUMENT_COPY - copy Sales Doc into new one with the required Sales Doc Type (VBAK-AUART) for further creating. ExampleO - create subsequent document
SD_SALES_DOCUMENT_SAVE - create Sales Doc from the copied document
Code:
REPORT Z_SAVE_SD.
data: w_auart like vbak-auart, "current SalesDoc type
w_auara like tvak-auara, "Subsequent SalesDoc type
w_vbak like vbak.
parameter p_vbeln like vbak-vbeln.
at selection-screen on p_vbeln.
SELECT SINGLE auart FROM vbak into w_auart
WHERE vbeln = p_vbeln.
if sy-subrc <> 0.
message e398(00) with 'Sales Doc' p_vbeln 'not found'.
endif.
start-of-selection.
SELECT SINGLE auara FROM tvak into w_auara
WHERE auart = w_auart.
if sy-subrc <> 0 or w_auara is initial.
message e398(00) with 'Subsequent type not defined for' w_auart.
else.
* 1. copy
CALL FUNCTION 'SD_SALES_DOCUMENT_COPY'
EXPORTING
i_auarn = w_auara
i_vbeln = p_vbeln.
* 2. paste
CALL FUNCTION 'SD_SALES_DOCUMENT_SAVE'
IMPORTING
evbak = w_vbak.
* 3. commit
COMMIT WORK.
* 4. report
write: / 'Sales Doc', w_vbak-vbeln, 'created.'.
endif.
SD_SALES_DOCUMENT_ENQUEUE - to dequeue use DEQUEUE_EVVBAKE
SD_PARTNER_READ - all the partners information and addresses
RV_DELIVERY_PRINT_VIEW - Data provision for delivery note printing
SD_PACKING_PRINT_VIEW
SD_DELIVERY_VIEW - Data collection for printing
called from RV_DELIVERY_PRINT_VIEW, SD_PACKING_PRINT_VIEW
RV_BILLING_PRINT_VIEW - Data Provision for Billing Document Print
RV_PRICE_PRINT_HEAD - To be used in print program to get pricing data on header [and item] level.
Input: structures KOMK (fields mandt,kalsm,waerk,knumv,vbtyp to be taken from VBDKR, kappl='V').
[and KOMP (field kposn to be taken from VBDPR, field mglme (quantity) can be changed to calculate price accordingly].
Output: pricing data in tables TKOMV [and TKOMVD].
BAPI_OUTB_DELIVERY_CONFIRM_DEC - BAPI for Outbound Delivery Verification from a Decentralized System
You can use this method to report back outbound deliveries from a WM system to an enterprise resource planning (ERP) system.
Code:
ARAMETERS: p_vbeln TYPE likp-vbeln.
DATA: header LIKE bapiobdlvhdrcon,
header_control LIKE bapiobdlvhdrctrlcon,
i_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: LIN LIKE SY-TABIX.
DATA: HLP_VBELN LIKE LTAK-VBELN.
DATA: IVERKO LIKE VERKO OCCURS 10 WITH HEADER LINE.
DATA: IVBKOK LIKE VBKOK.
*......check if sth. needs to be done at all..............
CHECK SY-TCODE = CON_LM45.
CLEAR: IVERKO, HLP_VBELN.
REFRESH: IVERKO.
DESCRIBE TABLE TO_HEADER_TABLE LINES LIN.
CHECK LIN <> 0.
LOOP AT TO_HEADER_TABLE.
MOVE: TO_HEADER_TABLE-VBELN TO IVBKOK-VBELN_VL.
MOVE: TO_HEADER_TABLE-VBELN TO HLP_VBELN.
ENDLOOP.
*......prepare ivekp tables .............................
MOVE: SAV_VHILM TO IVERKO-VHILM,
SAV_CLENUM TO IVERKO-EXIDV,
'01' TO IVERKO-OBJECT,
HLP_VBELN TO IVERKO-OBJKEY.
APPEND IVERKO.
IF SY-SUBRC = 99.
* Shipm. or deliv. is locked, status of shipping unit &1 was not chang
MESSAGE_NUMBER = '270'.
PERFORM ERROR_MESSAGE.
LEAVE TO TRANSACTION SY-TCODE.
ENDIF.
ENDFORM. " UPDATE_VEKP
BAPI_OUTB_DELIVERY_CHANGE - BAPI for Change to Outbound Delivery
FORM xkomdlgn_fill USING p_open_qty LIKE ekpo-menge
p_eindt LIKE eket-eindt
p_licha LIKE eket-licha
p_charg LIKE eket-charg
p_uzeit LIKE eket-uzeit.
STATICS: h_grkor LIKE lips-grkor,
h_bsmng LIKE ekpo-menge.
CLEAR t_xkomdlgn.
CHECK t_ekpo-uptyp NE '5' " Lot
AND t_ekpo-uptyp NE '6' " Display
AND t_ekpo-uptyp NE '7' " VK-Set
AND t_ekpo-uptyp NE 'H'. " GT-Stuckliste
IF t_ekpo-uebpo IS INITIAL AND t_ekpo-upvor CA '1I'.
CHECK 1 = 2.
ENDIF.
IF NOT ekko-lifnr IS INITIAL.
CALL FUNCTION 'VENDOR_MASTER_DATA_SELECT_12'
EXPORTING
pi_lifnr = ekko-lifnr
pi_ekorg = ekko-ekorg
IMPORTING
pe_lfm1 = lfm1
EXCEPTIONS
no_entry_found = 1
OTHERS = 2.
SELECT * FROM t163g WHERE bstae EQ t_ekpo-bstae
AND ebtyp EQ gf_ebtyp.
EXIT.
ENDSELECT.
IF sy-subrc = 0.
prufen, ob lieferavis we-zuordnung hat (vorauss. fur we uber vl32)
und wepos prufen
if t163g-wezuo eq space or t_ekpo-wepos eq space.
t_xkomdlgn-nowab = 'X'.
ELSE.
CLEAR t_xkomdlgn-nowab.
ENDIF.
ENDIF.
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.