网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

SAPSD实际应用的方法有哪些

本篇内容介绍了“SAP SD实际应用的方法有哪些”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

高台网站制作公司哪家好,找创新互联公司!从网页设计、网站建设、微信开发、APP开发、响应式网站设计等网站项目制作,到程序开发,运营维护。创新互联公司公司2013年成立到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联公司

1.SD-如何读取文本订单的抬头文本

在最近一次修改订单跟踪表,用户提出需要读取抬头文本。由于用户输入文本时存在多种语言,如果根据用户的语言或者在条件界面设置语言条件来提取文本,发现都会漏取文本。后来经过思索,用先从STXH表中获取抬头文本的语言,再使用该语言传入read_text函数读取文本,这样就确保文本读取,不会出现遗漏。代码摘抄如下:

CLEAR lV_text.

select single TDSPRAS into (w_LANG ) from STXH

where TDOBJECT = 'VBBK' and TDNAME = CS_TAB-vbeln and TDID = 'YOD1'.

if sy-subrc = 0.

w_tdid = 'YOD1'.

w_tdspras = w_LANG .

w_tdname = CS_TAB-vbeln.

w_tdobject = 'VBBK'.

REFRESH w_lines.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = w_tdid

LANGUAGE = w_tdspras

NAME = w_tdname

OBJECT = w_tdobject

TABLES

LINES = w_lines

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

2.SD-如何增强VF04显示交货单相关的发票金额

sap给我们留好了增强的出口:EXIT_SAPLV60P_008,我们可以修改 ZXV6PU08,来显示出库相关的Billing的金额。

方法如下:

1、在VKDFIF中添加字段YYNETWR,用于显示价格。

2、修改 ZXV6PU08,填写YYNETWR字段。

代码照抄如下:

PERFORM y0000sd_0000_fill_vkdfif

TABLES

lt_vkdfif[]

USING lt_vkdfif-vkorg.

* we store the final result

c_vkdfif[] = lt_vkdfif[].

FORM y0000sd_0000_fill_vkdfif

TABLES tt_vkdfif STRUCTURE vkdfif

USING uv_vkorg TYPE vkorg.

DATA ls_vkdfif TYPE vkdfif.

DATA lv_tabix LIKE sy-tabix.

DATA: BEGIN OF t_vbap OCCURS 0,

vbeln TYPE vbeln,

kbmeng TYPE kbmeng,

netwr TYPE netwr,

waerk TYPE waerk,

lfimg TYPE lfimg,

END OF t_vbap.

***********************************

LOOP AT tt_vkdfif INTO ls_vkdfif WHERE vkorg = uv_vkorg.

lv_tabix = sy-tabix.

SELECT SINGLE vbfa~vbelv

vbfa~waers

FROM vbfa AS vbfa

JOIN lips AS lips

ON lips~vbeln = vbfa~vbeln AND

lips~posnr = vbfa~posnn

INTO ( ls_vkdfif-yyvbeln_order,

ls_vkdfif-yywaers )

WHERE vbfa~vbeln = ls_vkdfif-vbeln

AND vbfa~vbtyp_n = 'J' "delivery

AND vbfa~vbtyp_v <> 'B'. "quotation

CHECK sy-subrc = 0.

** Confirmed qty value - CT115262 *************

if ls_vkdfif-fkart = 'F2'.

clear ls_vkdfif-yynetwr .

SELECT vp~vbeln vp~kbmeng vp~netwr vp~waerk lp~lfimg

INTO CORRESPONDING FIELDS OF TABLE t_vbap

FROM vbap as vp

INNER JOIN lips AS lp ON lp~vgbel = vp~vbeln AND

lp~vgpos = vp~posnr

WHERE vp~vbeln = LS_VKDFIF-YYVBELN_ORDER.

LOOP AT t_vbap.

if t_vbap-kbmeng <> 0.

ls_vkdfif-yynetwr = ls_vkdfif-yynetwr +

t_vbap-netwr * t_vbap-lfimg / t_vbap-kbmeng .

ls_vkdfif-waerk = t_vbap-waerk.

endif.

ENDLOOP.

endif.

*************************************************

SELECT SINGLE vdatu

FROM vbak

INTO ls_vkdfif-yyvdatu

