2008 年 03 月 22日, 星期六

取得open sales order(2) 转

取得open sales order(2)

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

*& Form GET_DATA_BQ

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

* text

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

FORM GET_DATA_BQ.

* With inner join get billing plan

* VBAK--VBAP--VBKD--FPLT

SELECT A~VBELN B~POSNR D~AFDAT D~TETXT D~MLBEZ D~FPROZ

D~FAKWR D~WAERS D~FAKSP D~FAREG D~FKSAF D~ZTERM

D~FPTTP D~FKARV D~KURRF D~MLSTN D~FPFIX

FROM VBAK AS A INNER JOIN VBAP AS B ON B~VBELN = A~VBELN

INNER JOIN VBKD AS C ON C~VBELN = B~VBELN AND C~POSNR = B~POSNR

INNER JOIN FPLT AS D ON D~FPLNR = C~FPLNR

INTO CORRESPONDING FIELDS OF TABLE IT_BQ

WHERE A~VKORG IN S_VKORG

AND A~VTWEG IN S_VTWEG

AND A~SPART IN S_SPART

AND A~KUNNR IN S_KUNNR

AND A~ERDAT IN S_ERDAT

AND A~AUART IN S_AUART

AND B~PSTYV IN S_PSTYV

AND B~ABGRU IN S_ABGRU

AND B~PS_PSP_PNR IN S_WBS

AND B~MATNR IN S_MATNR

AND D~FKSAF <> 'C'.

IF SY-SUBRC <> 0.

MESSAGE S033(/SIE/CHN_ALL)

WITH 'No data exists!'.

ENDIF.

ENDFORM. " GET_DATA_BQ

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

*& Form GET_DATA_SQ

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

* text

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

FORM GET_DATA_SQ.

* Local data

DATA:

BEGIN OF LR_SQ,

VBELN LIKE VBAP-VBELN,

POSNR LIKE VBAP-POSNR,

RFMNG LIKE VBFA-RFMNG,

KWMENG LIKE VBAP-KWMENG,

OQ LIKE VBAP-KWMENG,

VRKME LIKE VBAP-VRKME,

END OF LR_SQ.

DATA: LIT_SQ LIKE TABLE OF LR_SQ,

LLR_SQ LIKE LR_SQ.

DATA: L_QTY LIKE VBFA-RFMNG.

* Get sales open Qty

* VBAK--VBAP--VBFA

SELECT A~VBELN B~POSNR B~KWMENG B~VRKME C~RFMNG

FROM VBAK AS A INNER JOIN VBAP AS B ON B~VBELN = A~VBELN

INNER JOIN VBFA AS C ON C~POSNV = B~POSNR AND C~VBELV = B~VBELN

INTO CORRESPONDING FIELDS OF TABLE LIT_SQ

WHERE A~VKORG IN S_VKORG

AND A~VTWEG IN S_VTWEG

AND A~SPART IN S_SPART

AND A~KUNNR IN S_KUNNR

AND A~ERDAT IN S_ERDAT

AND A~AUART IN S_AUART

AND B~PSTYV IN S_PSTYV

AND B~ABGRU IN S_ABGRU

AND B~PS_PSP_PNR IN S_WBS

AND B~MATNR IN S_MATNR

AND C~VBTYP_N IN S_VBTYP.

IF SY-SUBRC <> 0.

MESSAGE S033(/SIE/CHN_ALL) WITH 'No data exists!'.

ENDIF.

* GI Qty summary

SORT LIT_SQ BY VBELN POSNR.

LOOP AT LIT_SQ INTO LR_SQ.

LLR_SQ = LR_SQ.

L_QTY = LLR_SQ-RFMNG + L_QTY.

AT END OF POSNR.

LLR_SQ-OQ = LLR_SQ-KWMENG - L_QTY.

WRITE:

L_QTY TO R_SQ-GQ UNIT LLR_SQ-VRKME,

LLR_SQ-KWMENG TO R_SQ-SQ UNIT LLR_SQ-VRKME,

LLR_SQ-OQ TO R_SQ-OQ UNIT LLR_SQ-VRKME.

R_SQ-VBELN = LLR_SQ-VBELN.

R_SQ-POSNR = LLR_SQ-POSNR.

APPEND R_SQ TO IT_SQ.

