CSDN博客

img leemincn

SD模块重要的函数以及调用方法

发表于2008/9/29 11:07:00  2833人阅读

分类: ABAP Tips

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).
Код:

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
Код:

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.

Код:
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

Код:
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
Код:

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

Код:
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
Код:

* 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.
0 0

相关博文

我的热门文章

img
取 消
img