* Title : Customer and Vendor List Country-wise *
* Developed by : Mohan *
* Location : HO *
* Date : 16.12.2003 *
* Module : SD *
* Change History : *
* Date : *
* Reason : *
* Person : *
**************************** Change History-1**************************
* Modified by : Sujatha.S *
* Date : 19.02.2010 *
* Reason : Sales Organization Check added *
***********************End of Change history 1*************************
**************************** Change History-2**************************
* Modified by : Sujitha.D *
* Date : 12.05.2011 *
* Reason : For getting PAN NO details *
* Help Desk Request : SR00340 *
* Request No : ORDK935506 *
***********************End of Change history 2*************************
REPORT yrsd_customer_mohan .
*Database Tables
TABLES: kna1,lfa1,adr6,t001w,ekko,knvv,TNLST,TVKOT,TVTWT,TSPAT.
TABLES : SSCRFIELDS.
*Internal Table decalarations
DATA : BEGIN OF ITAB_SO OCCURS 0,
VKORG LIKE TVKO-VKORG,
END OF ITAB_SO.
DATA : AUT_FLAG(1) TYPE C,
SEL_FLAG(1) TYPE C,
M_VKORG(200) TYPE C.
DATA : BEGIN OF itab_customer OCCURS 0,
kunnr LIKE kna1-kunnr,
lifnr LIKE lfa1-lifnr,
*Added by Sujitha.D on 12.05.2011
*Reason:For fetching the Pan No details from the vendor master table-LFA1
*Help Desk Request:SR00340
*Request No:ORDK935506
STCD1 LIKE lfa1-STCD1,
*End Add.
ekorg LIKE ekko-ekorg,
adrnr LIKE kna1-adrnr,
name1 LIKE kna1-name1,
name2 LIKE kna1-name2,
NAME3 LIKE KNA1-NAME3,
NAME4 LIKE KNA1-NAME4,
stras LIKE kna1-stras,
ort01 LIKE kna1-ort01,
pstlz LIKE kna1-pstlz,
regio LIKE kna1-regio,
state(20),
land1 LIKE kna1-land1,
country(15),
brsch LIKE kna1-brsch, "INDUSTRY
industry(20),
werks LIKE kna1-werks,
telf1 LIKE kna1-telf1,
telf2 LIKE kna1-telf2,
telfx LIKE kna1-telfx,
telx1 LIKE kna1-telx1,
email LIKE adr6-smtp_addr,
* add
PFACH LIKE LFA1-PFACH,
MSTREET1 LIKE ADRC-STR_SUPPL1,
MSTREET2 LIKE ADRC-STR_SUPPL2,
*Commented by sujitha.D on 12.05.2011
*Reason:For Displaying the PANNO(Tax number1 from the lfa1 table)
*Help desk Request:SR00340
*Request No:ORDK935506
J_1IPANNO like J_1IMOVEND-J_1IPANNO,
****************************BALA**********************************
J_1IPANNO1 LIKE J_1IMOCUST-J_1IPANNO, "Permanent Account Number of customer
****************************BALA**********************************
*Endcomment
* Modificaion by RAVI on 19/11/2007
VKORG like knvv-VKORG,
VTWEG like knvv-VTWEG,
SPART like knvv-SPART,
SORT1 like adrc-SORT1,
SORT2 like adrc-SORT2,
bzirk like knvv-bzirk,
BEZEI like TNLST-BEZEI,
aufsd like knvv-aufsd, "for customer centrally blocked
aufsd1 like knvv-aufsd, "for customer sales area wise block
* Modificaion by RAVI on 21/11/2007
ANRED like kna1-ANRED,
CITY2 like adrc-CITY2,
NIELS like kna1-NIELS,
VTEXT like TVKOT-VTEXT,
VTEXT1 like TVTWT-VTEXT,
BZTXT like T171T-BZTXT,
VTEXT2 like TSPAT-VTEXT,
* End of modification by RAVI on 21/11/2007
END OF itab_customer.
DATA : FLAG.
*****************data for alv ************************************
TYPE-POOLS : slis.
CONSTANTS:
gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA: g_repid LIKE sy-repid.
DATA :
" used for individual column
gt_fieldcat TYPE slis_t_fieldcat_alv,
g_tabname TYPE slis_tabname VALUE 'ITAB_OUTPUT',
" used for layout type
gs_layout TYPE slis_layout_alv,
gt_variant TYPE slis_vari,
" used for subtotal
gs_sub TYPE slis_subtot_text,
gt_sp_group TYPE slis_t_sp_group_alv,
" used for events in the report
gt_events TYPE slis_t_event,
gt_col TYPE slis_color, "used for layout color
" for sorting the table
gt_sort TYPE slis_t_sortinfo_alv,
gt_list_top_of_page TYPE slis_t_listheader,
" contains the user event
g_user_command LIKE slis_ev_user_command VALUE 'USER_COMMAND',
alv_event TYPE slis_alv_event, "structure event handling
gt_print TYPE slis_print_alv.
*Selection screen variables
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_count FOR kna1-land1.
SELECT-OPTIONS : s_kunnr FOR kna1-kunnr MODIF ID a.
* Modification by RAVI on 23/11/2007
SELECT-OPTIONS : s_VKORG FOR knvv-VKORG MODIF ID a."OBLIGATORY MODIF ID a. "obligatory added by anbu on 3.3.10
SELECT-OPTIONS : s_VTWEG FOR knvv-VTWEG MODIF ID a.
*END of modification by RAVI on 23/11/2007
* Modification by RAVI on 19/11/2007
SELECT-OPTIONS : s_SPART FOR knvv-SPART MODIF ID a.
SELECT-OPTIONS : s_BZIRK FOR knvv-BZIRK MODIF ID a.
SELECT-OPTIONS : s_NIELS FOR kna1-NIELS MODIF ID a.
SELECT-OPTIONS : s_REGIO FOR kna1-REGIO MODIF ID a.
*END of modification by RAVI on 19/11/2007
SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr MODIF ID b.
SELECT-OPTIONS : s_ktokk FOR lfa1-ktokk MODIF ID b.
SELECTION-SCREEN END OF BLOCK b1.
*Selection screen radio buttons
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS : p_cust RADIOBUTTON GROUP a USER-COMMAND RAD DEFAULT 'X'.
PARAMETERS : p_vend RADIOBUTTON GROUP a.
SELECTION-SCREEN END OF BLOCK b2.
* Modification by RAVI on 22/11/2007
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETERS : p_block RADIOBUTTON GROUP b USER-COMMAND RAD MODIF ID a,
p_ublock RADIOBUTTON GROUP b MODIF ID a,
p_all RADIOBUTTON GROUP b MODIF ID a DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK b3.
*END of modification by RAVI on 22/11/2007
*** ADDED by SUJATHA FOR YCUSTV
AT SELECTION-SCREEN ON S_VKORG.
SELECT * FROM TVKO INTO CORRESPONDING FIELDS OF TABLE ITAB_SO WHERE VKORG IN S_VKORG .
*** Sales Organization level authorization check
AUT_FLAG = '0'.
SEL_FLAG = '0'.
LOOP AT ITAB_SO.
SEL_FLAG = '1'.
AUTHORITY-CHECK OBJECT 'M_MATE_VKO'
ID 'ACTVT' FIELD '03'
ID 'VKORG' FIELD ITAB_SO-VKORG.
* ID 'VTWEG' FIELD VTWEG.
IF SY-SUBRC NE 0.
AUT_FLAG = '1'.
ENDIF.
ENDLOOP.
IF AUT_FLAG = '1'.
CONCATENATE 'No authorization for Sales Organization' ITAB_SO-VKORG INTO M_VKORG SEPARATED BY SPACE.
MESSAGE M_VKORG TYPE 'E'.
ENDIF.
IF SEL_FLAG = '0'.
MESSAGE 'The Sales Organization specified do not exist' TYPE 'E'.
ENDIF.
***ENDED by SUJATHA FOR YCUSTV
*Initialization event
INITIALIZATION.
g_repid = sy-repid.
*At Selection Screen event
AT SELECTION-SCREEN OUTPUT.
REFRESH s_ktokk.
IF p_cust = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'B'.
screen-input = 0.
screen-output = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF p_vend = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'A'.
screen-input = 0.
screen-output = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
*Start of selection event
START-OF-SELECTION.
REFRESH gt_fieldcat.
*ALV List initialization subroutines
PERFORM fieldcat_init USING gt_fieldcat[].
PERFORM alv_event_init.
PERFORM sort_init USING gt_sort[].
REFRESH itab_customer.
*Check for Customer-wise
IF p_cust EQ 'X'.
*Retrieving information from Customer Master table
*Modification done by RAVI on 23/11/2007
*IF p_all EQ 'X'.
SELECT * FROM knvv
into CORRESPONDING FIELDS OF TABLE itab_customer
where spart in s_spart and bzirk in s_bzirk and kunnr in s_kunnr and VKORG in s_VKORG and VTWEG in s_VTWEG.
*elseif P_block EQ 'X' .
* SELECT * FROM knvv
* into CORRESPONDING FIELDS OF TABLE itab_customer
* where spart in s_spart and bzirk in s_bzirk and kunnr in s_kunnr and VKORG in s_VKORG and VTWEG in s_VTWEG and aufsd EQ '01'.
*elseif P_ublock EQ 'X' .
* SELECT * FROM knvv
* into CORRESPONDING FIELDS OF TABLE itab_customer
* where spart in s_spart and bzirk in s_bzirk and kunnr in s_kunnr and VKORG in s_VKORG and VTWEG in s_VTWEG and aufsd NE '01'.
*endif.
*End of modification by RAVI on 23/11/2007
loop at itab_customer.
*Modification done by RAVI on 22/11/2007
IF p_all EQ 'X'.
itab_customer-aufsd1 = itab_customer-aufsd.
modify itab_customer.
SELECT single * FROM kna1
INTO CORRESPONDING FIELDS OF itab_customer
WHERE land1 IN s_count and regio in s_regio and kunnr eq itab_customer-kunnr and niels in s_niels.
elseif P_block EQ 'X' .
itab_customer-aufsd1 = itab_customer-aufsd.
modify itab_customer.
if itab_customer-aufsd1 ne '01'.
SELECT single * FROM kna1
INTO CORRESPONDING FIELDS OF itab_customer
WHERE land1 IN s_count and regio in s_regio and kunnr eq itab_customer-kunnr and niels in s_niels and aufsd EQ '01'.
else.
SELECT single * FROM kna1
INTO CORRESPONDING FIELDS OF itab_customer
WHERE land1 IN s_count and regio in s_regio and kunnr eq itab_customer-kunnr and niels in s_niels.
endif.
elseif P_ublock EQ 'X' .
itab_customer-aufsd1 = itab_customer-aufsd.
modify itab_customer.
SELECT single * FROM kna1
INTO CORRESPONDING FIELDS OF itab_customer
WHERE land1 IN s_count and regio in s_regio and kunnr eq itab_customer-kunnr and niels in s_niels and aufsd NE '01'.
endif.
*End of modification by RAVI on 22/11/2007
if sy-subrc eq 0.
modify itab_customer.
else.
delete itab_customer.
endif.
clear itab_customer.
endloop.
loop at itab_customer.
* if p_block eq 'X'.
* if itab_customer-aufsd1 ne '01'.
* delete itab_customer.
* endif.
if p_ublock eq 'X'.
if itab_customer-aufsd1 eq '01'.
delete itab_customer.
endif.
endif.
clear itab_customer.
endloop.
*End of modification by RAVI on 19/11/2007
LOOP AT itab_customer.
*Convert to Upper case
TRANSLATE itab_customer-name1 TO UPPER CASE.
TRANSLATE itab_customer-name2 TO UPPER CASE.
TRANSLATE itab_customer-name3 TO UPPER CASE.
TRANSLATE itab_customer-name4 TO UPPER CASE.
TRANSLATE itab_customer-stras TO UPPER CASE.
TRANSLATE itab_customer-ort01 TO UPPER CASE.
TRANSLATE itab_customer-pstlz TO UPPER CASE.
*Modification done by RAVI on 21/11/2007
SELECT single BEZEI from TNLST
into itab_customer-BEZEI
where niels EQ itab_customer-niels and spras EQ 'EN'.
*End of modification by RAVI on 21/11/2007
*Modification done by RAVI on 23/11/2007
SELECT single VTEXT from TVKOT
into itab_customer-VTEXT
where vkorg EQ itab_customer-vkorg and spras EQ 'EN'.
SELECT single VTEXT from TVTWT
into itab_customer-VTEXT1
where vtweg EQ itab_customer-vtweg and spras EQ 'EN'.
SELECT single VTEXT from TSPAT
into itab_customer-VTEXT2
where SPART EQ itab_customer-SPART and spras EQ 'EN'.
SELECT single BZTXT from T171T
into itab_customer-BZTXT
where BZIRK EQ itab_customer-BZIRK and spras EQ 'EN'.
*End of modification by RAVI on 23/11/2007
*Plant
SELECT SINGLE werks FROM t001w
INTO itab_customer-werks
WHERE kunnr EQ itab_customer-kunnr.
*Country Names
SELECT SINGLE landx FROM t005t
INTO itab_customer-country
WHERE spras = 'E' AND land1 = itab_customer-land1.
*Convert to Upper case
TRANSLATE itab_customer-country TO UPPER CASE.
*Region Names
SELECT SINGLE bezei FROM t005u
INTO itab_customer-state
WHERE spras EQ 'E' AND
land1 EQ itab_customer-land1 AND
bland EQ itab_customer-regio.
*Convert to Upper case
TRANSLATE itab_customer-state TO UPPER CASE.
*Industry Names
SELECT SINGLE brtxt FROM t016t
INTO itab_customer-industry
WHERE spras EQ 'E' AND
brsch EQ itab_customer-brsch.
*Convert to Upper case
TRANSLATE itab_customer-industry TO UPPER CASE.
*Email
SELECT SINGLE smtp_addr INTO itab_customer-email
FROM adr6 WHERE addrnumber EQ itab_customer-adrnr.
*Convert to Upper case
TRANSLATE itab_customer-email TO UPPER CASE.
*
* MODIFY itab_customer.
* CLEAR itab_customer.
SELECT SINGLE J_1IPANNO INTO ITAB_CUSTOMER-J_1IPANNO FROM J_1IMOVEND WHERE LIFNR EQ ITAB_CUSTOMER-kunnr.
*SELECT SINGLE AUFSD FROM KNNV INTO ITAB_CUSTOMER-AUFSD WHERE KUNNR EQ ITAB_CUSTOMER-kunnr.
* add
*Modification by RAVI on 20/11/2007
SELECT SINGLE STR_SUPPL1 STR_SUPPL2 SORT1 SORT2 city2 INTO
(ITAB_CUSTOMER-MSTREET1,ITAB_CUSTOMER-MSTREET2,ITAB_CUSTOMER-SORT1,ITAB_CUSTOMER-sort2,ITAB_CUSTOMER-city2)
FROM ADRC WHERE ADDRNUMBER EQ ITAB_CUSTOMER-ADRNR.
*Modification by RAVI on 20/11/2007
* IF SY-SUBRC = 0.
MODIFY ITAB_CUSTOMER.
CLEAR ITAB_CUSTOMER.
* ENDIF.
ENDLOOP.
*------------------for Vendor Work Area
*Check for Vendor-wise
ELSEIF p_vend EQ 'X'.
*Retrieving information from Vendor Master table
SELECT * FROM lfa1
INTO CORRESPONDING FIELDS OF TABLE itab_customer
WHERE land1 IN s_count AND
* kunnr IN s_kunnr AND
LIFNR IN S_LIFNR AND
ktokk IN s_ktokk
ORDER BY LAND1.
LOOP AT itab_customer.
*Convert to Upper case
TRANSLATE itab_customer-name1 TO UPPER CASE.
TRANSLATE itab_customer-name2 TO UPPER CASE.
TRANSLATE itab_customer-name3 TO UPPER CASE.
TRANSLATE itab_customer-name4 TO UPPER CASE.
TRANSLATE itab_customer-stras TO UPPER CASE.
TRANSLATE itab_customer-ort01 TO UPPER CASE.
TRANSLATE itab_customer-pstlz TO UPPER CASE.
*Plant
SELECT SINGLE werks FROM t001w
INTO itab_customer-werks
WHERE lifnr EQ itab_customer-lifnr.
*Purchase Organization
SELECT single ekorg FROM ekko
INTO itab_customer-ekorg
WHERE lifnr EQ itab_customer-lifnr.
*Country Names
SELECT SINGLE landx FROM t005t
INTO itab_customer-country
WHERE spras = 'E' AND land1 = itab_customer-land1.
*Convert to Upper case
TRANSLATE itab_customer-country TO UPPER CASE.
*Region Names
SELECT SINGLE bezei FROM t005u
INTO itab_customer-state
WHERE spras EQ 'E' AND
land1 EQ itab_customer-land1 AND
bland EQ itab_customer-regio.
*Convert to Upper case
TRANSLATE itab_customer-state TO UPPER CASE.
*Industry Names
SELECT SINGLE brtxt FROM t016t
INTO itab_customer-industry
WHERE spras EQ 'E' AND
brsch EQ itab_customer-brsch.
*Convert to Upper case
TRANSLATE itab_customer-industry TO UPPER CASE.
*Email
SELECT SINGLE smtp_addr INTO itab_customer-email
FROM adr6 WHERE addrnumber EQ itab_customer-adrnr.
*Convert to Upper case
TRANSLATE itab_customer-email TO UPPER CASE.
* MODIFY itab_customer.
* CLEAR itab_customer.
SELECT SINGLE J_1IPANNO INTO ITAB_CUSTOMER-J_1IPANNO FROM J_1IMOVEND WHERE LIFNR EQ ITAB_CUSTOMER-LIFNR.
************************************BALA****************************
SELECT SINGLE J_1IPANNO INTO ITAB_CUSTOMER-J_1IPANNO1 FROM J_1IMOCUST WHERE KUNNR EQ ITAB_CUSTOMER-KUNNR.
***************************************BALA*************************
* add
SELECT SINGLE STR_SUPPL1 STR_SUPPL2 FROM ADRC INTO (ITAB_CUSTOMER-MSTREET1,ITAB_CUSTOMER-MSTREET2)
WHERE ADDRNUMBER EQ ITAB_CUSTOMER-ADRNR.
* IF SY-SUBRC = 0.
MODIFY ITAB_CUSTOMER.
CLEAR ITAB_CUSTOMER.
* ENDIF.
* ENDSELECT.
ENDLOOP.
ENDIF.
*End of selection event
END-OF-SELECTION.
*ALV display Function
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = g_repid
* i_callback_user_command = g_user_command
* i_callback_top_of_page = 'gt_list_top_of_page'
* i_structure_name = 'ITAB_STRU'
it_fieldcat = gt_fieldcat[]
it_events = gt_events[]
i_save = 'X'
* is_variant = 'X'
TABLES
t_outtab = itab_customer.
REFRESH gt_fieldcat.
*---------------------------------------------------------------------*
* FORM fieldcat_init *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> RT_FIELDCAT *
*---------------------------------------------------------------------*
FORM fieldcat_init
USING rt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
DATA w_col TYPE i.
w_col = 0.
REFRESH rt_fieldcat.
* ADD 1 TO w_col.
* CLEAR ls_fieldcat.
* ls_fieldcat-row_pos = '1'.
* ls_fieldcat-col_pos = w_col.
* ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
* ls_fieldcat-fieldname = 'WERKS'.
* ls_fieldcat-outputlen = 6.
* ls_fieldcat-seltext_l = 'Plant'.
* APPEND ls_fieldcat TO rt_fieldcat.
IF p_vend EQ 'X'.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'LIFNR'.
ls_fieldcat-hotspot = 'X'.
ls_fieldcat-outputlen = 14.
ls_fieldcat-seltext_l = 'Vendor Code'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'EKORG'.
ls_fieldcat-hotspot = 'X'.
ls_fieldcat-outputlen = 6.
ls_fieldcat-seltext_l = 'P.Org'.
APPEND ls_fieldcat TO rt_fieldcat.
ELSE.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'KUNNR'.
ls_fieldcat-hotspot = 'X'.
ls_fieldcat-outputlen = 14.
ls_fieldcat-seltext_l = 'Customer Code'.
APPEND ls_fieldcat TO rt_fieldcat.
ENDIF.
*Modification by RAVI on 21/11/2007
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'ANRED'.
ls_fieldcat-outputlen = 35.
ls_fieldcat-seltext_l = 'Title'.
APPEND ls_fieldcat TO rt_fieldcat.
*End of Modification by RAVI on 21/11/2007
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'NAME1'.
ls_fieldcat-outputlen = 35.
ls_fieldcat-seltext_l = 'Name 1'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'NAME2'.
ls_fieldcat-outputlen = 35.
ls_fieldcat-seltext_l = 'Name 2'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'NAME3'.
ls_fieldcat-outputlen = 35.
ls_fieldcat-seltext_l = 'Name 3'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'NAME4'.
ls_fieldcat-outputlen = 35.
ls_fieldcat-seltext_l = 'Name 4'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'STRAS'.
ls_fieldcat-outputlen = 35.
ls_fieldcat-seltext_l = 'Address'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'MSTREET1'.
ls_fieldcat-outputlen = 30.
ls_fieldcat-seltext_l = 'STREET2'.
* ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'MSTREET2'.
ls_fieldcat-outputlen = 30.
ls_fieldcat-seltext_l = 'STREET3'.
* ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'PFACH'.
ls_fieldcat-outputlen = 30.
ls_fieldcat-seltext_l = 'PO Box'.
* ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'ORT01'.
ls_fieldcat-outputlen = 35.
ls_fieldcat-seltext_l = 'City'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'PSTLZ'.
ls_fieldcat-outputlen = 10.
ls_fieldcat-seltext_l = 'Postal Code'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'STATE'.
ls_fieldcat-outputlen = 20.
ls_fieldcat-seltext_l = 'State'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'COUNTRY'.
ls_fieldcat-outputlen = 15.
ls_fieldcat-seltext_l = 'Country'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'BRSCH'.
ls_fieldcat-no_zero = 'X'.
ls_fieldcat-outputlen = 20.
ls_fieldcat-seltext_l = 'Industry'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'TELF1'.
ls_fieldcat-seltext_l = 'Telephone 1'.
ls_fieldcat-outputlen = 16.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'TELF2'.
ls_fieldcat-outputlen = 16.
ls_fieldcat-seltext_l = 'Telephone 2'.
APPEND ls_fieldcat TO rt_fieldcat.
*Modification by RAVI on 20/11/2007
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'VTEXT'.
ls_fieldcat-outputlen = 16.
ls_fieldcat-seltext_l = 'Sales Org'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'VTEXT1'.
ls_fieldcat-outputlen = 16.
ls_fieldcat-seltext_l = 'Dist channel'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'VTEXT2'.
ls_fieldcat-outputlen = 16.
ls_fieldcat-seltext_l = 'Division'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'SORT1'.
ls_fieldcat-outputlen = 16.
ls_fieldcat-seltext_l = 'Designation'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'SORT2'.
ls_fieldcat-outputlen = 16.
ls_fieldcat-seltext_l = 'Emp code'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'CITY2'.
ls_fieldcat-outputlen = 16.
ls_fieldcat-seltext_l = 'Headquarter'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'BZTXT'.
ls_fieldcat-outputlen = 16.
ls_fieldcat-seltext_l = 'Zone'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'BEZEI'.
ls_fieldcat-outputlen = 16.
ls_fieldcat-seltext_l = 'Field Force Designation'.
APPEND ls_fieldcat TO rt_fieldcat.
*End of modification by RAVI on 20/11/2007
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'TELFX'.
ls_fieldcat-outputlen = 31.
ls_fieldcat-seltext_l = 'Telefax'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
ls_fieldcat-fieldname = 'TELX1'.
ls_fieldcat-outputlen = 30.
ls_fieldcat-seltext_l = 'Telex'.
ls_fieldcat-no_zero = 'X'.
APPEND ls_fieldcat TO rt_fieldcat.
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
* ls_fieldcat-do_sum = 'X'.
ls_fieldcat-fieldname = 'EMAIL'.
ls_fieldcat-outputlen = 30.
ls_fieldcat-seltext_l = 'E-mail Addresss'.
APPEND ls_fieldcat TO rt_fieldcat.
*
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
* ls_fieldcat-do_sum = 'X'.
ls_fieldcat-fieldname = 'J_1IPANNO'.
ls_fieldcat-outputlen = 30.
ls_fieldcat-seltext_l = 'PAN Number'.
APPEND ls_fieldcat TO rt_fieldcat.
*******************************************BALA*********************************
ADD 1 TO w_col.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = w_col.
ls_fieldcat-tabname = 'ITAB_CUSTOMER'.
* ls_fieldcat-do_sum = 'X'.
ls_fieldcat-fieldname = 'J_1IPANNO1'.
ls_fieldcat-outputlen = 30.
ls_fieldcat-seltext_l = 'Customer PAN Number'.
APPEND ls_fieldcat TO rt_fieldcat.
**************************************BALA**************************************
ENDFORM.
*---------------------------------------------------------------------*
* FORM alv_event_init *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM alv_event_init.
CLEAR alv_event.
alv_event-name = slis_ev_top_of_page.
alv_event-form = 'ALV_TOP_OF_PAGE'.
APPEND alv_event TO gt_events.
CLEAR alv_event.
alv_event-name = slis_ev_top_of_list.
alv_event-form = 'ALV_TOP_OF_LIST'.
APPEND alv_event TO gt_events.
CLEAR alv_event.
alv_event-name = slis_ev_end_of_list.
alv_event-form = 'ALV_END_OF_LIST'.
APPEND alv_event TO gt_events.
CLEAR alv_event.
alv_event-name = slis_ev_end_of_page.
alv_event-form = 'ALV_END_OF_PAGE'.
CLEAR alv_event.
PERFORM alv_init.
ENDFORM. " alv_event_init
*---------------------------------------------------------------------*
* FORM sort_init *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> RT_SORT *
*---------------------------------------------------------------------*
FORM sort_init USING rt_sort TYPE slis_t_sortinfo_alv.
DATA lt_sort TYPE slis_sortinfo_alv.
lt_sort-spos = 1.
lt_sort-fieldname = 'LAND1'.
lt_sort-up = 'X'.
lt_sort-subtot = 'X'.
APPEND lt_sort TO rt_sort.
lt_sort-spos = 2.
lt_sort-fieldname = 'KUNNR'.
lt_sort-up = 'X'.
lt_sort-subtot = 'X'.
APPEND lt_sort TO rt_sort.
ENDFORM. " SORT_INIT
*---------------------------------------------------------------------*
* FORM alv_init *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM alv_init.
REFRESH gt_fieldcat.
PERFORM : fieldcat_init USING gt_fieldcat[].
ENDFORM. " alv_init