WHERE vbeln = ls_vkdfif-yyvbeln_order.

MODIFY tt_vkdfif INDEX lv_tabix FROM ls_vkdfif.

ENDLOOP.

ENDFORM.

3.SD--如何增强是同一类出库单使用不同号码段

在现实的业务中,一个公司有多个销售组织,它们使用同一个出库类型,业务往往希望它们创建的出库单的号码采用不同号码范围。但在sap里出库单号码范围是在出库单类型里设置,也就是使用相同的出库单类型,也就使用相同的号码范围。如果要达到上需业务需求,我们可以使用增强实现。具体实现参见下面的步骤:

步骤1:创建多个号码段:

path: Spro->Sales and Distribution->Sales->Sales Documents->Sales Document Header->Define Number Ranges For Sales Documents

or

path: Spro->Logistics Execution->Shipping->Deliveries->Define Number Ranges for Deliveries

TCODE: VN01

步骤二:设置出库单类型的号码范围

path: Spro->Logistics Execution->Shipping->Deliveries->Define Delivery Types

TCODE: 0VLK

步骤三:修改SAP增强代码

modify the source code to control use different number range for different sale organiztion

3.1 you can use se38 to open source code MV50AFZ1 and find the form userexit_number_range.

*---------------------------------------------------------------------*

* FORM USEREXIT_NUMBER_RANGE *

*---------------------------------------------------------------------*

* This userexit can be used to determine the numberranges for *

* the internal document number. *

* *

* US_RANGE_INTERN - internal number range *

* *

* This form is called from form BELEG_SICHERN *

* *

*---------------------------------------------------------------------*

FORM USEREXIT_NUMBER_RANGE USING US_RANGE_INTERN.

* Example: Numer range from TVLK like in standard

* US_RANGE_INTERN = TVLK-NUMKI.

*{ INSERT DEVK943692 1

DATA: z_werks TYPE lips-werks,

z_vkorg TYPE likp-vkorg,

z_nrnr TYPE nrnr,

z_vbtyp TYPE likp-vbtyp.

DATA: wa_xlikp LIKE likpvb,

wa_xlips LIKE lipsvb.

US_RANGE_INTERN = TVLK-NUMKI.

data t(1).

t = TVLK-LFART(1).

if t = 'Z'.

LOOP AT xlikp INTO wa_xlikp.

LOOP AT xlips INTO wa_xlips.

CASE wa_xlikp-vbtyp.

WHEN OTHERS.

MOVE: wa_xlikp-vbtyp TO z_vbtyp.

ENDCASE.

IF z_vbtyp EQ 'J' or "outbound del.

z_vbtyp eq 'T'. "return del. "V003

MOVE: wa_xlips-werks TO z_werks, "V002 "SBr16072007

wa_xlikp-vkorg TO z_vkorg.

ELSEIF z_vbtyp EQ '7'. "shipp.notification

MOVE: space TO z_vkorg,

wa_xlips-werks TO z_werks.

ENDIF.

if z_vkorg = '6001'.

if z_vbtyp eq 'J'.

Case z_werks.

WHEN '6255'.

US_RANGE_INTERN = 'D1'.

WHEN '6245'.

US_RANGE_INTERN = 'D2'.

WHEN '6254'.

US_RANGE_INTERN = 'D3'.

WHEN '6234'.

US_RANGE_INTERN = 'D4'.

WHEN '6101'.

US_RANGE_INTERN = 'D5'.

endcase.

elseif z_vbtyp EQ 'T' .

Case z_werks.

WHEN '6255'.

US_RANGE_INTERN = 'R1'.

WHEN '6245'.

US_RANGE_INTERN = 'R2'.

WHEN '6254'.

US_RANGE_INTERN = 'R3'.

WHEN '6234'.

US_RANGE_INTERN = 'R4'.

WHEN '6101'.

US_RANGE_INTERN = 'R5'.

endcase.

endif.

endif.

EXIT.

ENDLOOP.

EXIT.

ENDLOOP.

endif.

*} INSERT

ENDFORM.

4.SD--如何在输出控制中增加自定义字段

在sap的输出控制中,我们有时需要增加系统未定义的字段作为条件表的字段,为了实现该需求我们就需要修改增强。

输出控制用到的通讯结构

