PROGRAM YLSDM004.
TABLES: LTAP, "Transfer order item
LIPS, "SD doc delivery: item data
MAKT, "material description
VEPO, "SD Document: Shipping Unit Item
VEKP, "SD Document: Shipping Unit Header
USR01, "USER defaults
ZPACKMAT, "Packing material table
T646M, "hazard class descriptions
ZCASHAZLAB. "SCasehazardous label table
DATA: OK_CODE(4).
DATA: C LIKE SY-INDEX, " cursor for case labels
* C1 LIKE SY-INDEX, " cursor for storage class(haz)
C2 LIKE SY-INDEX. " cursor for text
* screen fields for selection screen 0100
DATA: S_ZZTRACKING LIKE LTAP-ZZTRACKING,
* S_VENUM LIKE VEKP-VENUM,
S_EXIDV LIKE VEKP-EXIDV.
*
DATA W_MAKTX LIKE MAKT-MAKTX.
* packaging materials
DATA: S_PACKMAT1 LIKE VEKP-ZZPACKMAT1,
S_BEZEI1 LIKE ZPACKMAT-BEZEI,
S_PACKMAT2 LIKE VEKP-ZZPACKMAT1,
S_BEZEI2 LIKE ZPACKMAT-BEZEI.
* Case label codes and descriptions
DATA: BEGIN OF LABELS OCCURS 5 ,
CODE LIKE VEKP-ZZCASELAB1,
TEXT LIKE ZCASHAZLAB-ZZCLB_TEXT,
END OF LABELS.
* hazard class and descriptions
DATA: BEGIN OF HAZ OCCURS 3,
CODE LIKE VEKP-ZZLAGKL,
TEXT LIKE T646M-LAGKT,
END OF HAZ.
DATA: W_HAZ_TEXT1 LIKE T646M-LAGKT,
W_HAZ_TEXT2 LIKE T646M-LAGKT,
W_HAZ_TEXT3 LIKE T646M-LAGKT.
DATA T_LINES LIKE TLINE OCCURS 1 WITH HEADER LINE.
DATA T_HEADER LIKE THEAD.
*DATA W_INDEX LIKE SY-INDEX.
* start line of the last screen of text lines
DATA W_MAX LIKE SY-INDEX.
DATA W_TIN_MAKTX LIKE MAKT-MAKTX.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* selection screen *
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
CASE OK_CODE.
WHEN 'EXIT'. LEAVE TO SCREEN 0.
WHEN 'CANC'.
SELECT SINGLE * FROM USR01
WHERE BNAME = SY-UNAME .
LEAVE TO TRANSACTION USR01-STCOD.
ENDCASE.
SET PF-STATUS 'SELECT'.
CLEAR: VEKP,
LTAP.
SET TITLEBAR 'SEL'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
C2 = 0.
* Mandatory Fields
CHECK OK_CODE = 'EXEC'.
*
CALL SCREEN '0110'.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Module VAL_ZZTRACKING INPUT
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
MODULE VAL_ZZTRACKING INPUT.
* MUST enter at least one value
* IF S_ZZTRACKING = ' ' AND S_VENUM = ' ' AND S_EXIDV = ' '.
IF S_ZZTRACKING = ' ' AND S_EXIDV = ' '.
MESSAGE E001(YL).
ENDIF.
* if tracking label entered other fields must be initial
IF S_ZZTRACKING NE ' '
* AND ( S_VENUM NE ' ' OR S_EXIDV NE ' ' ).
AND S_EXIDV NE ' ' .
MESSAGE E083(YL).
ENDIF.
* if tracking label number entered get record from LTAP
IF S_ZZTRACKING NE ' '.
SELECT SINGLE * FROM LTAP
WHERE ZZTRACKING = S_ZZTRACKING.
IF SY-SUBRC NE 0.
MESSAGE E022(YL) WITH S_ZZTRACKING.
ELSE.
*--------------------------------------------------------------------
*
* IF LTAP-VENUM NE ' '.
*
* SELECT SINGLE * FROM VEKP
* WHERE VENUM = LTAP-VENUM .
*
IF LTAP-EXIDV NE ' '.
SELECT SINGLE * FROM VEKP
WHERE EXIDV = LTAP-EXIDV .
*---------------------------------------------------------------------
IF SY-SUBRC NE 0.
MESSAGE E022(YL) WITH LTAP-EXIDV.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDMODULE. " VAL_ZZTRACKING INPUT
*&---------------------------------------------------------------------*
*& Module VAL_VENUM INPUT
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
*MODULE VAL_VENUM INPUT.
* SET CURSOR FIELD S_VENUM.
* IF S_VENUM NE ' '
* AND S_EXIDV NE ' '.
* MESSAGE E083(YL).
* ENDIF.
* IF S_VENUM NE ' '.
*
* SELECT SINGLE * FROM VEKP
* WHERE VENUM = S_VENUM.
* IF SY-SUBRC NE 0.
* MESSAGE E022(YL) WITH S_VENUM.
* ENDIF.
* ENDIF.
*ENDMODULE. " VAL_VENUM INPUT
*&---------------------------------------------------------------------*
*& Module EXIT_COMMAND INPUT
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
MODULE EXIT_COMMAND INPUT.
CASE OK_CODE.
WHEN 'EXIT'. LEAVE TO SCREEN 0.
WHEN 'CANC'.
SELECT SINGLE * FROM USR01
WHERE BNAME = SY-UNAME .
LEAVE TO TRANSACTION USR01-STCOD.
WHEN 'BACK'. LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " EXIT_COMMAND INPUT
*&---------------------------------------------------------------------*
*& Module VAL_EXIDV INPUT
*&---------------------------------------------------------------------*
* validate external shipping unit number exits on VEKP *
*----------------------------------------------------------------------*
MODULE VAL_EXIDV INPUT.
IF S_EXIDV NE ' '.
CONCATENATE '00' S_EXIDV INTO VEKP-EXIDV.
SELECT SINGLE * FROM VEKP
WHERE EXIDV = VEKP-EXIDV.
IF SY-SUBRC NE 0.
MESSAGE E022(YL) WITH S_EXIDV.
ENDIF.
ENDIF.
ENDMODULE. " VAL_EXIDV INPUT
*&---------------------------------------------------------------------*
*& Module STATUS_0110 OUTPUT
*&---------------------------------------------------------------------*
* Display screen *
*----------------------------------------------------------------------*
MODULE STATUS_0110 OUTPUT.
IF OK_CODE = 'P+ ' OR OK_CODE = 'P- ' OR OK_CODE = 'P++ '
OR OK_CODE = 'P-- '.
EXIT.
ENDIF.
IF VEKP-VENUM = ' '.
* processing mode b
PERFORM DISP_DELIVERY.
ELSE.
* processing mode a
PERFORM DISP_SHIP_UNIT.
ENDIF.
* common processing
* get mara details
CLEAR MAKT.
*SELECT SINGLE * FROM MARA
* WHERE MATNR = LIPS-MATNR .
*IF SY-SUBRC = 0.
* material description
SELECT SINGLE * FROM MAKT
WHERE MATNR = LIPS-MATNR
AND SPRAS = SY-LANGU .
DATA W_TDNAME LIKE THEAD-TDNAME.
W_TDNAME = LIPS-VBELN.
W_TDNAME+10 = LIPS-POSNR.
CLEAR T_LINES.
REFRESH T_LINES.
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = 'Z034'
LANGUAGE = SY-LANGU
NAME = W_TDNAME
OBJECT = 'VBBP'
IMPORTING
HEADER = T_HEADER
TABLES
LINES = T_LINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
LOOP AT T_LINES.
EXIT.
ENDLOOP.
IF SY-TFILL > 1.
* W_MAX = SY-TFILL - 5.
W_MAX = SY-TFILL - 1.
ELSE.
W_MAX = 1.
ENDIF.
*
IF W_MAX > 3 .
SET PF-STATUS 'DELIVERY'.
ELSE.
SET PF-STATUS 'ONE'.
ENDIF.
ENDMODULE. " STATUS_0110 OUTPUT
*&---------------------------------------------------------------------*
*& Form DISP_DELIVERY
*&---------------------------------------------------------------------*
* Diplay delivery title - Read delivery item from LIPS
* processing mode B
*----------------------------------------------------------------------*
FORM DISP_DELIVERY.
* SET PF-STATUS 'DELIVERY'.
SET TITLEBAR 'DEL'.
CLEAR LIPS.
SELECT SINGLE * FROM LIPS
WHERE VBELN = LTAP-VBELN_VL
AND POSNR = LTAP-POSNR_VL .
ENDFORM. " DISP_DELIVERY
*&---------------------------------------------------------------------*
*& Form DISP_SHIP_UNIT
*&---------------------------------------------------------------------*
* Display Shipping unit title and read shipping details
*----------------------------------------------------------------------*
* Processing MODE a
*----------------------------------------------------------------------*
FORM DISP_SHIP_UNIT.
* SET PF-STATUS 'DELIVERY'.
SET TITLEBAR 'SHP'.
* vekp already read
* read vepo
* only one line per case
CLEAR VEPO.
CLEAR LIPS.
CLEAR W_MAKTX.
CLEAR W_TIN_MAKTX.
CLEAR ZPACKMAT.
CLEAR S_PACKMAT1.
CLEAR S_PACKMAT2.
CLEAR S_BEZEI1.
CLEAR S_BEZEI2.
CLEAR LABELS.
REFRESH LABELS.
SELECT SINGLE * FROM VEPO
WHERE VENUM = VEKP-VENUM.
IF SY-SUBRC = 0.
SELECT SINGLE * FROM LIPS
WHERE VBELN = VEPO-VBELN
AND POSNR = VEPO-POSNR .
ENDIF.
* packaging material
IF VEKP-ZZPACKMAT1 NE ' '.
SELECT SINGLE * FROM ZPACKMAT
WHERE ZZPACKMAT = VEKP-ZZPACKMAT1.
IF SY-SUBRC = 0.
S_PACKMAT1 = VEKP-ZZPACKMAT1.
S_BEZEI1 = ZPACKMAT-BEZEI.
ENDIF.
ENDIF.
IF VEKP-ZZPACKMAT2 NE ' '.
SELECT SINGLE * FROM ZPACKMAT
WHERE ZZPACKMAT = VEKP-ZZPACKMAT2.
IF SY-SUBRC = 0.
S_PACKMAT2 = VEKP-ZZPACKMAT2.
S_BEZEI2 = ZPACKMAT-BEZEI.
ENDIF.
ENDIF.
* hazard class x 3
CLEAR: W_HAZ_TEXT1, W_HAZ_TEXT2, W_HAZ_TEXT3.
* REFRESH HAZ.
IF VEKP-ZZLAGKL NE ' '.
* HAZ-CODE = VEKP-ZZLAGKL.
SELECT SINGLE * FROM T646M
WHERE SPRAS = SY-LANGU
AND LAGKL = VEKP-ZZLAGKL .
IF SY-SUBRC = 0.
W_HAZ_TEXT1 = T646M-LAGKT.
ENDIF.
* APPEND HAZ.
ENDIF.
IF VEKP-ZZLAGKL2 NE ' '.
* HAZ-CODE = VEKP-ZZLAGKL2.
SELECT SINGLE * FROM T646M
WHERE SPRAS = SY-LANGU
AND LAGKL = VEKP-ZZLAGKL2 .
IF SY-SUBRC = 0.
W_HAZ_TEXT2 = T646M-LAGKT.
ENDIF.
* APPEND HAZ.
ENDIF.
IF VEKP-ZZLAGKL3 NE ' '.
* CLEAR HAZ.
* HAZ-CODE = VEKP-ZZLAGKL3.
SELECT SINGLE * FROM T646M
WHERE SPRAS = SY-LANGU
AND LAGKL = VEKP-ZZLAGKL3 .
IF SY-SUBRC = 0.
W_HAZ_TEXT3 = T646M-LAGKT.
ENDIF.
* APPEND HAZ.
ENDIF.
* LOOP AT HAZ.
* EXIT.
* ENDLOOP.
* case label details
IF VEKP-ZZCASELAB1 NE ' '.
LABELS-CODE = VEKP-ZZCASELAB1.
APPEND LABELS.
ENDIF.
IF VEKP-ZZCASELAB2 NE ' '.
LABELS-CODE = VEKP-ZZCASELAB2.
APPEND LABELS.
ENDIF.
IF VEKP-ZZCASELAB3 NE ' '.
LABELS-CODE = VEKP-ZZCASELAB3.
APPEND LABELS.
ENDIF.
IF VEKP-ZZCASELAB4 NE ' '.
LABELS-CODE = VEKP-ZZCASELAB4.
APPEND LABELS.
ENDIF.
IF VEKP-ZZCASELAB5 NE ' '.
LABELS-CODE = VEKP-ZZCASELAB5.
APPEND LABELS.
ENDIF.
LOOP AT LABELS.
SELECT SINGLE * FROM ZCASHAZLAB
WHERE ZZCASELAB = LABELS-CODE .
LABELS-TEXT = ZCASHAZLAB-ZZCLB_TEXT.
MODIFY LABELS.
ENDLOOP.
* tin material description
IF VEPO-ZZTINNR NE ' '.
SELECT SINGLE * FROM MAKT
WHERE MATNR = VEPO-ZZTINNR
AND SPRAS = SY-LANGU .
IF SY-SUBRC = 0.
W_TIN_MAKTX = MAKT-MAKTX.
ENDIF.
ENDIF.
* case material description
IF VEKP-VHILM NE ' '.
SELECT SINGLE * FROM MAKT
WHERE MATNR = VEKP-VHILM
AND SPRAS = SY-LANGU .
IF SY-SUBRC = 0.
W_MAKTX = MAKT-MAKTX.
ENDIF.
ENDIF.
ENDFORM. " DISP_SHIP_UNIT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0110 INPUT
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0110 INPUT.
* position text line cursor
CASE OK_CODE.
WHEN 'P+ '.
C2 = C2 + 3.
IF C2 > W_MAX.
C2 = W_MAX.
ENDIF.
WHEN 'P- '.
C2 = C2 - 3.
IF C2 < 1.
C2 = 1.
ENDIF.
WHEN 'P++ '.
C2 = W_MAX.
WHEN 'P-- '.
C2 = 1.
WHEN 'VL02'.
SET PARAMETER ID 'VL ' FIELD LIPS-VBELN.
CALL TRANSACTION 'VL02'.
ENDCASE.
ENDMODULE. " USER_COMMAND_0110 INPUT
Tuesday, May 6, 2008
Sample ABAP Program for Module Pool containing screen loop processing
Labels:
Sample ABAP Code Programs
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2008
(300)
-
▼
May
(80)
- Object oriented programming (OOP) All Steps
- Object oriented programming (OOP) Step2
- Object oriented programming (OOP) Step-by-step
- Object oriented programming (OOP) explained with a...
- Interview Question on BAPI, RFC, ABAP Objects, Tables
- The Other 50 ABAP Interview Faq's
- More than 100 ABAP Interview Faq's
- Events in Report
- Example: The IDoc Type ORDERS01
- Program for Outbound IDOC
- Basic Configuration in IDOC
- Sample ABAP Program to Upload table using new func...
- Sample ABAP Program for Submitting report with sel...
- Sample ABAP Program for Submitting report with sel...
- Sample ABAP Program for Sending SAP Mail
- Sample ABAP Program for Search Layout sets for giv...
- Sample ABAP Program for Sapscript PerForm Module
- Sample ABAP Program for Create IDOC
- Sample ABAP Program for Output file to application...
- Sample ABAP Program for Module Pool Skeleton
- Sample ABAP Program for Module Pool containing scr...
- Sample ABAP Program for MB1B Call Transaction
- Sample ABAP Program of Function Module to Convert ...
- Sample ABAP Program of FTP Function Module
- Sample ABAP Program to EXPORT LIST TO MEMORY
- Sample ABAP Program to Execute Unix command from w...
- Sample ABAP Program to Get Output in EXCEL
- Sample ABAP Program to Implement EDI
- Sample Program to dynamically change upload/downlo...
- Sample ABAP Program to download table using new fu...
- Sample ABAP Program to Download file to Presentati...
- Sample ABAP Program to display pop message to avoi...
- Sample ABAP Program of ALV Grid
- Sample ABAP Program of Dialogue Module Pool
- Sample ABAP Program to DIALOGUE FLOW LOGIC
- Sample ABAP Program to Delete a file from the appl...
- Sample ABAP Program to Compare to Unix or PC files...
- Sample ABAP Program to Colour cells in ALV
- Sample ABAP Program to Calculate difference betwee...
- Sample ABAP Program of BW User Exit
- Sample SAP ABAP Program to Browse a file on the ap...
- Sample SAP ABAP Program of ALV Grid control using ...
- SE30 - Runtime Analysis Tool
- List of System fields
- Write a report that displays the text 'Hello world...
- HR (Human Resource) Tutorials Free downloads
- FI (Financial) Tutorials Free downloads
- PM (Plant Maintenance) Tutorials Free downloads
- WM (Warehouse Management) Tutorials Free downloads
- QM (Quality Management) Tutorials Free downloads
- PP (Production Planning) Tutorials Free downloads
- SD (Sales and Distribution) Tutorials Free downloads
- MM (Material Management) Tutorials Free downloads
- IDOC INTRODUCTION & STRUCTURE
- Step-by-Step Guide for using LSMW to Update Custom...
- LIST of TABLES
- Transporting Objects and Standard Text from one cl...
- SAP R/3 INTERVIEW ARCHITECTURE QUESTIONS
- SAP TRANSACTIONS INTERVIEW QUESTIONS
- SAP MODULARIZATION INTERVIEW QUESTIONS
- SAP LOGICAL DATABASE INTERVIEW QUESTIONS
- SAP R/3 DATA DICTIONARY INTERVIEW QUESTIONS
- SAP BDC INTERVIEW QUESTIONS & ANSWERS
- SAP ABAP MENU PAINTER & SCREEN PAINTER Tutorials
- SAP ABAP WORKFLOW Tutorials PDF Free downloads
- SAP ABAP ITS Tutorials PDF Free downloads
- SAP ABAP EDI Tutorials PDF Free downloads
- SAP ABAP BAPI Tutorials PDF Free downloads
- SAP ABAP Change&Transport System Tutorials PDF Fre...
- SAP ABAP OBJECTS Tutorials PDF Free downloads
- SAP ABAP USER EXITS Tutorials PDF Free downloads
- SAP ABAP ALE Tutorials PDF Free downloads
- SAP ABAP IDOC Tutorials PDF Free downloads
- SAP ABAP LSMW Tutorials PDF Free downloads
- SAP ABAP BDC (Batch Data Communication) Tutorials ...
- SAP ABAP SAPSCRIPTS Tutorials Free downloads
- ALV Grid free download
- SAP ABAP INTERACTIVE REPORTING FAQs
- SAP ABAP REPORTING GENERAL
- SAP REPORTS FAQ
-
▼
May
(80)
No comments:
Post a Comment