CLEAR: LLR_SQ,LR_SQ,L_QTY.

ENDAT.

ENDLOOP.

ENDFORM. " GET_DATA_SQ

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

*& Form OUTPUT_SQ

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

* text

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

FORM OUTPUT_SQ.

* Define ALV fieldcat structure

DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

* Add data to field catelog

SET_ALV_FIELDCAT:

'VBELN' 'IT_BQ' '1' '12' TEXT-A01,

'POSNR' 'IT_BQ' '2' '10' TEXT-A02,

'SQ' 'IT_BQ' '3' '22' TEXT-A03,

'GQ' 'IT_BQ' '4' '22' TEXT-A04,

'OQ' 'IT_BQ' '5' '20' TEXT-A05.

* Call function to show result

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IT_FIELDCAT = IT_FIELDCAT

I_SAVE = 'A'

TABLES

T_OUTTAB = IT_SQ.

ENDFORM. " OUTPUT_SQ

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

*& Form OUTPUT_BQ

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

* text

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

FORM OUTPUT_BQ.

* Define ALV fieldcat structure

DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

* Add data to field catelog

SET_ALV_FIELDCAT:

'VBELN' 'IT_SQ' '1' '12' TEXT-A01,

'POSNR' 'IT_SQ' '2' '10' TEXT-A02,

'AFDAT' 'IT_SQ' '3' '12' TEXT-B03,

'TETXT' 'IT_SQ' '4' '10' TEXT-B04,

'MLBEZ' 'IT_SQ' '5' '10' TEXT-B05,

'FPROZ' 'IT_SQ' '6' '12' TEXT-B06,

'FAKWR' 'IT_SQ' '7' '22' TEXT-B07,

'WAERS' 'IT_SQ' '8' '10' TEXT-B08,

'FAKSP' 'IT_SQ' '9' '10' TEXT-B09,

'FAREG' 'IT_SQ' '10' '10' TEXT-B10,

'FKSAF' 'IT_SQ' '11' '10' TEXT-B11,

'ZTERM' 'IT_SQ' '12' '10' TEXT-B12,

'FPTTP' 'IT_SQ' '13' '10' TEXT-B13,

'FKARV' 'IT_SQ' '14' '10' TEXT-B14,

'KURRF' 'IT_SQ' '15' '20' TEXT-B15 ,

'MLSTN' 'IT_SQ' '16' '20' TEXT-B16,

'FPFIX' 'IT_SQ' '17' '10' TEXT-B17.

* Call function to show result

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IT_FIELDCAT = IT_FIELDCAT

I_SAVE = 'A'

TABLES

T_OUTTAB = IT_BQ.

ENDFORM. " OUTPUT_BQ


ultraluck 发表于:2008.03.22 17:25 ::分类: ( SD Module ) ::阅读:(775次) :: Permanent link :: 引用 (0)

取得open sales order(1)转