KOMKBK1 (Output Determination Communication Area CAS Appl. K1)

KOMKBV1 (Output Determination Communication Area Header Appl. V1)

KOMKBV2 (Output Determination Communication Area Header Appl. V2)

KOMKBV3 (Output Determination Communication Area Header Appl. V3)

KOMKBV5 (Communication Structure for Output Control Groups Appl. V5)

KOMPBV1 (Output Determination Communication Area Item Appl. V1)

KOMPBV2 (Output Determination Communication Area Item Appl. V2)

KOMPBV3 (Output Determination Communication Area Item Appl. V3)

SAP在这些结构中预留了INCLUDEs,用户可以向这些结构添加新的字段

Sales activities: KOMKBZ1 (in KOMKBK1)

Sales document header: KOMKBZ3 (in KOMKBV1)

Delivery header: KOMKBZ4 (in KOMKBV2)

Groups header: KOMKBZF (in KOMKBV5)

Billing document header: KOMKBZ5 (in KOMKBV3)

Sales document item: KOMPBZ1 (in KOMPBV1)

Delivery item: KOMPBZ3 (in KOMPBV2)

Billing document item: KOMKBZ5 (in KOMPBV3)

如果需要用新增字段创建条件表,我们就需要同时向KOMBZ结构添加该字段 (KOMBZ包含在通讯结构KOMB中).

完成以上两部后,我们还需要增强sap的代码,对通讯结构的字段进行赋值。sap在RVCOMFZZ, RVCOMFZ1 和RVCOMFZ4单元预留了很多的出口。

RVCOMFZ1中的出口如下:

USEREXIT_KOMPBV2_FILL (item fields in delivery)

USEREXIT_KOMPBV2_PARTNER (item fields for partners in delivery)

USEREXIT_KOMPBV3_FILL (item fields in billing document)

USEREXIT_KOMPBV3_PARTNER (item fields for partners in billing document)

RVCOMFZZ中的出口如下:

USEREXIT_KOMKBK1_FILL (header fields in sales activities)

USEREXIT_KOMKBK1_PARTNER (header fields for partners in sales activ.)

USEREXIT_KOMKBV1_FILL (header fields for sales documents)

USEREXIT_KOMKBV1_PARTNER (header fields for partners in sales documents)

USEREXIT_KOMKBV2_FILL (header fields in delivery)

USEREXIT_KOMKBV2_PARTNER (header fields for partners in delivery)

USEREXIT_KOMKBV3_FILL (header fields in billing document)

USEREXIT_KOMKBV3_PARTNER (header fields for partners in billing doc.)

RVCOMFZ4中的出口如下:

USEREXIT_KOMKBV5_FILL (header field for groups)

In output determination, communication table KOMB contains all key fields that can be used for conditions for output determination.

When you create new fields for output determination, you can distinguish between two types of fields:

Fields that are used in condition tables

Fields which are only used to query conditions.

Both types of field have to be included in KOMKBV1. Fields which are only used to query conditions do not have to be included in KOMB and T681F or in the field catalog.

对订单输出控制增加自定义字段的详细步骤如下;

1、用SE11向KOMKBV1中的KOMKBZ3增加自定义字段;

2、用SE11向KOMB中的KOMBZ增加自定义字段;

3、用V/86将自定义字段添加到允许字段中(字段必须来自KOMB,否则在建表时不可见);

4、用V/57定义条件表;

5、定义条件存储顺序;

6、将条件存储顺序赋值给条件类型;

7、修改代码RVCOMFZZ中的子过程USEREXIT_KOMKBV1_FILL

5.SD--批量删除订单

在sap应用中常常会需要批量删除一些错误录入的单据,为此开发了一个小程序。该程序为了安全,程序做了一下控制

1、限制用户只能删除自己的订单,不能删除别人输入的订单,如果需要修改一下查询条件;

2、系统默认为"测试运行",方便用户在删除订单前要核实一下订单,确认不要误操作;

程序代码如下,供大家参考!

REPORT zsde0099.

TYPE-POOLS: slis.

*----------------------------------------------------------------------*

* data Declarations

*----------------------------------------------------------------------*

TABLES: vbak. " Sales Document: Header Data

*----------------------------------------------------------------------*

* table control Output Declarations

