*&---------------------------------------------------------------------*
*& Report ZVVF_MR025_WEIGHBRIDGE_SD *
*&---------------------------------------------------------------------*
REPORT ZVVF_MR025_WEIGHBRIDGE_SD no standard page heading line-size
110 MESSAGE-ID ZMM .
*----------------------------------------------------------------------
** Module Sales *
*----------------------------------------------------------------------
** Objective: Down load text file with OBDs for weighbridge
** Program : Updates tables (X) Download data (X)
** Output Lists () ALV
**
** Technical Spec No : VVF_TS08_MM025_WBSD_DOWNLOADFILE_V1.0
** Date Created :
** Author :
** Location :
**---------------------------------------------------------------------*
* External Dependencies
**---------------------------------------------------------------------*
*
**---------------------------------------------------------------------*
* Amendment History
**---------------------------------------------------------------------*
* Who Change ID Reason
*** ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*---------------------------------------------------------------------**
*---------------------------------------------------------------------*
**TABLES :
*---------------------------------------------------------------------*
TABLES : ZVVF_MT25_OUTMOV, "Weigh Bridge Down Loaded Details
LIKP, " SD Document: Delivery Header Data
VBUK, " Sales Document: Header Status and Administrative Data
MVKE. " Sales Data for Material
*---------------------------------------------------------------------*
**TYPES :
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
**DATA :
*---------------------------------------------------------------------*
DATA: W_FILENAME TYPE STRING,
w_UNIXFN TYPE STRING.
*---------------------------------------------------------------------*
**CONSTANTS :
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
**INTERNAL TABLES :
*---------------------------------------------------------------------*
DATA : IT_LIPS TYPE TABLE OF ZVVF_MT25_OUTMOV WITH HEADER LINE,
begin of it_vbeln occurs 0,
werks like lips-werks,
vbeln like lips-vbeln,
end of it_vbeln.
*---------------------------------------------------------------------*
**WORK AREAS:
*---------------------------------------------------------------------*
DATA : WA_LIPS LIKE LINE OF IT_LIPS,
w_input like lips-vbeln .
*---------------------------------------------------------------------*
**INITIALIZATION :
*---------------------------------------------------------------------*
INITIALIZATION.
*---------------------------------------------------------------------*
**SELECTION-SCREEN :
*---------------------------------------------------------------------*
SELECTION-SCREEN:BEGIN OF BLOCK BL1 WITH FRAME .
PARAMETER: pr_werks LIKE t001w-werks obligatory.
SELECT-OPTIONS: so_vbeln for ZVVF_MT25_OUTMOV-VBELN .
SELECT-OPTIONS: so_DATE for LIKP-ERDAT obligatory.
PARAMETER: pr_path type zfile obligatory.
SELECTION-SCREEN END OF BLOCK BL1.
*---------------------------------------------------------------------*
**AT SELECTION-SCREEN :
*---------------------------------------------------------------------*
AT SELECTION-SCREEN.
perform format_change using so_vbeln-low.
modify so_vbeln index 1 transporting low.
if not so_vbeln-high is initial.
perform format_change using so_vbeln-high.
modify so_vbeln index 1 transporting high.
endif.
*---------------------------------------------------------------------*
**START-OF-SELECTION :
*---------------------------------------------------------------------*
START-OF-SELECTION.
SELECT LIPS~VBELN
LIPS~POSNR
LIPS~MATNR
LIPS~WERKS
LIPS~MEINS
LIPS~LFIMG
LIPS~CHARG
INTO CORRESPONDING FIELDS OF TABLE IT_LIPS
FROM LIPS INNER JOIN LIKP ON
LIPS~VBELN = LIKP~VBELN
INNER JOIN VBUK ON
LIPS~VBELN = VBUK~VBELN
INNER JOIN MVKE ON
LIPS~MATNR = MVKE~MATNR
WHERE LIPS~VBELN in so_VBELN AND
LIKP~ERDAT IN SO_DATE AND
LIPS~WERKS = pr_werks and
VBUK~WBSTK ne 'C' AND
MVKE~MVGR3 = 'BLK' and
LIPS~charg ne ' '.
IF SY-SUBRC = 0.
delete adjacent duplicates from it_lips comparing vbeln.
loop at it_lips into wa_lips.
select single vbeln from ZVVF_MT25_OUTMOV into ZVVF_MT25_OUTMOV-VBELN
where vbeln = wa_lips-vbeln and
werks = wa_lips-werks and
zpost = 'X'.
if sy-subrc ne 0 .
it_vbeln-vbeln = wa_lips-vbeln.
it_vbeln-werks = wa_lips-werks.
append it_vbeln.
modify ZVVF_MT25_OUTMOV from wa_lips.
endif.
endloop.
delete adjacent duplicates from it_vbeln comparing vbeln werks.
if not it_vbeln[] is initial.
CONCATENATE pr_path '/' wa_lips-werks '.txt' INTO w_UNIXFN .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = w_UNIXFN
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = ','
TABLES
DATA_TAB = it_vbeln.
IF SY-SUBRC <> 0.
MESSAGE E126.
ENDIF.
if sy-subrc = 0.
loop at it_vbeln.
UPDATE ZVVF_MT25_OUTMOV SET zpost = 'X'
zdate = sy-datum
where vbeln = it_vbeln-vbeln and
werks = it_vbeln-werks.
endloop.
FORMAT COLOR = 5.
Write : /2 'File' , 7 wa_lips-werks , 12 'Uploaded to Path', 29
pr_path.
FORMAT COLOR OFF.
skip 1.
write : / 'Downloaded OBDs Are :' .
skip 1.
loop at it_vbeln.
write : /2 it_vbeln-vbeln, 14 it_vbeln-werks.
endloop.
*message s125 with W_FILENAME c_path.
endif.
else.
message e127.
endif.
ELSE.
MESSAGE E026.
ENDIF.
form format_change using w_input.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = w_input
IMPORTING
OUTPUT = w_input.
endform.
No comments:
Post a Comment