*----------------------------------------------------------------------*
* Contract Renewal Details *
*----------------------------------------------------------------------*
************************************************************************
* Description: The contract details of the customers in a particular *
* sales area are displayed. This report is run to view the *
* * contract details existing *
* Author : M.Praveen kumar *
* Date : 18 March 2005 *
* *
*----------------------------------------------------------------------*
* Change No | Date | Details | Req No *
*----------------------------------------------------------------------*
* CR-102 | 18/03/05 | Original Version | PRDK90011*
* | | | *
************************************************************************
REPORT zadi_sd_contractalv NO STANDARD PAGE HEADING
LINE-COUNT 45(2) LINE-SIZE 130
MESSAGE-ID ymessage.
**********************Type Pool Declaration for ALV********************
TYPE-POOLS: slis.
********************Table Declaration**********************************
TABLES: vbak,vbfa,veda.
*********************Declaring Data Objects****************************
DATA: BEGIN OF lt_sd_c1 OCCURS 0,
vbeln LIKE vbak-vbeln, "Sales Document Number
vbelv LIKE vbfa-vbelv, "Preceding Sales and Distribution Doc
kunnr LIKE vbak-kunnr, "Customer Number
END OF lt_sd_c1.
*data: Lt_Sd_C2 like veda occurs 0 with header line.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv, "ALV Catalog Table
gs_fieldcat TYPE slis_fieldcat_alv. "ALV Catalog Structure
DATA: BEGIN OF lt_sd_c2 OCCURS 0,
vbeln LIKE veda-vbeln, "Sales Document Number
vlaufz LIKE veda-vlaufz, "Validity Period of Contract
vuntdat LIKE veda-vuntdat, "Date on which Contract was Signed
vbegdat LIKE veda-vbegdat, "Contract Start Date
venddat LIKE veda-venddat, "Contract End Date
END OF lt_sd_c2.
*****************************Selection Screen***************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-101.
SELECT-OPTIONS: s_vkorg FOR vbak-vkorg OBLIGATORY,"Sales organization.
s_vtweg FOR vbak-vtweg, "Distribution channel.
s_spart FOR vbak-spart, "Division.
s_kunnr FOR vbak-kunnr, "Customer number
p_dat FOR sy-datum."Date=current date
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK c1 WITH FRAME TITLE text-100.
PARAMETERS list RADIOBUTTON GROUP radi.
PARAMETERS alv RADIOBUTTON GROUP radi.
SELECTION-SCREEN END OF BLOCK c1.
*****************Validation of Selection Screen Fields******************
AT SELECTION-SCREEN.
SELECT SINGLE vkorg FROM tvko INTO vbak-vkorg WHERE vkorg IN s_vkorg.
IF sy-subrc <> 0.
MESSAGE e002.
ENDIF.
SELECT SINGLE vtweg FROM tvkov INTO vbak-vtweg WHERE vtweg IN s_vtweg.
IF sy-subrc <> 0.
MESSAGE e004.
ENDIF.
SELECT SINGLE spart FROM tspa INTO vbak-spart WHERE spart IN s_spart.
IF sy-subrc <> 0.
MESSAGE e006.
ENDIF.
SELECT SINGLE kunnr FROM kna1 INTO vbak-kunnr WHERE kunnr IN s_kunnr.
IF sy-subrc <> 0.
MESSAGE e007.
ENDIF.
*********************************Data Fetching**************************
START-OF-SELECTION.
SELECT a~vbeln a~kunnr b~vbelv
FROM vbak AS a INNER JOIN vbfa AS b
ON a~vbeln = b~vbeln
INTO CORRESPONDING FIELDS OF TABLE lt_sd_c1
WHERE vkorg IN s_vkorg
AND vtweg IN s_vtweg
AND spart IN s_spart
AND kunnr IN s_kunnr.
IF NOT lt_sd_c1[] IS INITIAL.
SELECT vbeln vlaufz vuntdat vbegdat venddat
FROM veda INTO CORRESPONDING FIELDS OF TABLE lt_sd_c2
FOR ALL ENTRIES IN lt_sd_c1
WHERE vbeln = lt_sd_c1-vbelv
AND venddat = p_dat.
ELSE.
MESSAGE i005.
EXIT.
ENDIF.
END-OF-SELECTION.
*******************************Display of Data**************************
IF list = 'X'.
LOOP AT lt_sd_c2.
WRITE:/0 sy-vline,
lt_sd_c2-vbeln UNDER 'SALES DOCUMENT', 16 sy-vline,
lt_sd_c2-vuntdat UNDER 'CONTRACT SINGED DATE', 42 sy-vline,
lt_sd_c2-vbegdat UNDER 'CONTRACT START DATE', 65 sy-vline,
lt_sd_c2-venddat UNDER 'CONTRACT END DATE' COLOR 6, 100 sy-vline,
lt_sd_c2-vlaufz UNDER 'VALIDITY PERIOD OF CONTRACT', 130 sy-vline.
ENDLOOP.
ULINE.
ELSE.
**************Calling a subroutine for Field display in ALV*************
PERFORM built_field_catalog.
*************Calling fucntion module for ALV****************************
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_background_id = 'ALV_BACKGROUND'
i_grid_title = 'Contract Details'
* i_structure_name = 'veda'
it_fieldcat = gt_fieldcat[]
TABLES
t_outtab = lt_sd_c2.
ENDIF.
**************************Header for the page***************************
TOP-OF-PAGE.
WRITE:/ 'CREATED BY : ', sy-uname,
102 'CREATED ON :', sy-datum,
/1(130) sy-uline .
WRITE:/ sy-vline, 50 ' CONTRACT DETAILS ' COLOR 5,
111 'Page No:',
sy-pagno,
130 sy-vline.
ULINE.
WRITE:/0 sy-vline,
2 'SALES DOCUMENT' COLOR 3,16 sy-vline,
20 'CONTRACT SIGNED DATE' COLOR 3, 42 sy-vline,
45 'CONTRACT START DATE' COLOR 3, 65 sy-vline,
75 'CONTRACT END DATE' COLOR 3, 100 sy-vline,
102 'VALIDITY PERIOD OF CONTRACT' COLOR 3, 130 sy-vline.
ULINE.
*&---------------------------------------------------------------------*
*& Form built_field_catalog
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM built_field_catalog.
gs_fieldcat-col_pos = '1'.
gs_fieldcat-fieldname = 'VBELN'.
gs_fieldcat-outputlen = 30.
gs_fieldcat-seltext_l = 'SALES DOCUMENT NUMBER'.
APPEND gs_fieldcat TO gt_fieldcat.
gs_fieldcat-col_pos = '2'.
gs_fieldcat-fieldname = 'VLAUFZ'.
gs_fieldcat-outputlen = 9.
gs_fieldcat-seltext_l = 'VALIDITY'.
APPEND gs_fieldcat TO gt_fieldcat.
gs_fieldcat-col_pos = '3'.
gs_fieldcat-fieldname = 'VUNTDAT'.
gs_fieldcat-outputlen = 12.
gs_fieldcat-seltext_l = 'SIGNED DATE'.
APPEND gs_fieldcat TO gt_fieldcat.
gs_fieldcat-col_pos = '4'.
gs_fieldcat-fieldname = 'VBEGDAT'.
gs_fieldcat-outputlen = 12.
gs_fieldcat-seltext_l = 'START DATE'.
APPEND gs_fieldcat TO gt_fieldcat.
gs_fieldcat-col_pos = '5'.
gs_fieldcat-fieldname = 'VENDDAT'.
gs_fieldcat-outputlen = 12.
gs_fieldcat-seltext_l = 'END DATE'.
APPEND gs_fieldcat TO gt_fieldcat.
ENDFORM.
Saturday, March 1, 2008
ALV Example: Contract Renewal Details
Posted by Unknown at 3:43 AM
Labels: ABAP Programming
Subscribe to:
Post Comments (Atom)
Content
-
►
2009
(2)
- ► 09/06 - 09/13 (1)
- ► 03/01 - 03/08 (1)
-
▼
2008
(207)
- ► 11/23 - 11/30 (1)
- ► 04/20 - 04/27 (70)
- ► 04/13 - 04/20 (51)
- ► 03/16 - 03/23 (44)
-
▼
02/24 - 03/02
(9)
- ALV Example: Contract Renewal Details
- An ALV Related Simple Example Code
- ALV Sample Code
- ALV Sample ABAP Code - Group
- A Simple ABAP ALV LIST VIEWER Example
- Definition and a Program on ALV
- SAP Transaction Code For Graphical Structure Maint...
- SAP Transaction Code For Maintain Workflow Template
- SAP Transaction Code For Maintain Workflow Task (C...
- ► 02/17 - 02/24 (32)
No comments:
Post a Comment