*----------------------------------------------------------------------*

TYPES: BEGIN OF tc_0100,

sel(1), " Check box

vbeln LIKE vbak-vbeln, " Sales Order Number

erdat LIKE vbak-erdat, " Sales order creation date

ernam LIKE vbak-ernam,

kunnr LIKE likp-kunag, " Sold-to Party

name1 LIKE kna1-name1, " Sold-to Company Name

text(200),

END OF tc_0100.

DATA: wa_tc_0100 TYPE tc_0100,

it_tc_0100 TYPE tc_0100 OCCURS 0 WITH HEADER LINE.

DATA g_fieldcat TYPE slis_t_fieldcat_alv.

*----------------------------------------------------------------------*

* Selection Screen

*----------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK params1 WITH FRAME TITLE text-001.

PARAMETER: s_vkorg LIKE vbak-vkorg DEFAULT '6001' OBLIGATORY MODIF ID s1. " " Sales Org.

SELECT-OPTIONS:

s_vtweg FOR vbak-vtweg OBLIGATORY, " Distribution Channel

s_spart FOR vbak-spart OBLIGATORY DEFAULT '10', " Division

s_auart FOR vbak-auart OBLIGATORY, " Order type

s_erdat FOR vbak-erdat OBLIGATORY, " Sales order creation date

* s_ERNAM FOR vbak-ERNAM OBLIGATORY , " Sales order creation date

s_kunnr FOR vbak-kunnr , " Sold-to party

s_vbeln FOR vbak-vbeln . " Sales Order

PARAMETER p_test AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN END OF BLOCK params1.

***********************************************************************

*INITIALIZATION.

***********************************************************************

INITIALIZATION.

s_auart-sign = 'I'.

s_auart-option = 'EQ'.

s_auart-low = 'ZC01'.

APPEND s_auart.

s_auart-low = 'ZC03'.

APPEND s_auart.

s_auart-low = 'ZC06'.

APPEND s_auart.

s_auart-low = 'ZC20'.

APPEND s_auart.

s_vtweg-sign = 'I'.

s_vtweg-option = 'EQ'.

s_vtweg-low = '10'.

APPEND s_vtweg.

s_vtweg-low = '20'.

APPEND s_vtweg.

s_vtweg-low = '30'.

APPEND s_vtweg.

s_vtweg-low = '40'.

APPEND s_vtweg.

*----------------------------------------------------------------------*

* Selection Events Processing

*----------------------------------------------------------------------*

AT SELECTION-SCREEN OUTPUT.

PERFORM screen_check.

AT SELECTION-SCREEN.

CLEAR: it_tc_0100, wa_tc_0100.

REFRESH: it_tc_0100.

START-OF-SELECTION.

PERFORM extract_data.

END-OF-SELECTION.

PERFORM change_sales_orders.

PERFORM display_mes.

*&---------------------------------------------------------------------*

*& Form SCREEN_CHECK

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

FORM screen_check.

DATA: l_line TYPE i .

DESCRIBE TABLE s_erdat LINES l_line.

IF l_line EQ 0.

s_erdat-sign = 'I'.

s_erdat-option = 'BT'.

s_erdat-high = sy-datum.

s_erdat-low = sy-datum.

APPEND s_erdat.

ENDIF.

DESCRIBE TABLE s_vtweg LINES l_line.

IF l_line EQ 0.

ENDIF.

ENDFORM. "SCREEN_CHECK

*&---------------------------------------------------------------------*

*& Form extract_data

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

FORM extract_data.

DATA: lt_it1 LIKE it_tc_0100 OCCURS 0 WITH HEADER LINE,

l_chk(1). " for exclude incomplete SO

SELECT a~vbeln a~erdat a~ernam a~kunnr INTO CORRESPONDING FIELDS OF TABLE lt_it1

FROM vbak AS a

WHERE a~vbeln IN s_vbeln

AND a~auart IN s_auart

AND a~vkorg EQ s_vkorg

AND a~vtweg IN s_vtweg

AND a~spart IN s_spart

AND a~erdat IN s_erdat

AND a~ernam = sy-uname

AND a~kunnr IN s_kunnr.

LOOP AT lt_it1.

* get sold-to party company name

PERFORM get_customer_company_name USING lt_it1-kunnr CHANGING lt_it1-name1.

