ZSDRM001-发货清单
REPORT ZSDRM001 LINE-SIZE 225 LINE-COUNT 65
NO STANDARD PAGE HEADING.
*----------------------------------------------------------------------*
* Shipment list (2) add sort by material no not by customer no.
* request by Hsih Shi plant Angela #500
* add 'L2' by Lydia Liu
*----------------------------------------------------------------------*
TABLES: LIPS,
LIKP,
MAKT,
VBAK,
VBAP,
VBRK,
VBRP,
VBFA,
VBPA,
KONV,
MARA,
MARC,
ZV3RDP,
KNA1,
VBUP,
EKPO.
* Selection Criteria
SELECTION-SCREEN BEGIN OF BLOCK BLOCK WITH FRAME
TITLE TEXT-001.
SELECT-OPTIONS: KUNNR FOR VBAK-KUNNR. "Sold to party
SELECT-OPTIONS: LAND1 FOR KNA1-LAND1. "Country key
SELECT-OPTIONS: KUNNR_SH FOR VBAK-KUNNR. "Ship to party
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: AUART FOR ZV3RDP-AUART, "Sales doc. type
VKORG FOR ZV3RDP-VKORG NO-EXTENSION NO INTERVALS,
VTWEG FOR ZV3RDP-VTWEG, "Channel
SPART FOR ZV3RDP-SPART. "Division
SELECT-OPTIONS: VKGRP FOR VBAK-VKGRP. "Sales group
SELECT-OPTIONS: SALES FOR VBPA-PERNR. "Sales Employee
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: PRDHA FOR MARA-PRDHA. "Product hierarchy
SELECT-OPTIONS: MATNO FOR MARA-MATNR. "Material no.
PARAMETER: WERKS LIKE MARC-WERKS. "Taiwan Plant
PARAMETER: PLANT(10) TYPE C. "China plant
SELECTION-SCREEN END OF BLOCK BLOCK.
* Date period
SELECTION-SCREEN BEGIN OF BLOCK BLOCK1 WITH FRAME
TITLE TEXT-002.
SELECT-OPTIONS: FKDAT FOR VBRK-FKDAT DEFAULT SY-DATUM TO SY-DATUM.
SELECTION-SCREEN END OF BLOCK BLOCK1.
SELECTION-SCREEN BEGIN OF BLOCK BLOCK2 WITH FRAME
TITLE TEXT-003.
PARAMETERS CUST RADIOBUTTON GROUP GRP.
PARAMETERS MATNR RADIOBUTTON GROUP GRP.
PARAMETERS SHIP RADIOBUTTON GROUP GRP.
PARAMETERS SUMM AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK BLOCK2.
DATA NETWR_D LIKE VBRP-NETWR.
DATA VRKME_D LIKE LIPS-VRKME.
DATA FKIMG_D LIKE VBRP-FKIMG.
DATA WAERK_D LIKE VBFA-WAERS.
DATA KUNAG_D LIKE VBRK-KUNAG.
DATA MATNR_D LIKE MARA-MATNR.
DATA VTWEG_H LIKE VBRK-VTWEG.
DATA SPART_H LIKE VBRK-SPART.
DATA VKORG_H LIKE VBRK-VKORG.
DATA TEMP(20) TYPE C.
DATA: INDEX LIKE SY-INDEX.
DATA TEXT LIKE THEAD-TDNAME.
DATA LIN TYPE P.
DATA AUART_P LIKE VBAK-AUART.
DATA PERNR LIKE VBPA-PERNR.
DATA: BEGIN OF ORDER OCCURS 10,
KUNNR LIKE VBAK-KUNNR, "sold-to party
VBELN LIKE VBAP-VBELN, "SO no.
POSNR LIKE VBAP-POSNR, "SO item no.
INVNO LIKE VBRP-VBELN, "Invoice no.
INVIT LIKE VBRP-POSNR, "Invoice item no.
FKDAT LIKE VBRK-FKDAT,
VKORG LIKE VBAK-VKORG,
VTWEG LIKE VBAK-VTWEG,
SPART LIKE VBAK-SPART,
MATNR LIKE VBRP-MATNR,
PRDHA LIKE MARA-PRDHA,
UNIPR(13) TYPE P DECIMALS 4,
NETWR LIKE VBRP-NETWR,
WAERK LIKE VBRK-WAERK,
FKIMG LIKE VBRP-FKIMG,
VRKME LIKE VBRP-VRKME,
SALES LIKE P0002-PERNR,
LAND1 LIKE KNA1-LAND1,
ZTERM LIKE VBRK-ZTERM,
* zfbdt like bseg-zfbdt,
KTGRD LIKE VBRK-KTGRD,
KTGRM LIKE VBRP-KTGRM,
PRCTR LIKE VBRP-PRCTR,
SHIP LIKE VBPA-KUNNR,
END OF ORDER.
DATA: BEGIN OF ITAB OCCURS 10,
KUNNR LIKE VBAK-KUNNR,
SHIP LIKE VBAK-KUNNR,
MATNR LIKE MARA-MATNR,
NAME1 LIKE KNA1-NAME1,
FKIMG_D LIKE VBRP-FKIMG,
VRKME_D LIKE LIPS-VRKME,
NETWR_D LIKE VBFA-RFWRT,
WAERK_D LIKE VBFA-WAERS,
END OF ITAB.
DATA: BEGIN OF MATKL OCCURS 0,
SIGN(1),
OPTION(2),
LOW LIKE MARA-MATKL,
HIGH LIKE MARA-MATKL,
END OF MATKL.
DATA: BEGIN OF INLINES OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA: END OF INLINES.
DATA: BEGIN OF LINES OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA: END OF LINES.
INITIALIZATION.
CLEAR SUMM.
CLEAR VKORG. REFRESH VKORG.
CLEAR VTWEG. REFRESH VTWEG.
CLEAR SPART. REFRESH SPART.
CLEAR KUNNR. REFRESH KUNNR.
CLEAR LAND1. REFRESH LAND1.
CLEAR VKGRP. REFRESH VKGRP.
CLEAR SALES. REFRESH SALES.
CLEAR PRDHA. REFRESH PRDHA.
CLEAR FKDAT. REFRESH VKORG.
CLEAR AUART. REFRESH AUART.
CLEAR MATKL. REFRESH MATKL.
CLEAR WERKS.
START-OF-SELECTION.
CASE WERKS.
WHEN 'PM01'.
VKORG-SIGN = 'I'. VKORG-OPTION = 'EQ'. VKORG-LOW = 'PMX2'.
APPEND VKORG.
CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
EXPORTING
INPUT = 'OR'
IMPORTING
OUTPUT = AUART-LOW
EXCEPTIONS
OTHERS = 1.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. "auart-low = 'OR'.
APPEND AUART.
CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
EXPORTING
INPUT = 'DR'
IMPORTING
OUTPUT = AUART-LOW
EXCEPTIONS
OTHERS = 1.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. "auart-low = 'DR'.
APPEND AUART.
CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
EXPORTING
INPUT = 'SD'
IMPORTING
OUTPUT = AUART-LOW
EXCEPTIONS
OTHERS = 1.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. "auart-low = 'SD'.
APPEND AUART.
WHEN 'PM02'.
DESCRIBE TABLE VKORG LINES LIN.
IF LIN EQ 0.
VKORG-SIGN = 'I'. VKORG-OPTION = 'EQ'. VKORG-LOW = 'PMX1'.
APPEND VKORG.
VKORG-SIGN = 'I'. VKORG-OPTION = 'EQ'. VKORG-LOW = 'PMX4'.
APPEND VKORG.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
EXPORTING
INPUT = 'OR'
IMPORTING
OUTPUT = AUART-LOW
EXCEPTIONS
OTHERS = 1.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. "auart-low = 'OR'.
APPEND AUART.
CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
EXPORTING
INPUT = 'DR'
IMPORTING
OUTPUT = AUART-LOW
EXCEPTIONS
OTHERS = 1.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. "auart-low = 'DR'.
APPEND AUART.
CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
EXPORTING
INPUT = 'SD'
IMPORTING
OUTPUT = AUART-LOW
EXCEPTIONS
OTHERS = 1.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. "auart-low = 'SD'.
APPEND AUART.
CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
EXPORTING
INPUT = 'Z3B'
IMPORTING
OUTPUT = AUART-LOW
EXCEPTIONS
OTHERS = 1.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. "auart-low = 'Z3B'.
APPEND AUART.
CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
EXPORTING
INPUT = 'ZBSD'
IMPORTING
OUTPUT = AUART-LOW
EXCEPTIONS
OTHERS = 1.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. "AUArt-low = 'ZBSD'.
APPEND AUART.
WHEN 'PM05'.
VKORG-SIGN = 'I'. VKORG-OPTION = 'EQ'. VKORG-LOW = 'PMX3'.
APPEND VKORG.
CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
EXPORTING
INPUT = 'OR'
IMPORTING
OUTPUT = AUART-LOW
EXCEPTIONS
OTHERS = 1.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. "auart-low = 'OR'.
APPEND AUART.
CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
EXPORTING
INPUT = 'DR'
IMPORTING
OUTPUT = AUART-LOW
EXCEPTIONS
OTHERS = 1.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. "auart-low = 'DR'.
APPEND AUART.
CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
EXPORTING
INPUT = 'SD'
IMPORTING
OUTPUT = AUART-LOW
EXCEPTIONS
OTHERS = 1.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. "auart-low = 'SD'.
APPEND AUART.
ENDCASE.
CASE PLANT.
WHEN 'OA'.
VKORG-SIGN = 'I'. VKORG-OPTION = 'EQ'. VKORG-LOW = 'PMX1'.
APPEND VKORG.
SPART-SIGN = 'I'. SPART-OPTION = 'EQ'. SPART-LOW = '01'.
APPEND SPART.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. AUART-LOW = 'Z3R'.
APPEND AUART.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. AUART-LOW = 'Z3SD'.
APPEND AUART.
WHEN 'PROJECTOR'.
VKORG-SIGN = 'I'. VKORG-OPTION = 'EQ'. VKORG-LOW = 'PMX1'.
APPEND VKORG.
SPART-SIGN = 'I'. SPART-OPTION = 'EQ'. SPART-LOW = '02'.
APPEND SPART.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. AUART-LOW = 'Z3R'.
APPEND AUART.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. AUART-LOW = 'Z3SD'.
APPEND AUART.
WHEN 'SCANNER'.
VKORG-SIGN = 'I'. VKORG-OPTION = 'EQ'. VKORG-LOW = 'PMX2'.
APPEND VKORG.
SPART-SIGN = 'I'. SPART-OPTION = 'EQ'. SPART-LOW = '03'.
APPEND SPART.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. AUART-LOW = 'Z3R'.
APPEND AUART.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. AUART-LOW = 'Z3SD'.
APPEND AUART.
WHEN 'MOUSE'.
VKORG-SIGN = 'I'. VKORG-OPTION = 'EQ'. VKORG-LOW = 'PMX3'.
APPEND VKORG.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. AUART-LOW = 'Z3R'.
APPEND AUART.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. AUART-LOW = 'Z3SD'.
APPEND AUART.
WHEN 'TELEPHONE'.
VKORG-SIGN = 'I'. VKORG-OPTION = 'EQ'. VKORG-LOW = 'PMX4'.
APPEND VKORG.
SPART-SIGN = 'I'. SPART-OPTION = 'EQ'. SPART-LOW = '07'.
APPEND SPART.
MATKL-SIGN = 'I'. MATKL-OPTION = 'EQ'. MATKL-LOW = 'TELEPHONE'.
APPEND MATKL.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. AUART-LOW = 'Z3R'.
APPEND AUART.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. AUART-LOW = 'Z3SD'.
APPEND AUART.
WHEN 'CELLUAR'.
VKORG-SIGN = 'I'. VKORG-OPTION = 'EQ'. VKORG-LOW = 'PMX4'.
APPEND VKORG.
SPART-SIGN = 'I'. SPART-OPTION = 'EQ'. SPART-LOW = '07'.
APPEND SPART.
MATKL-SIGN = 'I'. MATKL-OPTION = 'EQ'. MATKL-LOW = 'CELLUAR'.
APPEND MATKL.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. AUART-LOW = 'Z3R'.
APPEND AUART.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. AUART-LOW = 'Z3SD'.
APPEND AUART.
WHEN 'SURGE'.
VKORG-SIGN = 'I'. VKORG-OPTION = 'EQ'. VKORG-LOW = 'PMX4'.
APPEND VKORG.
SPART-SIGN = 'I'. SPART-OPTION = 'EQ'. SPART-LOW = '08'.
APPEND SPART.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. AUART-LOW = 'Z3R'.
APPEND AUART.
AUART-SIGN = 'I'. AUART-OPTION = 'EQ'. AUART-LOW = 'Z3SD'.
APPEND AUART.
ENDCASE.
IF AUART-LOW NE 'KN'.
SELECT * FROM VBRK WHERE VKORG IN VKORG
AND VTWEG IN VTWEG
AND SPART IN SPART
AND FKDAT IN FKDAT"Billing date in date period
AND FKART IN ('F1', 'F2', 'L2','ZF2')
AND FKSTO NE 'X'"Billing doc not cancel
AND KUNAG IN KUNNR "sold-to-party
ORDER BY VTWEG SPART KUNAG VBELN.
SELECT * FROM VBRP WHERE VBELN EQ VBRK-VBELN
AND MATNR IN MATNO.
*get SO no.
SELECT SINGLE AUART VKGRP INTO (VBAK-AUART, VBAK-VKGRP)
FROM VBAK WHERE VBELN EQ VBRP-AUBEL.
*get Sales employee
SELECT SINGLE PERNR FROM VBPA INTO PERNR
WHERE VBELN EQ VBRP-AUBEL
AND POSNR EQ '000000'
AND PARVW EQ 'VE'.
*get product hierarchy
SELECT SINGLE PRDHA FROM MARA INTO MARA-PRDHA
WHERE MATNR EQ VBRP-MATNR.
*get Ship-to party country key
SELECT SINGLE KUNNR FROM VBPA INTO VBPA-KUNNR
WHERE VBELN EQ VBRP-AUBEL
AND POSNR EQ '000000'
AND PARVW EQ 'WE'.
SELECT SINGLE LAND1 FROM KNA1 INTO KNA1-LAND1
WHERE KUNNR EQ VBPA-KUNNR.
IF MARA-PRDHA IN PRDHA
AND VBAK-VKGRP IN VKGRP
AND VBAK-AUART IN AUART
AND PERNR IN SALES
AND KNA1-LAND1 IN LAND1
AND MARA-MATKL IN MATKL
AND VBPA-KUNNR IN KUNNR_SH.
CLEAR ORDER.
* order-unipr = vbrp-netwr / vbrp-fkimg.
ORDER-KUNNR = VBRK-KUNAG. "sold-to party
ORDER-VBELN = VBRP-AUBEL.
ORDER-POSNR = VBRP-AUPOS.
ORDER-INVNO = VBRP-VBELN.
ORDER-INVIT = VBRP-POSNR.
ORDER-VKORG = VBRK-VKORG.
ORDER-VTWEG = VBRK-VTWEG.
ORDER-SPART = VBRK-SPART.
ORDER-FKDAT = VBRK-FKDAT.
ORDER-MATNR = VBRP-MATNR.
ORDER-PRDHA = MARA-PRDHA.
ORDER-NETWR = VBRP-NETWR.
ORDER-WAERK = VBRK-WAERK.
ORDER-FKIMG = VBRP-FKIMG.
ORDER-VRKME = VBRP-VRKME.
ORDER-SALES = VBPA-PERNR.
ORDER-LAND1 = KNA1-LAND1.
ORDER-ZTERM = VBRK-ZTERM.
ORDER-KTGRD = VBRK-KTGRD.
ORDER-KTGRM = VBRP-KTGRM.
ORDER-PRCTR = VBRP-PRCTR.
ORDER-SHIP = VBPA-KUNNR.
PERFORM CHECK_RE_ORDER.
WRITE ORDER-NETWR CURRENCY ORDER-WAERK TO TEMP.
DO.
REPLACE ',' WITH '' INTO TEMP.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
ENDDO.
CONDENSE TEMP NO-GAPS.
SHIFT TEMP RIGHT DELETING TRAILING SPACE.
ORDER-UNIPR = TEMP / ORDER-FKIMG.
* perform chk_ar_due_date.
* perform get_profit_center.
APPEND ORDER.
ENDIF.
ENDSELECT.
ENDSELECT.
ELSE.
SELECT * FROM VBAK
WHERE VKORG IN VKORG
AND VTWEG IN VTWEG
AND SPART IN SPART
AND AUART = 'KN'
AND KUNNR IN KUNNR
AND LIFSK = SPACE
AND VBTYP = 'I'.
SELECT * FROM VBAP
WHERE VBELN = VBAK-VBELN
AND ABGRU = SPACE
AND FAKSP = SPACE
AND MATNR IN MATNO.
SELECT SINGLE * FROM VBUP
WHERE VBELN = VBAK-VBELN
AND POSNR = VBAP-POSNR
AND GBSTA IN ('B','C').
CHECK SY-SUBRC = 0.
SELECT * FROM VBFA
WHERE VBELV = VBAP-VBELN
AND POSNV = VBAP-POSNR
AND VBTYP_N = 'R'
AND VBTYP_V = 'I'
AND ERDAT IN FKDAT.
* SELECT * FROM LIKP
* WHERE VBELN = VBFA-VBELN
* AND WADAT IN FKDAT
* AND KUNNR IN KUNNR_SH.
CHECK SY-SUBRC = 0.
*get Sales employee
SELECT SINGLE PERNR FROM VBPA INTO PERNR
WHERE VBELN EQ VBAK-VBELN
AND POSNR EQ '000000'
AND PARVW EQ 'VE'.
*get product hierarchy
SELECT SINGLE PRDHA FROM MARA INTO MARA-PRDHA
WHERE MATNR EQ VBAP-MATNR.
*get Ship-to party country key
SELECT SINGLE KUNNR FROM VBPA INTO VBPA-KUNNR
WHERE VBELN EQ VBAP-VBELN
AND POSNR EQ '000000'
AND PARVW EQ 'WE'.
SELECT SINGLE LAND1 FROM KNA1 INTO KNA1-LAND1
WHERE KUNNR EQ VBPA-KUNNR.
IF MARA-PRDHA IN PRDHA
AND VBAK-VKGRP IN VKGRP
AND VBAK-AUART IN AUART
AND PERNR IN SALES
AND KNA1-LAND1 IN LAND1
AND MARA-MATKL IN MATKL
AND VBPA-KUNNR IN KUNNR_SH.
CLEAR ORDER.
ORDER-KUNNR = VBAK-KUNNR. "sold-to party
ORDER-VBELN = VBAK-VBELN.
ORDER-POSNR = VBRP-POSNR.
ORDER-INVNO = VBFA-VBELN.
ORDER-INVIT = VBFA-POSNN.
ORDER-VKORG = VBAK-VKORG.
ORDER-VTWEG = VBAK-VTWEG.
ORDER-SPART = VBAK-SPART.
ORDER-FKDAT = VBFA-ERDAT.
ORDER-MATNR = VBAP-MATNR.
ORDER-PRDHA = MARA-PRDHA.
* ORDER-NETWR = VBRP-NETWR.
* ORDER-WAERK = VBRK-WAERK.
ORDER-FKIMG = VBFA-RFMNG.
ORDER-VRKME = VBAP-VRKME.
ORDER-SALES = VBPA-PERNR.
ORDER-LAND1 = KNA1-LAND1.
* ORDER-ZTERM = VBRK-ZTERM.
* ORDER-KTGRD = VBRK-KTGRD.
* ORDER-KTGRM = VBRP-KTGRM.
ORDER-PRCTR = VBAP-PRCTR.
ORDER-SHIP = VBPA-KUNNR.
APPEND ORDER.
ENDIF.
ENDSELECT.
ENDSELECT.
ENDSELECT.
* ENDSELECT.
ENDIF.
* get good issue for SD, ZBSD
PERFORM GET_GI_DATA.
IF NOT CUST IS INITIAL.
SORT ORDER BY KUNNR VBELN POSNR.
ENDIF.
IF NOT MATNR IS INITIAL.
SORT ORDER BY MATNR VBELN POSNR.
ENDIF.
IF NOT SHIP IS INITIAL.
SORT ORDER BY SHIP VBELN POSNR.
ENDIF.
LOOP AT ORDER.
* sort by customer (sold-to party)
IF NOT CUST IS INITIAL.
ON CHANGE OF ORDER-KUNNR.
SELECT SINGLE NAME1 FROM KNA1 INTO KNA1-NAME1
WHERE KUNNR EQ ORDER-KUNNR.
IF SY-TABIX NE 1.
IF SUMM IS INITIAL.
ULINE.
WRITE: /37(13) '***Subtotal'.
CLEAR INDEX.
LOOP AT ITAB WHERE KUNNR EQ KUNAG_D.
INDEX = INDEX + 1.
IF INDEX EQ 1.
WRITE: 50(20) ITAB-FKIMG_D UNIT ITAB-VRKME_D.
ELSE.
WRITE:/50(20) ITAB-FKIMG_D UNIT ITAB-VRKME_D.
ENDIF.
WRITE: 70(3) ITAB-VRKME_D,
103(21) ITAB-NETWR_D CURRENCY ITAB-WAERK_D,
124(3) ITAB-WAERK_D.
ENDLOOP.
SKIP 2.
ENDIF.
ENDIF.
IF SUMM IS INITIAL.
WRITE: /1 '***Customer:',
15(10) ORDER-KUNNR,
26(40) KNA1-NAME1.
ENDIF.
ENDON.
* matnr_d = order-matnr.
KUNAG_D = ORDER-KUNNR.
ITAB-KUNNR = ORDER-KUNNR.
* itab-matnr = order-matnr.
ITAB-FKIMG_D = ORDER-FKIMG.
ITAB-VRKME_D = ORDER-VRKME.
ITAB-NETWR_D = ORDER-NETWR.
ITAB-WAERK_D = ORDER-WAERK.
ITAB-NAME1 = KNA1-NAME1.
COLLECT ITAB.
CLEAR: FKIMG_D,
VRKME_D,
NETWR_D,
WAERK_D.
ENDIF.
* sort by material no.
IF NOT MATNR IS INITIAL.
ON CHANGE OF ORDER-MATNR.
SELECT SINGLE * FROM MAKT WHERE MATNR EQ ORDER-MATNR
AND SPRAS EQ SY-LANGU.
IF SY-TABIX NE 1.
IF SUMM IS INITIAL.
ULINE.
WRITE: /37(13) '***Subtotal'.
CLEAR INDEX.
LOOP AT ITAB WHERE MATNR EQ MATNR_D.
INDEX = INDEX + 1.
IF INDEX EQ 1.
WRITE: 50(20) ITAB-FKIMG_D UNIT ITAB-VRKME_D.
ELSE.
WRITE:/50(20) ITAB-FKIMG_D UNIT ITAB-VRKME_D.
ENDIF.
WRITE: 70(3) ITAB-VRKME_D,
103(21) ITAB-NETWR_D CURRENCY ITAB-WAERK_D,
124(3) ITAB-WAERK_D.
ENDLOOP.
SKIP 2.
ENDIF.
ENDIF.
IF SUMM IS INITIAL.
WRITE: /1 'Material:',
12(18) ORDER-MATNR,
31(40) MAKT-MAKTX.
* 70 itab-fkimg_d,
* 91(3) itab-vrkme_d.
ENDIF.
* endif.
ENDON.
MATNR_D = ORDER-MATNR.
* kunag_d = order-kunnr.
* itab-kunnr = order-kunnr.
ITAB-MATNR = ORDER-MATNR.
ITAB-FKIMG_D = ORDER-FKIMG.
ITAB-VRKME_D = ORDER-VRKME.
ITAB-NETWR_D = ORDER-NETWR.
ITAB-WAERK_D = ORDER-WAERK.
ITAB-NAME1 = KNA1-NAME1.
COLLECT ITAB.
CLEAR: FKIMG_D,
VRKME_D,
NETWR_D,
WAERK_D.
ENDIF.
* sort by ship-to party + SO no.
IF NOT SHIP IS INITIAL.
ON CHANGE OF ORDER-SHIP.
SELECT SINGLE NAME1 FROM KNA1 INTO KNA1-NAME1
WHERE KUNNR EQ ORDER-SHIP.
IF SY-TABIX NE 1.
IF SUMM IS INITIAL.
ULINE.
WRITE: /37(13) '***Subtotal'.
CLEAR INDEX.
LOOP AT ITAB WHERE SHIP EQ KUNAG_D.
INDEX = INDEX + 1.
IF INDEX EQ 1.
WRITE: 50(20) ITAB-FKIMG_D UNIT ITAB-VRKME_D.
ELSE.
WRITE:/50(20) ITAB-FKIMG_D UNIT ITAB-VRKME_D.
ENDIF.
WRITE: 70(3) ITAB-VRKME_D,
103(21) ITAB-NETWR_D CURRENCY ITAB-WAERK_D,
124(3) ITAB-WAERK_D.
ENDLOOP.
SKIP 2.
ENDIF.
ENDIF.
IF SUMM IS INITIAL.
WRITE: /1 '***Ship-to Party:',
18(10) ORDER-SHIP,
29(40) KNA1-NAME1.
ENDIF.
ENDON.
* matnr_d = order-matnr.
KUNAG_D = ORDER-SHIP.
ITAB-SHIP = ORDER-SHIP.
* itab-matnr = order-matnr.
ITAB-FKIMG_D = ORDER-FKIMG.
ITAB-VRKME_D = ORDER-VRKME.
ITAB-NETWR_D = ORDER-NETWR.
ITAB-WAERK_D = ORDER-WAERK.
ITAB-NAME1 = KNA1-NAME1.
COLLECT ITAB.
CLEAR: FKIMG_D,
VRKME_D,
NETWR_D,
WAERK_D.
ENDIF.
ON CHANGE OF VBRK-VKORG OR VBRK-VTWEG OR VBRK-SPART.
VKORG_H = ORDER-VKORG.
VTWEG_H = ORDER-VTWEG.
SPART_H = ORDER-SPART.
IF SY-TABIX NE 1.
NEW-PAGE.
ENDIF.
ENDON.
* get customer PO
SELECT SINGLE * FROM VBAK WHERE VBELN EQ ORDER-VBELN.
SELECT SINGLE * FROM VBAP WHERE VBELN EQ ORDER-VBELN
AND POSNR EQ ORDER-POSNR.
* get bill-to party
SELECT SINGLE * FROM VBPA WHERE VBELN EQ ORDER-VBELN
AND POSNR EQ '000000'
AND PARVW EQ 'RE'.
*get PO no.
CLEAR VBFA.
SELECT * FROM VBFA WHERE VBELV EQ ORDER-VBELN
AND POSNV EQ ORDER-POSNR
AND VBTYP_N EQ 'V'.
CLEAR EKPO.
SELECT SINGLE * FROM EKPO WHERE EBELN EQ VBFA-VBELN
AND EBELP EQ VBFA-POSNN.
CHECK EKPO-LOEKZ NE SPACE.
ENDSELECT.
IF SUMM IS INITIAL.
WRITE: /1(10) ORDER-VBELN, "SO no.
12(06) ORDER-POSNR, "SO item no.
* 19(20) vbak-bstnk, "Customer PO no.
19(10) ORDER-SHIP,
40(22) VBAP-KDMAT, "Customer Mater no.
53(17) ORDER-FKIMG UNIT ORDER-VRKME, "Deli. qty
70(3) ORDER-VRKME, "Sale unit
74(16) ORDER-UNIPR, " currency order-waerk, "Unit price
90(3) ORDER-WAERK, "Unit price currency
103(21) ORDER-NETWR CURRENCY ORDER-WAERK, "Amount of the item
124(3) ORDER-WAERK, "Currency
129(10) ORDER-INVNO, "Billing doc.
140(10) ORDER-FKDAT, "Billing date
151(10) EKPO-EBELN. "PO no.
IF NOT CUST IS INITIAL.
WRITE: 162(18) ORDER-MATNR. "Material no.
ELSEIF NOT MATNR IS INITIAL.
WRITE: 162(10) ORDER-KUNNR. "Sold-to party
ELSEIF NOT SHIP IS INITIAL.
WRITE: 162(18) ORDER-MATNR. "Material no.
ENDIF.
WRITE: 181(10) VBPA-KUNNR. "Invoice to party
CLEAR LINES. REFRESH LINES.
CLEAR INLINES. REFRESH INLINES.
CLEAR TEXT.
CONCATENATE ORDER-VBELN ORDER-POSNR INTO TEXT.
CALL FUNCTION 'READ_TEXT_INLINE'
EXPORTING
ID = '0011'
INLINE_COUNT = 10
LANGUAGE = SY-LANGU
NAME = TEXT
OBJECT = 'VBBP'
* importing
* header =
TABLES
INLINES = INLINES
LINES = LINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
OTHERS = 7.
READ TABLE LINES INDEX 1.
IF LINES-TDLINE EQ SPACE.
WRITE: 192(10) 'Sea'.
ELSE.
WRITE: 192(10) LINES-TDLINE(10).
ENDIF.
ENDIF.
WRITE: 203(04) ORDER-ZTERM.
* write: 208(10) order-zfbdt.
WRITE: 208(10) ORDER-PRCTR.
WRITE: 219(02) ORDER-KTGRD.
WRITE: 222(02) ORDER-KTGRM.
IF NOT SHIP IS INITIAL.
KUNAG_D = ORDER-SHIP.
ELSE.
KUNAG_D = ORDER-KUNNR.
ENDIF.
MATNR_D = ORDER-MATNR.
FKIMG_D = FKIMG_D + ORDER-FKIMG.
VRKME_D = ORDER-VRKME.
NETWR_D = NETWR_D + ORDER-NETWR.
WAERK_D = ORDER-WAERK.
ENDLOOP.
IF SUMM IS INITIAL.
ULINE.
CLEAR INDEX.
WRITE: /40(13) '***Subtotal'.
IF NOT CUST IS INITIAL.
LOOP AT ITAB WHERE KUNNR EQ ORDER-KUNNR.
INDEX = INDEX + 1.
IF INDEX EQ 1.
WRITE: 53(17) ITAB-FKIMG_D UNIT ITAB-VRKME_D.
ELSE.
WRITE:/53(17) ITAB-FKIMG_D UNIT ITAB-VRKME_D.
ENDIF.
WRITE: 70(3) ITAB-VRKME_D,
103(21) ITAB-NETWR_D CURRENCY ITAB-WAERK_D,
124(3) ITAB-WAERK_D.
ENDLOOP.
ELSEIF NOT MATNR IS INITIAL.
LOOP AT ITAB WHERE MATNR EQ ORDER-MATNR.
INDEX = INDEX + 1.
IF INDEX EQ 1.
WRITE: 53(17) ITAB-FKIMG_D UNIT ITAB-VRKME_D.
ELSE.
WRITE:/53(17) ITAB-FKIMG_D UNIT ITAB-VRKME_D.
ENDIF.
WRITE: 70(3) ITAB-VRKME_D,
103(21) ITAB-NETWR_D CURRENCY ITAB-WAERK_D,
124(3) ITAB-WAERK_D.
ENDLOOP.
ELSEIF NOT SHIP IS INITIAL.
LOOP AT ITAB WHERE SHIP EQ ORDER-SHIP .
INDEX = INDEX + 1.
IF INDEX EQ 1.
WRITE: 53(17) ITAB-FKIMG_D UNIT ITAB-VRKME_D.
ELSE.
WRITE:/53(17) ITAB-FKIMG_D UNIT ITAB-VRKME_D.
ENDIF.
WRITE: 70(3) ITAB-VRKME_D,
103(21) ITAB-NETWR_D CURRENCY ITAB-WAERK_D,
124(3) ITAB-WAERK_D.
ENDLOOP.
ENDIF.
ENDIF.
IF NOT CUST IS INITIAL.
ITAB-KUNNR = ORDER-KUNNR.
ENDIF.
IF NOT MATNR IS INITIAL.
ITAB-MATNR = ORDER-MATNR.
ENDIF.
IF NOT SHIP IS INITIAL.
ITAB-SHIP = ORDER-SHIP.
ENDIF.
IF SUMM IS INITIAL.
NEW-PAGE.
CLEAR: FKIMG_D, NETWR_D, VRKME_D.
ENDIF.
LOOP AT ITAB.
IF NOT CUST IS INITIAL.
SELECT SINGLE NAME1 FROM KNA1 INTO ITAB-NAME1
WHERE KUNNR EQ ITAB-KUNNR.
WRITE: /1 ITAB-KUNNR,
19 ITAB-NAME1.
ELSEIF NOT MATNR IS INITIAL.
SELECT SINGLE MAKTX FROM MAKT INTO ITAB-NAME1
WHERE MATNR EQ ITAB-MATNR
AND SPRAS EQ SY-LANGU.
WRITE: /1 ITAB-MATNR,
19 ITAB-NAME1.
ELSEIF NOT SHIP IS INITIAL.
SELECT SINGLE NAME1 FROM KNA1 INTO ITAB-NAME1
WHERE KUNNR EQ ITAB-SHIP.
WRITE: /1 ITAB-SHIP,
19 ITAB-NAME1.
ENDIF.
WRITE: 53 ITAB-FKIMG_D UNIT ITAB-VRKME_D,
70 ITAB-VRKME_D,
103 ITAB-NETWR_D CURRENCY ITAB-WAERK_D,
124 ITAB-WAERK_D.
ENDLOOP.
SKIP.
WRITE: /1 'Total:'.
CLEAR: FKIMG_D, NETWR_D.
SORT ITAB BY WAERK_D.
LOOP AT ITAB.
ON CHANGE OF ITAB-WAERK_D.
IF SY-TABIX NE 1.
WRITE: /53 FKIMG_D UNIT VRKME_D,
70 VRKME_D,
103 NETWR_D CURRENCY WAERK_D,
124 WAERK_D.
CLEAR: FKIMG_D,
NETWR_D,
VRKME_D,
WAERK_D.
ENDIF.
ENDON.
FKIMG_D = FKIMG_D + ITAB-FKIMG_D.
VRKME_D = ITAB-VRKME_D.
NETWR_D = NETWR_D + ITAB-NETWR_D.
WAERK_D = ITAB-WAERK_D.
ENDLOOP.
WRITE: /53 FKIMG_D UNIT ITAB-VRKME_D,
70 ITAB-VRKME_D,
103 NETWR_D CURRENCY ITAB-WAERK_D,
124 ITAB-WAERK_D.
TOP-OF-PAGE.
WRITE: /100 'Shipment List'.
WRITE: /80 'Sales Org:',
94 VKORG_H,
100 'Channel:',
109 VTWEG_H,
115 'Division:',
125 SPART_H.
WRITE: /90 'Date from:',
101 FKDAT-LOW,
113 'to:',
117 FKDAT-HIGH.
WRITE: /1 'Date:', 6 SY-DATUM,
210 'Page:', 216 SY-PAGNO,
/210 'User:', 216 SY-UNAME.
SKIP.
WRITE: /1(10) 'SO No.',
12(06) 'ItemNo',
* 19(20) 'Customer PO No.',
40(22) 'Customer Mater No.',
60(10) 'Deli. Qty',
* 70(3) "Sale unit
83(10) 'Unit Price',
* 90(3) konp-konwa, "Unit price currency
* 93(1) '/',
* 94(5) konp-kpein, "by
* 99(3) konp-kmein, "by unit
120(10) 'Amount',
* 124(3) vbfa-waers, "Currency
129(10) 'BillingDoc',
140(10) 'BillingDat',
151(10) 'PO no.'.
IF NOT CUST IS INITIAL.
WRITE: 162(18) 'Material No.'.
ELSEIF NOT MATNR IS INITIAL.
WRITE: 162(18) 'Customer No.'.
ELSEIF NOT SHIP IS INITIAL.
WRITE: 162(18) 'Material No.'.
ENDIF.
WRITE: 181(10) 'InvoiceTo'.
WRITE: 192(10) 'ShipMethod'.
WRITE: 203(04) 'PayT'.
* write: 208(10) 'Due Date'.
WRITE: 208(10) 'ProfitCter'.
WRITE: 219(02) 'CA'.
WRITE: 222(02) 'MA'.
WRITE: 19(10) 'ShipToPar.'.
ULINE.
*&---------------------------------------------------------------------*
*& Form CHECK_RE_ORDER
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM CHECK_RE_ORDER.
* get RE good return material doc no. only those ref. billing doc
SELECT SINGLE VBELN FROM VBFA INTO VBFA-VBELN
WHERE VBELV EQ VBRK-VBELN
AND POSNV EQ '000000'
AND POSNN EQ '000000'
AND VBTYP_N EQ 'H'. "return
IF SY-SUBRC EQ 0.
SELECT VBELN POSNN RFMNG FROM VBFA
INTO (VBFA-VBELN, VBFA-POSNN, VBFA-RFMNG)
WHERE VBELV EQ VBRK-VBELN
AND POSNV EQ '000000'
AND VBTYP_N EQ 'R'
AND BWART EQ '651'.
ORDER-FKIMG = ORDER-FKIMG - VBFA-RFMNG.
ENDSELECT.
ENDIF.
* get credit memo.
SELECT VBELN POSNN FROM VBFA INTO (VBFA-VBELN, VBFA-POSNN)
WHERE VBELV EQ VBRP-AUBEL
AND POSNV EQ VBRP-AUPOS
AND VBTYP_N EQ 'O'.
SELECT SINGLE FKSTO FKDAT INTO (VBRK-FKSTO, VBRK-FKSTO)
FROM VBRK
WHERE VBELN EQ VBFA-VBELN.
CHECK VBRK-FKSTO EQ SPACE AND VBRK-FKDAT IN FKDAT.
SELECT SINGLE NETWR FROM VBRP INTO VBRP-NETWR
WHERE VBELN EQ VBFA-VBELN
AND POSNR EQ VBFA-POSNN.
IF SY-SUBRC EQ 0.
ORDER-NETWR = ORDER-NETWR - VBRP-NETWR.
ENDIF.
ENDSELECT.
* get debit memo.
SELECT VBELN POSNN FROM VBFA INTO (VBFA-VBELN, VBFA-POSNN)
WHERE VBELV EQ VBRP-AUBEL
AND POSNV EQ VBRP-AUPOS
AND VBTYP_N EQ 'P'.
SELECT SINGLE NETWR FROM VBRP INTO VBRP-NETWR
WHERE VBELN EQ VBFA-VBELN
AND POSNR EQ VBFA-POSNN.
IF SY-SUBRC EQ 0.
ORDER-NETWR = ORDER-NETWR + VBRP-NETWR.
ENDIF.
ENDSELECT.
ENDFORM. " CHECK_RE_ORDER
*&---------------------------------------------------------------------*
*& Form GET_GI_DATA
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_GI_DATA.
ENDFORM. " GET_GI_DATA
*&---------------------------------------------------------------------*
*& Form CHK_AR_DUE_DATE
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM CHK_AR_DUE_DATE.
TABLES: BSEG.
* clear order-zfbdt.
IF VBRK-RFBSK EQ 'C'.
SELECT ZFBDT ZBD1T UP TO 1 ROWS FROM BSEG
INTO (BSEG-ZFBDT, BSEG-ZBD1T)
WHERE VBELN EQ VBRK-VBELN
AND BUKRS EQ VBRK-BUKRS.
ENDSELECT.
* order-zfbdt = bseg-zfbdt + bseg-zbd1t.
ENDIF.
ENDFORM. " CHK_AR_DUE_DATE
ZSDRM001-发货清单的更多相关文章
- ActiveReports 报表应用教程 (2)---清单类报表
在大多报表系统中都有清单类报表的身影,比如:客户清单.商品信息清单.设备清单.物品采购清单.记账凭证.货品发货清单.员工清单等等.清单类报表看视乎比较简单,但是,由清单类报表演变而来的报表类型却十分丰 ...
- x01.Excel: 合计件数
由于 VBA 与 Excel 是耦合的,所以还是先看表: 件数的计算,用 Mod 即可.但考虑到要求码洋.数量等多种需求,就该 VBA 登场了.代码如下: '===================== ...
- velocity模板引擎学习(4)-在standalone的java application中使用velocity及velocity-tools
通常velocity是配合spring mvc之类的框架在web中使用,但velocity本身其实对运行环境没有过多的限制,在单独的java application中也可以独立使用,下面演示了利用ve ...
- 【新产品发布】EVC9001 USB 隔离器
一. 简介 EVC9001采用Analog Device 公司的基于芯片级变压器的iCoupler 磁耦合隔离方案,完成了对USB接口双向隔离功能,隔离电压达 2500V(隔离电源模块 3000V隔 ...
- SimpleWiFi模块评估板
SimpleWiFi评估套件,发货清单: 1.评估版一块. 2.专用WiFi天线一根. 3.配套电源一个. 单模块 是60元,链接如下: http://item.taobao.com/i ...
- 葡萄城报表介绍:Web 报表
Web(World Wide Web)即全球广域网,也称为万维网,它是一种基于超文本和 HTTP 的.全球性的.动态交互的.跨平台的分布式图形信息系统.Web 报表是以 Web 作为信息展示平台,可以 ...
- 英语四6级CET6资料大学六级单词
ambient a.周围的,包围着的 ambiguous a.模棱两可的:分歧的 ambitious a.有雄心的:热望的 ample a.足够的:宽敞的 amplitude n.广大:充足:振幅 a ...
- 单词大学CET六四级英语
2012年大学英语六级词汇 baseball n.棒球:棒球运动 basement n.地下室:地窖:底层 basin n.内海:盆地,流域 battery n.炮兵连:兵器群 battle vi.战 ...
- Python实现电子词典(web)
思路: 准备配置文件setting.py,运行src/data.py,使用MySQL新建数据库并创建table,将字典数据导入到table中.编写server.py文件,建立服务端,循环接收web请求 ...
- Python实现电子词典(图形界面)
Python实现电子词典(图形界面) 终端电子词典:https://www.cnblogs.com/noonjuan/p/11341375.html 文件一览: .├── client.py├── d ...
随机推荐
- uva 1210
#include<iostream> #include<cstring> using namespace std; + ; bool notprime[MAXN];//值为fa ...
- 二模 (7) day1
第一题: 题目大意: 给出数轴上N棵树的坐标和高度,如果两棵树之间的距离小于其中一颗树的高度,那么就有树会被挡住.因此要把一些树砍矮一点.求砍树的总高度最小值. N<=100000; 解题过程: ...
- [转] C中的位域
一.位域 有些信息在存储时,并不需要占用一个完整的字节, 而只需占几个或一个二进制位.例如在存放一个开关量时,只有0和1 两种状态, 用一位二进位即可.为了节省存储空间,并使处理简便,C语言又提供了一 ...
- AlarmManager
转自:http://blog.csdn.net/wangxingwu_314/article/details/8060312 1.AlarmManager,顾名思义,就是“提醒”,是Android中常 ...
- ubuntu文件夹右键没有共享选项
在配置samba的时候,不知道出了什么错误,我就删除了samba,之后在ubuntu文件上按右键就没有共享的选项了,这样每次配置都得进samba麻烦. 我重新安装了samba也不行,郁闷! 解决: 1 ...
- 数据库类II
<!DOCTYPE html> <html> <head> <title></title> </head> <body&g ...
- js实现图片预显示
html页面代码 <div id="localImag" style="display:none"><img id="previe ...
- Unity3D入门(一):环境搭建
1.Unity3D 目前最新正式版本是4.2.1f 官网下载,以前的版本安装时候需要序列号激活,新版本4.2.1f 不需要,完全免费,但发布的时候需要许可证 2.要学习的同学,下载频道可以找到破解补 ...
- Android自定义View绘图实现拖影动画
前几天在"Android绘图之渐隐动画"一文中通过画线实现了渐隐动画,但里面有个问题,画笔较粗(大于1)时线段之间会有裂隙,我又改进了一下.这次效果好多了. 先看效果吧: 然后我们 ...
- ZOJ2006 (最小表示法)
var s:ansistring; cas:longint; function minp(st,len:longint):longint; var p1,p2,k,tmp:longint; begin ...