这个程序用来找到open的sales order. REPORT /SIE/CHN_SD_SDI_OPEN_QTY . *&---------------------------------------------------------------------* *& Macro declaration * *&---------------------------------------------------------------------* DEFINE SET_ALV_FIELDCAT. CLEAR LS_FIELDCAT. LS_FIELDCAT-FIELDNAME = &1. "Field name LS_FIELDCAT-TABNAME = &2. "Reference table name LS_FIELDCAT-COL_POS = &3. "Column position LS_FIELDCAT-OUTPUTLEN = &4. "Output length LS_FIELDCAT-SELTEXT_L = &5. "Select text long length LS_FIELDCAT-DDICTXT = 'L'. "Using select text type APPEND LS_FIELDCAT TO IT_FIELDCAT. END-OF-DEFINITION. TABLES: VBAK,VBAP,VBFA. TYPE-POOLS SLIS. *ALC used fieldcatelog internal table DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV. *Structure and internal table for sales open Qty DATA: BEGIN OF R_SQ, VBELN LIKE VBAP-VBELN, POSNR LIKE VBAP-POSNR, SQ(20), GQ(20), OQ(20), END OF R_SQ, IT_SQ LIKE TABLE OF R_SQ. *Structure and table for billing open Qty DATA BEGIN OF R_BQ. DATA VBELN LIKE VBAP-VBELN. DATA POSNR LIKE VBAP-POSNR. INCLUDE STRUCTURE FPLT. DATA END OF R_BQ. DATA IT_BQ LIKE TABLE OF R_BQ. *Selection screen SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-B01. SELECTION-SCREEN BEGIN OF LINE. PARAMETER RAD1 RADIOBUTTON GROUP R1 USER-COMMAND F1. SELECTION-SCREEN COMMENT 3(20) TEXT-R01 FOR FIELD RAD1. PARAMETER RAD2 RADIOBUTTON GROUP R1. SELECTION-SCREEN COMMENT 40(20) TEXT-R02 FOR FIELD RAD2. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF BLOCK B1. SELECT-OPTIONS: S_VKORG FOR VBAK-VKORG, S_VTWEG FOR VBAK-VTWEG, S_SPART FOR VBAK-SPART, S_KUNNR FOR VBAK-KUNNR, S_ERDAT FOR VBAK-ERDAT, S_AUART FOR VBAK-AUART, S_PSTYV FOR VBAP-PSTYV, S_ABGRU FOR VBAP-ABGRU, S_WBS FOR VBAP-PS_PSP_PNR, S_MATNR FOR VBAP-MATNR, S_VBELV FOR VBFA-VBELV, S_VBTYP FOR VBFA-VBTYP_N. *Initialize program INITIALIZATION. RAD1 = 'X'. *Change output according to screen selection AT SELECTION-SCREEN OUTPUT. PERFORM MODIF_SCREEN. *Check authority AT SELECTION-SCREEN. PERFORM AUTH_CHECK. START-OF-SELECTION. IF RAD1 IS INITIAL. * Get billing Qty PERFORM GET_DATA_BQ. * Show billing Qty PERFORM OUTPUT_BQ. ELSE. * Get Sales Open Qty PERFORM GET_DATA_SQ. * Show Sales Open Qty PERFORM OUTPUT_SQ. ENDIF. *&---------------------------------------------------------------------* *& Form modif_screen *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM MODIF_SCREEN. IF RAD1 IS INITIAL. LOOP AT SCREEN. IF SCREEN-NAME CS 'VBELV' OR SCREEN-NAME CS 'VBTYP'. SCREEN-ACTIVE = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ENDIF. ENDFORM. " modif_screen *&---------------------------------------------------------------------* *& Form AUTH_CHECK *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM AUTH_CHECK. * Check whether the User has the Transaction Code Authorization AUTHORITY-CHECK OBJECT 'S_TCODE' ID 'TCD' FIELD 'VA03'. IF SY-SUBRC <> 0. MESSAGE E043(/SIE/CHN_ALL). ENDIF. ENDFORM. " AUTH_CHECK

 查看全文
ultraluck 发表于:2008.03.22 17:18 ::分类: ( SD Module ) ::阅读:(835次) :: Permanent link :: 引用 (0)

Learn SD implementation(3) 转

Learn SD implementation(3)

Master data sharing, Common distribution channels, Common division

Menu path:[VOR1]

<!--[if !vml]--><!--[endif]-->

Tip:

<!--[if !supportLists]-->1. <!--[endif]-->You can only create or change master data in the distribution channel that is being referenced.

Customer group:[OVS9]

Definition: The customer group is a grouping of customers that is configured under master data in the IMG.

Stored in table: T151

Menu path:

]-->

Function: The customer group is a field that can be used to generate statistics as well as to create condition records.

Sales districts: [OVR0]

Also referred to as customer districts, can be geographical areas or regions.

Menu path:

<!--[if !vml]-->

Customer master record fields:[OBD2]

Customer master records are made up of many fields. These fields may all be necessary in some business practices and may be unnecessary in others.

Menu path:

]-->

Description:

<!--[if !supportLists]-->1. <!--[endif]-->The customer master record is controlled via the account group;

<!--[if !supportLists]-->2. <!--[endif]-->Before create customer master record, you must allocate the new account group into the list of allowed account numbers for partner determination.

Step:

<!--[if !vml]-->

]-->

Question: How to show this configuration result? To be check with SD consultant.

Basic SD tables:

VBAK Order header

VBAP Order item

VBEP Order schedule line

LIKP Delivery header

LIPS Delivery item

VBRK Billing header

VBRP Billing item

VBPA Partners

VBUK Status header