MODIFY lt_it1.

ENDLOOP.

it_tc_0100[] = lt_it1[].

ENDFORM. "extract_data

*&---------------------------------------------------------------------*

*& Form GET_CUSTOMER_COMPANY_NAME

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* -->F_KUNNR text

* -->F_NAME text

*----------------------------------------------------------------------*

FORM get_customer_company_name USING f_kunnr CHANGING f_name.

CLEAR f_name.

SELECT SINGLE name1 INTO f_name

FROM kna1

WHERE kunnr = f_kunnr.

ENDFORM. "GET_CUSTOMER_COMPANY_NAME

*&---------------------------------------------------------------------*

*& Form change_sales_orders

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

FORM change_sales_orders.

DATA: lt_order_header_in LIKE bapisdh2,

lt_order_header_inx LIKE bapisdh2x,

lt_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,

lt_order_item_in LIKE bapisditm OCCURS 0 WITH HEADER LINE,

lt_order_item_inx LIKE bapisditmx OCCURS 0 WITH HEADER LINE,

cp_eind(1).

SORT it_tc_0100 BY vbeln.

DELETE ADJACENT DUPLICATES FROM it_tc_0100.

LOOP AT it_tc_0100.

CLEAR: lt_order_header_inx,lt_order_item_in, lt_order_item_inx, lt_return,cp_eind.

REFRESH: lt_order_item_in, lt_order_item_inx, lt_return.

lt_order_header_inx-updateflag = 'D'.

IF p_test NE 'X'.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = it_tc_0100-vbeln

* ORDER_HEADER_IN = LT_ORDER_HEADER_IN

order_header_inx = lt_order_header_inx

TABLES

return = lt_return.

* 处理错误消息:通过判断消息的类型,来判断BAPI是否成功

LOOP AT lt_return .

IF lt_return-type EQ 'E' OR

lt_return-type = 'A' OR

lt_return = 'X'.

cp_eind = 'X'. "失败

it_tc_0100-text = lt_return-message.

ENDIF.

ENDLOOP.

IF cp_eind NE 'X'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

ENDIF.

ENDIF.

IF cp_eind NE 'X' AND sy-subrc = 0.

IF p_test = 'X'.

it_tc_0100-text = 'Test successfully.'.

ELSE.

it_tc_0100-text = 'Delete successfully.'.

ENDIF.

ELSE.

CONCATENATE it_tc_0100-text '---' 'Delete error.' into it_tc_0100-text.

ENDIF.

MODIFY it_tc_0100.

ENDLOOP.

ENDFORM. "change_sales_orders

*&---------------------------------------------------------------------*

*& Form init_fieldedi

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* -->P_P_FIELDTAB text

*----------------------------------------------------------------------*

FORM init_fieldedi USING p_p_fieldtab TYPE slis_t_fieldcat_alv.

DATA: l_fieldcat TYPE slis_fieldcat_alv.

REFRESH p_p_fieldtab.

CLEAR l_fieldcat.

l_fieldcat-fieldname = 'VBELN'.

l_fieldcat-seltext_m = 'ORDER NUMBER'.

l_fieldcat-outputlen = 10.

APPEND l_fieldcat TO p_p_fieldtab.

CLEAR l_fieldcat.

l_fieldcat-fieldname = 'ERDAT'.

l_fieldcat-seltext_m = 'Create Date'.

l_fieldcat-ref_fieldname = 'ERDAT'.

l_fieldcat-ref_tabname = 'VBAK'.

l_fieldcat-outputlen = 10.

APPEND l_fieldcat TO p_p_fieldtab.

CLEAR l_fieldcat.

l_fieldcat-fieldname = 'ERNAM'.

l_fieldcat-seltext_m = 'Input Person'.

l_fieldcat-ref_fieldname = 'ERDAT'.

l_fieldcat-ref_tabname = 'VBAK'.

l_fieldcat-outputlen = 10.

APPEND l_fieldcat TO p_p_fieldtab.

CLEAR l_fieldcat.

l_fieldcat-fieldname = 'KUNNR'.

l_fieldcat-seltext_m = 'Sold Code'.

l_fieldcat-ref_fieldname = 'KUNNR'.

l_fieldcat-ref_tabname = 'VBAK'.

