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

FAQ



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



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Tue Sep 18, 2007 10:38 am    Post subject: FAQ Reply with quote

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

Delivery : two types
1. Outbound delivery - VL01n,VL02n
2. Inbound delivery - VL31n,VL32n
Tables : LIKP,LIPS

Transfer order : LT01,LT02,LT03
Tables : LTAK,LTAP

Post Goods issue : VL01n,VL02N

if you want to reverse good issue : VL09

Creation Billing : VF01,VF02,VF03
Tables : VBRK,VBRP

Cancel Billing : VF11

Once you done billing and it creates Account document number

Function Modules

SD_DOCUMENT_FLOW_GET

Code:
    CALL FUNCTION 'SD_DOCUMENT_FLOW_GET'
      EXPORTING
        IV_DOCNUM              = lt_docs-vbeln
      IMPORTING
        ET_DOCFLOW             = lt_docflow.
    READ TABLE lt_docflow INTO ls_docflow WITH KEY vbtyp = 'M'.


User-exits

RV60AFZZ - Pricing
USEREXIT_FILL_VBRK_VBRP in include RV60AFZC

VOFM - Configuration for Requirements and Formulas

VOFM ROUTINES IN SALES & DISTRIBUTION - FORMULAS

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

Billing Document VBRK Billing Document Header
VBRP Billing Document Item

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_SALES_DOCUMENT_READ_POS - Reads sales document header and item material: tables VBAK, VBAP-MATNR

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.

header-deliv_numb = p_vbeln.
header_control-deliv_numb = p_vbeln.
header_control-post_gi_flg = 'X'.

CALL FUNCTION 'BAPI_OUTB_DELIVERY_CONFIRM_DEC'
  EXPORTING
    header_data                = header
    header_control             = header_control
    delivery                   = p_vbeln
  TABLES
    return                     = i_return.

COMMIT WORK.


SHP_BAPI_DELIVERY_CHANGE

WS_DELIVERY_UPDATE

Code:
FORM UPDATE_VEKP.


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.

*......update per delivery item...................................
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
VBKOK_WA = IVBKOK
COMMIT = 'X'
DELIVERY = HLP_VBELN
TABLES
VERKO_TAB = IVERKO
EXCEPTIONS
ERROR_MESSAGE = 99.


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

BAPI_INB_DELIVERY_SAVEREPLICA - Create Inbound Delivery

RV_DELIVERY_CREATE - Create Delivery

GN_DELIVERY_CREATE - Create an Outbound Delivery
Code:

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.

    t_xkomdlgn-vsbed = lfm1-vsbed.
  ELSE.
    CLEAR t_xkomdlgn-vsbed.
  ENDIF.
  t_xkomdlgn-adrnr_li = ekko-adrnr.
  t_xkomdlgn-lifnr = ekko-lifnr.
  t_xkomdlgn-inco1 = ekko-inco1.
  t_xkomdlgn-inco2 = ekko-inco2.
  t_xkomdlgn-exnum = ekko-exnum.
  t_xkomdlgn-bukrs_best = ekko-bukrs.
  t_xkomdlgn-matnr = t_ekpo-matnr.
  t_xkomdlgn-werks = t_ekpo-werks.
*IF STORAGE LOCATION IS MISSING APPEND
*FG01 As storage location
  IF t_ekpo-lgort IS INITIAL .
    t_xkomdlgn-lgort = 'FG01' .
  ELSE .
    t_xkomdlgn-lgort = t_ekpo-lgort.
  ENDIF.

  xkomdlgn-charg = ?
  T_XKOMDLGN-VRKME = T_EKPO-MEINS.
  t_xkomdlgn-meins = t_ekpo-lmein.
  t_xkomdlgn-umvkz = t_ekpo-umrez.
  t_xkomdlgn-umvkn = t_ekpo-umren.
  IF t_ekpo-matnr EQ space.
    t_xkomdlgn-meins = t_ekpo-meins.
    t_xkomdlgn-umvkz = 1.
    t_xkomdlgn-umvkn = 1.
  ENDIF.
  t_xkomdlgn-insmk = t_ekpo-insmk.
  t_xkomdlgn-kzfme = t_ekpo-kzfme.
  t_xkomdlgn-kzvbr = t_ekpo-kzvbr.
  t_xkomdlgn-lfimg = p_open_qty.
  t_xkomdlgn-lfdat = p_eindt.
  t_xkomdlgn-lfuhr = p_uzeit.
  xkomdlgn-vstel = ?
  XKOMDLGN-VKORG = ?
  xkomdlgn-vtweg = ?
  XKOMDLGN-SPART = ?

  t_xkomdlgn-traid = t_ekpo-traid."CARRIER CODE
  t_xkomdlgn-lifex = t_ekpo-lifex."External ID
  t_xkomdlgn-bolnr = t_ekpo-bolnr."Bill Of Lading
  t_xkomdlgn-xabln = t_ekpo-xabln."Goods Receipt/Issue Slip Number

  t_xkomdlgn-vgbel = t_ekpo-ebeln.
  t_xkomdlgn-vgpos = t_ekpo-ebelp.
  t_xkomdlgn-lfart = gf_dlv_type.
  t_xkomdlgn-vgtyp = 'V'.
  t_xkomdlgn-kzazu = 'X'.
  t_xkomdlgn-knttp = t_ekpo-knttp.
  t_xkomdlgn-sobkz = t_ekpo-sobkz.

  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.