VBUP Status items

VBKD Business data

VBFA Document flow

KNA1 Customer master header data

KNB1 Accounting views

KNVV Sales views

MARA Highest level of data

MBEW Data referring to accounting

MVKE Data referring to sales

MARC Data referring to the plant

MARD Data storage location

VEKP Shipping unit header

VEPO Shipping unit item

VBUK Document header status

VBUP Document item status


ultraluck 发表于:2008.03.22 17:10 ::分类: ( SD Module ) ::阅读:(705次) :: Permanent link :: 引用 (0)

Learn SD implementation(2) 转

Learn SD implementation(2)

Master data for customer

Basic customer master records:

The sold-to party record: only needs sales-relevant data.

The ship-to party record: only needs shipping-relevant data, such as unloading points and so on.

The bill-to party record: need only have the basic data such as address and output fields.

The payer record

Others:

Inter-company customers

One-time customer

T-code:

VD01: is the customer master record for sales view creation.(Table: KNVV)

XD01: is the central customer master record creation with company code data.

Special words: Account group: defines what fields are available in the customer master records.

Material Master Data

Accounting: This screen contains the valuation and costing information.

MRP 1,2,3,4: These screens provide information for material requirements planning (MRP screens) and consumption-based planning/inventory control/availability checks.

Purchasing: Data here is provided by purchasing for a material.

Storage: This screen contains information relating to the storage/warehousing of a material.

Forecasting: Here you’ll find information for predicting material requirements.

Sales and distribution: These views are most relevant for the SD team.

The item category group is of utmost importance to SD; it covers how the material behaves from the sales quotation right through to the invoice. In fact, all sales documents are dependent on this fields value.

Unit of measure:

Base unit of measure: This is the unit of measure used as a basis for all transactions.

Alternative unit of measure: If a product is managed in the base unit of measure “piece” but is sold in the sales unit “box” you must define the conversion factor.

Sales unit: The unit of measure in which materials are sold is referred to as a sales unit

Delivery unit: The delivery unit refers to the unit in which materials can be delivered. Only exact multiples of the delivery unit can be delivered.

Quantity specification:

Minimum order quantity: The minimum order quantity refers to the minimum quantity the customer must order.

Minimum delivery quantity: The minimum delivery quantity refers to the minimum quantity you must deliver to the customer.

Customer material information records (VD51)

One thing to notice:

The system copies the plant data into the sales order from the relevant

entries in the master records based upon the following priorities:

1. Customer material information master record

2. Customer master record

3. Material master record

PS: I will check this tomorrow and paste it to blog.


ultraluck 发表于:2008.03.22 17:05 ::分类: ( SD Module ) ::阅读:(576次) :: Permanent link :: 引用 (0)

Learn SD implementation(1) 转

Learn SD implementation(1)

Brief list:

SD-MD For master data

SD-BF For basic function

SD-SLS For sales

SD-SHP For shipment

SD-TBA For transportation

SD-FTT For foreign trade

SD-BIL For billing

SD-CAS For sales support

SD-EDI For EDI

SD-IS For information system

Basic transaction code:

VS00 Master data

VC00 Sales support

VA00 Sales

VL00 Shipping

VT00 Transportation

VF00 Billing

VX00 Foreign trade

SPRO Enterprise IMG

For SD-MD:

Organizational Data

Customer and Material Master Data

Document Master Data

Organizational Data

Define the SD structure:

Organizational data:

Sales Organization: is an organizational unit that sells and distributes products, negotiates terms of sale, and is responsible for these transactions.

Distribution channel: is a channel through which materials or services reach customers.

Division: is a product group that can be defined for a wide-ranging spectrum of products.

Sales area: is compiled of the following data: a sales organization, a distribution channel, a division.

Sales office: A sales office is in turn assigned to a sales area.

Sales group: The staff of a sales office may be subdivided into sales groups.

Shipping points: They are the top level of the organization in shipping. Deliveries are always initiated from exactly one shipping point. A shipping point is assigned one or more plants and can be subdivided into several loading points.

Loading point: is a voluntary entry. It is merely a subdivision of a shipping point.


ultraluck 发表于:2008.03.22 16:59 ::分类: ( SD Module ) ::阅读:(40470次) :: 评论 (0) :: 引用 (0)