Powered By

Free XML Skins for Blogger

Powered by Blogger

Wednesday, October 1, 2008

ABAP ALV WITH POV SAMPLE CODE

****EXECUTABLE PROGRAM ON ALV****

REPORT Y_MALVPOV .
****TABLE WORK AREA
TABLES:KNA1,VBAK.

***SELECTION SCREEN***

PARAMETERS:P_KUNNR LIKE KNA1-KUNNR DEFAULT 1001.

SELECT-OPTIONS:S_VBELN FOR VBAK-VBELN.
****DEFINE INTERNAL TABLE***
DATA:BEGIN OF IT_ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
END OF IT_ITAB.

***DEFINE INTERNAL TABLE WITH HEADER LINE****

DATA:IT_JTAB LIKE VBAK OCCURS 0 WITH HEADER LINE.

****PROVIDE TYPE GROUP***

TYPE-POOLS:SLIS.

***MAINTAIN REPORT ID***

DATA:REPID LIKE SY-REPID,

****DEFINE COLUMN HEADING****

VBAK_B TYPE SLIS_T_FIELDCAT_ALV,

****EVENT***

EVENTS_B TYPE SLIS_T_EVENT.

****VARIABLE FOR STORING VALUE***
DATA:IDEX TYPE I.

***FUNCTION MODULE COLUMN HEADINGS****

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING
I_STRUCTURE_NAME = 'VBAK'

CHANGING
Ct_fieldcat = VBAK_B.

****REPORT ID SYSTEM VARIABLE****
REPID = SY-REPID.

****AT SELECTION SCREEN ****

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_VBELN-LOW.

*****FUNCTION MODULE FOR ADDING ZEROS AND DELETING THE ZEROS***

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING
input = P_KUNNR

IMPORTING
OUTPUT = P_KUNNR.
****SELECT STATEMENT FOR OUTPUT DISPLAY***

SELECT VBELN FROM VBAK INTO TABLE IT_ITAB.

****FUNCTION MODULE FOR OUPUT DISPLAY***

CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

EXPORTING
endpos_col = 30
endpos_row = 30
startpos_col = 10
startpos_row = 10
titletext = 'SALES DETAILS'

IMPORTING
CHOISE = IDEX
tables
valuetab = IT_ITAB.

READ TABLE IT_ITAB INDEX IDEX.
S_VBELN-LOW = IT_ITAB-VBELN.

IF SY-SUBRC <> 0.
LEAVE.

ENDIF.

****START-OF-SELECTION EVENT***
START-OF-SELECTION.

SELECT * FROM VBAK INTO TABLE IT_JTAB WHERE VBELN = S_VBELN-LOW.

****FUNCTION MODULE OUTPUT DISPLAY***

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING
I_CALLBACK_PROGRAM = REPID
IT_FIELDCAT = VBAK_B
IT_EVENTS = EVENTS_B

TABLES
t_outtab = IT_JTAB.
****END OF PROGRAM****

No comments:

Archives