IF t_ekpo-matnr IS INITIAL OR t_ekpo-pstyp = '6'.
  t_xkomdlgn-posar = 'B'.
ENDIF.
t_xkomdlgn-ematn = t_ekpo-ematn.
t_xkomdlgn-mfrnr = t_ekpo-mfrnr.
t_xkomdlgn-mfrpn = t_ekpo-mfrpn.
t_xkomdlgn-emnfr = t_ekpo-emnfr.
t_xkomdlgn-cuobj = t_ekpo-cuobj.
t_xkomdlgn-uebto = t_ekpo-uebto.
t_xkomdlgn-untto = t_ekpo-untto.
t_xkomdlgn-uebtk = t_ekpo-uebtk.
t_xkomdlgn-lichn = p_licha.
t_xkomdlgn-charg = p_charg.
t_xkomdlgn-bwtar = t_ekpo-bwtar.
t_xkomdlgn-kdmat = t_ekpo-idnlf.
t_xkomdlgn-arktx = t_ekpo-txz01.
t_xkomdlgn-mfrgr = t_ekpo-mfrgr.
t_xkomdlgn-gewei = t_ekpo-gewei.
t_xkomdlgn-voleh = t_ekpo-voleh.
t_xkomdlgn-ntgew = t_ekpo-ntgew * t_xkomdlgn-lfimg.
t_xkomdlgn-brgew = t_ekpo-brgew * t_xkomdlgn-lfimg.
t_xkomdlgn-volum = t_ekpo-volum * t_xkomdlgn-lfimg.
t_xkomdlgn-ean11 = t_ekpo-ean11.
t_xkomdlgn-podrel = t163l-podrel.
t_xkomdlgn-aktnr = t_ekpo-aktnr.
t_xkomdlgn-abeln = t_ekpo-abeln.
t_xkomdlgn-abelp = t_ekpo-abelp.
xkomdlgn-ltssf = only SORT criteria IN vl31n
T_XKOMDLGN-AUREL = T_EKPO-AUREL.
t_xkomdlgn-idnlf = t_ekpo-idnlf.
t_xkomdlgn-matkl = t_ekpo-matkl.

leergut-stuckliste ubernehmen
clear t_xkomdlgn-grkor.
CLEAR t_xkomdlgn-kmpmg.
CLEAR t_xkomdlgn-uepos.
CLEAR t_xkomdlgn-uepvw.                                     "549736
IF t_ekpo-upvor CA '3X'.
  h_grkor = h_grkor + 1.
  t_xkomdlgn-grkor = h_grkor.
  h_bsmng = t_ekpo-menge.
ENDIF.
IF NOT t_ekpo-uebpo IS INITIAL AND
t_ekpo-uptyp CA '3X'.
  t_xkomdlgn-uepvw = 'G'.                                   "549736
  t_xkomdlgn-uepos = t_ekpo-uebpo.
  t_xkomdlgn-grkor = h_grkor.
  IF h_bsmng NE 0.
    t_xkomdlgn-kmpmg = t_ekpo-menge / h_bsmng.
  ENDIF.
ENDIF.

IF t_ekpo-pstyp EQ '2'.
  t_xkomdlgn-sobkz = 'K'.
ENDIF.
kontierungsfelder
if t_ekpo-sobkz eq 'E' or t_ekpo-sobkz eq 'Q'.
CALL FUNCTION 'MMPUR_EKKN_READ_EBELN_EBELP'
  EXPORTING
    pi_ebeln             = t_ekpo-ebeln
    pi_ebelp             = t_ekpo-ebelp
    pi_bypassing_buffer  = pi_refresh_buffer
    =
  tables
    pto_ekkn_po          = xekkn
  EXCEPTIONS
    no_records_requested = 1
    OTHERS               = 2.

IF sy-subrc EQ 0.
  READ TABLE xekkn INDEX 1.
  t_xkomdlgn-ps_psp_pnr = xekkn-ps_psp_pnr.
  t_xkomdlgn-vbelv = xekkn-vbeln.
  t_xkomdlgn-posnv = xekkn-vbelp.