l_fieldcat-outputlen = 10.

APPEND l_fieldcat TO p_p_fieldtab.

CLEAR l_fieldcat.

l_fieldcat-fieldname = 'NAME1'.

l_fieldcat-seltext_m = 'Sold Name1'.

l_fieldcat-outputlen = 35.

APPEND l_fieldcat TO p_p_fieldtab.

CLEAR l_fieldcat.

l_fieldcat-fieldname = 'TEXT'.

l_fieldcat-seltext_m = 'Message'.

l_fieldcat-outputlen = 120.

APPEND l_fieldcat TO p_p_fieldtab.

ENDFORM. " INITIALIZE_FIELDEDI

*&---------------------------------------------------------------------*

*& Form display_mes

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM display_mes .

PERFORM init_fieldedi USING g_fieldcat[].

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = g_fieldcat[]

i_save = 'A'

i_default = 'A'

TABLES

t_outtab = it_tc_0100.

ENDFORM. " display_mes

6.如何使用SE16N进行数据批量修改和输入?

1、run SE16N;input table name and filter criteria;Go to the command field and type '/h' and press enter. This would activate the normal debugging session.

SAP SD实际应用的方法有哪些

2、Execute (F8) to enter in debugging session.

SAP SD实际应用的方法有哪些

This would activate the normal debugging session. Execute (F8) to enter in debugging session. Just make the below two variables as checked (X) .GD-SAPEDIT = XGD-EDIT=X3、Press F8 to continue the program, enter modify screen. After edit data, you need to click "save" button to save data into database.

7.SD-如何根据销售单位确认数量,避免出现小数确认数量

在销售单中,我们可能按大包装进行销售,单有时库存不够,系统出现带小数的确认数量。为了避免这个出现,我们可以使用增强进行避免。在单元ZXATPU02添加代码如下:

data: w_av_vrkme like atpcc-atpm1,

w_av_vrkme_n like atpcc-atpm1,

w_av_pc like atpcc-atpm1.

* only if more ordered the available

check: T_ATPCSX-bdmng > p_atpcc-atpm1.

* available only partial ? via MOD

w_av_vrkme = p_atpcc-atpm1 mod ( T_ATPCSX-umrez * T_ATPCSX-umren ).

* rounded up in KAR (via DIV)

w_av_vrkme_n = ( p_atpcc-atpm1 div T_ATPCSX-umrez ) * T_ATPCSX-umren.

* rounded up quanitity in PC

w_av_pc = w_av_vrkme_n * T_ATPCSX-umrez / T_ATPCSX-umren.

* only if we have one line otherwise too complex

read table T_MDVEX index 2.

if sy-subrc > 0.

read table T_MDVEX index 1.

if sy-subrc = 0.

if w_av_vrkme <> 0.

if p_atpcc-atpm1 < ( T_ATPCSX-umrez / T_ATPCSX-umren ).

T_MDVEX-mng02 = 0.

else.

T_MDVEX-mng02 = w_av_pc.

endif.

MODIFY t_mdvex index 1.

endif.

endif.

endif.

8.如何控制同一一个订单类型的使用多个号码范围

在现实的业务中,一个公司有多个销售组织,它们使用同一个订单类型,业务往往希望它们创建的订单的号码采用不同号码范围。但在sap里订单号码范围是在订单类型里设置,也就是使用相同的订单类型,也就使用相同的号码范围。如果要达到上需业务需求,我们可以使用增强实现。

具体实现参见下面的步骤:

步骤1:创建多个号码段:path: Spro->Sales and Distribution->Sales->Sales Documents->Sales Document Header->Define Number Ranges For Sales Documents TCODE: VN01

步骤二:设置订单类型的号码范围path: Spro->Sales and Distribution->Sales->Sales Documents->Sales Document Header->Define Sales Document TypesTCODE: VOV8

步骤三:修改SAP增强代码

modify the source code to control use different number range for different sale organiztion

3.1 you can use se38 to open source code MV45AFZZ and find the form userexit_number_range.

*---------------------------------------------------------------------*

* FORM USEREXIT_NUMBER_RANGE *

*---------------------------------------------------------------------*

* This userexit can be used to determine the numberranges for *

* the internal document number. *

* *

* US_RANGE_INTERN - internal number range *

* *

* This form is called from form BELEG_SICHERN *

* *

*---------------------------------------------------------------------*

form userexit_number_range using us_range_intern.

* Example: Numer range from TVAK like in standard

* US_RANGE_INTERN = TVAK-NUMKI.

endform.

3.2 change the source code as the following

*---------------------------------------------------------------------*

* FORM USEREXIT_NUMBER_RANGE *

*---------------------------------------------------------------------*

* This userexit can be used to determine the numberranges for *

* the internal document number. *

* *

* US_RANGE_INTERN - internal number range *

* *

* This form is called from form BELEG_SICHERN *

* *

*---------------------------------------------------------------------*

form userexit_number_range using us_range_intern.

* Example: Numer range from TVAK like in standard

* US_RANGE_INTERN = TVAK-NUMKI.

*{ INSERT TASK912652 1

IF us_range_intern = '13'.

CASE vbak-vkorg.

WHEN '0029'.

us_range_intern = '13'.

WHEN '0143'.

us_range_intern = '14'.

ENDCASE.

ENDIF.

*} INSERT

endform.

9 SD--订单最小量限制的增强

在现实的销售活动中考虑到配送成本,需要限制小额订单的开具,为了达到该目的,我们可以对出口USEREXIT_SAVE_DOCUMENT_PREPARE 进行增强,具体步骤如下.一、设计订单起定量设置表,自定义(销售公司+订单类型)具体定义参见下图建立通过sap表维护工具来维护自定义表程序和事务妈。 二、设计订单起定量设置(客户)表,自定义(客户)具体定义参见下图建立通过sap表维护工具来维护自定义表程序和事务妈。 三、增强代码

se38打开单元MV45AFZZ,修改USEREXIT_SAVE_DOCUMENT_PREPARE过程,代码如下

*---------------------------------------------------------------------*

* FORM USEREXIT_SAVE_DOCUMENT_PREPARE *

*---------------------------------------------------------------------*

* This userexit can be used for changes or checks, before a *

* document is saved. *

* *

* If field T180-TRTYP contents 'H', the document will be *

* created, else it will be changed. *

* *

* This form is called at the beginning of form BELEG_SICHERN *

* *

*---------------------------------------------------------------------*

FORM USEREXIT_SAVE_DOCUMENT_PREPARE.

*{ INSERT DEVK938281 1

DATA: zzamount LIKE vbak-netwr.

DATA: zmin LIKE vbak-netwr.

IF vbak-waerk NE tvko-waers. "

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

date = sy-datum

foreign_amount = vbak-netwr

foreign_currency = vbak-waerk

local_currency = sy-waers

IMPORTING

local_amount = zzamount

EXCEPTIONS

no_rate_found = 01

overflow + 02.

IF sy-subrc NE 0.

zzamount = vbak-netwr.

ENDIF.

ELSE.

zzamount = vbak-netwr.

ENDIF.

*minimum order value check in local currency

TABLES: zorderlimit, zorder_limit.

DATA minvalue LIKE vbak-netwr.

DATA difference LIKE vbak-netwr.

SELECT SINGLE * FROM zorder_limit

WHERE vkorg EQ vbak-vkorg

and auart EQ vbak-auart.

IF sy-subrc EQ 0.

SELECT SINGLE * FROM zorderlimit

WHERE KUNNR EQ vbak-KUNNR.

IF sy-subrc EQ 0.

zmin = zorderlimit-ZZNETWR * 100.

IF zzamount < zmin.

MESSAGE '单据小于公司规定的订单起定量,系统不能保存!' TYPE 'E'.

sy-subrc = 4.

exit.

ENDIF.

ELSE.

zmin = zorder_limit-ZZNETWR * 100.

IF zzamount < zmin.

MESSAGE '单据小于公司规定的订单起定量,系统不能保存!' TYPE 'E'.

sy-subrc = 4.

exit.

ENDIF.

ENDIF.

ENDIF.

*

*} INSERT

ENDFORM.

*eject

四、结果如下图

SAP SD实际应用的方法有哪些

“SAP SD实际应用的方法有哪些”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!


分享题目:SAPSD实际应用的方法有哪些
文章链接:http://bjjierui.cn/article/pehcco.html

其他资讯