ENDIF.
ENDIF.

APPEND t_xkomdlgn.

ENDFORM. "xkomdlgn_fill

LOOP AT t_xkomdlgn.
* set default parameter
t_xkomdlgn-vgtyp = 'V'.
t_xkomdlgn-kzazu = 'X'.
IF t_xkomdlgn-lfart IS INITIAL.
t_xkomdlgn-lfart = 'EL'.
ENDIF.
MODIFY t_xkomdlgn.
ENDLOOP.

SELECT SINGLE * FROM tvsa WHERE smart = xvbsk-smart.
IF sy-subrc 0.
* Error Handling To be Done
* Meldung ins Protokoll
ENDIF.
l_nrnr = tvsa-numki.

CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = l_nrnr
object      = 'RV_SAMMG'
IMPORTING
number      = xvbsk-sammg
EXCEPTIONS
OTHERS      = 1.
IF sy-subrc 0.
error hadling tbd
meldung ins protokoll
endif.

CALL FUNCTION 'GN_DELIVERY_CREATE'
EXPORTING
* no_commit = 'X'
vbsk_i = xvbsk
* if_no_deque = 'X'
* IF_MASS_READ_MAT_SW = 'X'
*
* vbls_pos_rueck = 'X'
TABLES
xkomdlgn = t_xkomdlgn
xvbfs = xvbfs
xvbls = xvbls
xxlips = xlips.

* get informatioin from ekpo table and fill T_xkomdlgn


SHP_VL10_DELIVERY_CREATE - Create Outbound Delivery

Code:
LOOP AT ZDELIVERY.
CLEAR IT_KEY_TO_ENQUE.
IT_KEY_TO_ENQUE-PANUM = ZDELIVERY-PANUM.
IT_KEY_TO_ENQUE-VBOBJ = 'A'.
IT_KEY_TO_ENQUE-VBTYP = 'C'.
IT_KEY_TO_ENQUE-VBELN = ZDELIVERY-VGBEL.
IT_KEY_TO_ENQUE-POSNR = ZDELIVERY-VGPOS.
IT_KEY_TO_ENQUE-ID = ZDELIVERY-ID.
IT_KEY_TO_ENQUE-KZAZU = 'X'.
IT_KEY_TO_ENQUE-TABIX = ZDELIVERY-ID.
IT_KEY_TO_ENQUE-VSTEL = ZDELIVERY-VSTEL.
APPEND IT_KEY_TO_ENQUE TO IT_KEY_TO_ENQUE_T.

CLEAR CT_VORGABE_DATEN.
CT_VORGABE_DATEN-VGBEL = ZDELIVERY-VGBEL.
CT_VORGABE_DATEN-VGPOS = ZDELIVERY-VGPOS.
CT_VORGABE_DATEN-LFIMG = ZDELIVERY-LFIMG.
CT_VORGABE_DATEN-LGMNG = ZDELIVERY-LGMNG.
CT_VORGABE_DATEN-UMVKZ = ZDELIVERY-UMVKZ.
CT_VORGABE_DATEN-UMVKN = ZDELIVERY-UMVKN.
CT_VORGABE_DATEN-UMREV = ZDELIVERY-UMREV.
CT_VORGABE_DATEN-AKMNG = 'B'.
CT_VORGABE_DATEN-VRKME = ZDELIVERY-VRKME.
CT_VORGABE_DATEN-MEINS = ZDELIVERY-MEINS.
CT_VORGABE_DATEN-NORND_LP = 'X'.
CT_VORGABE_DATEN-POSTAB_TABIX = ZDELIVERY-ID.
CT_VORGABE_DATEN-PANUM = ZDELIVERY-PANUM.
CT_VORGABE_DATEN-ID = ZDELIVERY-ID.
CT_VORGABE_DATEN-CHARG = ZDELIVERY-CHARG.
CT_VORGABE_DATEN-COMB_CRIT = ZDELIVERY-ZZ_NSRT.
APPEND CT_VORGABE_DATEN TO CT_VORGABE_DATEN_T.

CLEAR CT_VORGABE_DATEN.
IT_KOMDLGN-RFBEL = ZDELIVERY-VGBEL.
IT_KOMDLGN-RFPOS = ZDELIVERY-VGPOS.
IT_KOMDLGN-MANDT = SY-MANDT.
IT_KOMDLGN-LFART = 'LF'.
IT_KOMDLGN-LFDAT = ZDELIVERY-LFDAT.
IT_KOMDLGN-WADAT = ZDELIVERY-WADAT.
IT_KOMDLGN-MATNR = ZDELIVERY-MATNR.
IT_KOMDLGN-WERKS = ZDELIVERY-ZZ_KDCX.
IT_KOMDLGN-LFIMG = ZDELIVERY-LFIMG.
IT_KOMDLGN-VRKME = ZDELIVERY-VRKME.
IT_KOMDLGN-LGMNG = ZDELIVERY-LGMNG.
IT_KOMDLGN-UMREV = ZDELIVERY-UMREV.
IT_KOMDLGN-VGBEL = ZDELIVERY-VGBEL.
IT_KOMDLGN-VGPOS = ZDELIVERY-VGPOS.
IT_KOMDLGN-CHARG = ZDELIVERY-CHARG.
IT_KOMDLGN-MEINS = ZDELIVERY-MEINS.
IT_KOMDLGN-UMVKZ = ZDELIVERY-UMVKZ.
IT_KOMDLGN-UMVKN = ZDELIVERY-UMVKN.
IT_KOMDLGN-NTGEW = ZDELIVERY-NTGEW.
IT_KOMDLGN-BRGEW = ZDELIVERY-BRGEW.
IT_KOMDLGN-GEWEI = ZDELIVERY-GEWEI.
* IT_KOMDLGN-VOLUM = ZDELIVERY-VOLUM.
* IT_KOMDLGN-VOLEH = ZDELIVERY-VOLEH.
IT_KOMDLGN-PANUM = ZDELIVERY-PANUM.
IT_KOMDLGN-ID = ZDELIVERY-ID.
IT_KOMDLGN-MBDAT = ZDELIVERY-MBDAT.
IT_KOMDLGN-LDDAT = ZDELIVERY-LDDAT.
IT_KOMDLGN-TDDAT = ZDELIVERY-TDDAT.
* IT_KOMDLGN- = ZDELIVERY-.
APPEND IT_KOMDLGN TO IT_KOMDLGN_T.

ENDLOOP.

CALL FUNCTION 'SHP_VL10_DELIVERY_CREATE'
  EXPORTING
    IF_LEDAT = IF_LEDAT
    IF_NUR_VORGABE_POS = IF_NUR_VORGABE_POS
    IT_KEY_TO_ENQUE = IT_KEY_TO_ENQUE_T
    IT_KOMDLGN = IT_KOMDLGN_T
  CHANGING
    CX_SD_ORDER = CX_SD_ORDER
    CT_VBSK_ALL = CT_VBSK_ALL_T
    CT_VBLS = CT_VBLS_T
    CT_KEY_LATE = CT_KEY_LATE
    CT_VORGABE_DATEN = CT_VORGABE_DATEN_T.


SD_COND_ACCESS - Select condition records
Code:

* Ermitteln Konditionsart
SELECT * FROM t685 WHERE kozgf = kozgf.
  EXIT.
ENDSELECT.

* Einlesen Zugriffsfolge
SELECT * FROM t682i INTO TABLE x682i WHERE kozgf = kozgf.
SORT x682i BY kolnr.

* Zugriffsfolge abarbeiten
LOOP AT x682i.
  IF x682i-kobed NE 0.
    bedingung_vorstep-nr = x682i-kobed.
    PERFORM (bedingung_vorstep) IN PROGRAM saplv61a USING tkomp.
    zzhier = tkomp-zzhier.
  ENDIF.
  IF sy-subrc EQ 0.
    CALL FUNCTION 'SD_COND_ACCESS'
    EXPORTING
    application = 'V'
    condition_type = t685-kschl
    date = sy-datlo
    header_comm_area = tkomk
    position_comm_area = tkomp
* PRESTEP = ' '
* PROTOCOL_DATE = ' '
* PROTOCOL_ACCESS = ' '
    read_only_one_record = 'X'
    t682i_i = x682i
    koprt_i = koprt
* SDPROTHEAD_I =
    IMPORTING
    condition_is_purely_header = mark_header
    TABLES
    condition_records = kond_tab
    EXCEPTIONS
    field_is_initial = 1
    not_read_unqualified = 2
    read_but_not_found = 3
    OTHERS = 4.
    IF sy-subrc EQ 0.
      LOOP AT kond_tab.
        xknumh = kond_tab-knumh.
* Zugriff auf Konditionstabellen ausfьhren
        SELECT SINGLE * FROM konp WHERE knumh EQ xknumh
        AND kopos EQ '01'.
        IF sy-subrc EQ 0.
          MOVE konp-kbetr TO yypst.
* ...
        ENDIF.
      ENDLOOP.
      EXIT.
    ELSE.
      CLEAR sy-subrc.
    ENDIF.
  ENDIF.
ENDLOOP.
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 -> SD 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.