‎2008 Sep 05 6:38 AM
dear experts...
iam in modifying a report where the requirement is instead of fetching data with persononal number as condition they want to fetch using the condition company code
i tried using a select statement and changed the select option as parameter
parameters : ccode like bseg-bukrs.
year like bkpf- gjahr
but not working properly...
can u pls help me out.
CODE ATTACHED for your convinience
Thankx a lot in advance
Regards
Rachel
*INCLUDE : *
type-pools : slis .
----
----
*TABLES : *
----
tables: pernr, pa0001.
----
*TYPES : *
----
Types: Begin with TY_ *
types : begin of ty_seq_dat ,
seqnr type zseg-seqnr ,
begda type pc261-paydt ,
endda type pc261-paydt ,
end of ty_seq_dat .
types : begin of ty_mon ,
apr type pa0008-bet01 ,
may type pa0008-bet01 ,
jun type pa0008-bet01 ,
jul type pa0008-bet01 ,
aug type pa0008-bet01 ,
sep type pa0008-bet01 ,
oct type pa0008-bet01 ,
nov type pa0008-bet01 ,
dec type pa0008-bet01 ,
jan type pa0008-bet01 ,
feb type pa0008-bet01 ,
mar type pa0008-bet01 ,
end of ty_mon .
Constants Begin with C_ *
----
*CONSTANTS: *
----
Data Begin with W_
data d_mon type ty_mon .
data : w_begda type pc261-paydt ,
w_endda type pc261-paydt ,
w_period type t612b-bfmar ,
w_month(2) type n ,
w_year(4) type n ,
w_date(2) type n ,
w_month1(2) type n ,
w_year1(4) type n ,
w_index type i ,
w_molga like t500l-molga , "#EC country
w_total type pa0008-bet01 .
data: w_curry type bkpf-gjahr .
data: begin of it_pernr occurs 0 ,
pernr type pa0000-pernr ,
end of it_pernr .
data v1 type table of pc207 .
data wa type pc207 .
data : gt_fcat type slis_t_fieldcat_alv ,
gs_fcat_init type slis_fieldcat_alv .
----
*DATA : *
----
Infotypes ( HR Module Specific) *
----
*INFOTYPES : *
----
Internal tables Begin with IT_ *
----
data: begin of it_final occurs 0,
est_code like p0587-eepfn,
estt_code like p0587-eepfn,
est_extn like p0587-eepfn,
emp_no like p0587-eepfn,
emp_name like pernr-ename,
totalwages like q0008-betrg,
totee like q0008-betrg,
pft like q0008-betrg,
toter like q0008-betrg,
twg like d_mon,
ttee like d_mon,
tft like d_mon,
ter like d_mon,
end of it_final.
data wa_final like it_final .
data : it_payresult type standard table of payin_result with
header line,
wa_payresult type payin_result.
data it_rgdir type table of pc261 .
data : it_seqnr type table of zseg with header line ,
wa_seqnr type zseg .
data : it_seq_dat type table of ty_seq_dat ,
wa_seq_dat type ty_seq_dat .
----
Field Symbols Begin with FS_ *
----
*FIELD-SYMBOLS: *
----
Insert *
----
*INSERT : *
----
Select Options Begin with SO_ *
----
*SELECT-OPTIONS :
select-options s_pernr for pernr-pernr .
parameters p_year type bkpf-gjahr .
----
Parameters Begin with PR_ *
----
*PARAMETERS : *
----
Initialisation *
----
*INITIALISATION :
*pnppabrp = 12 .
----
At selection-screen *
----
*AT SELECTION-SCREEN.
***********************************************************************
S T A R T O F S E L E C T I O N *
***********************************************************************
start-of-selection.
select pernr from pa0000 into table it_pernr where pernr in s_pernr.
perform it_fcat.
loop at it_pernr .
wa_final-emp_name = pernr-ename .
select single eepfn from pa0587 into (wa_final-estt_code )
where pernr = it_pernr-pernr.
select single ename from pa0001 into wa_final-emp_name
where pernr = it_pernr-pernr .
wa_final-emp_no = it_pernr-pernr.
perform get_rgdir .
perform get_result .
endloop .
end-of-selection.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = 'ZFORM_DISPLAY'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT =
it_fieldcat = gt_fcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = it_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
***********************************************************************
E N D O F S E L E C T I O N *
***********************************************************************
At line selection *
----
*AT LINE-SELECTION.
----
User Command Processing *
----
*AT USER-COMMAND.
----
Top Of Page *
----
*TOP-OF-PAGE.
----
End Of Page *
----
*END-OF-PAGE.
form get_rgdir .
call function 'CU_READ_RGDIR'
exporting
persnr = it_pernr-pernr
BUFFER =
NO_AUTHORITY_CHECK = ' '
importing
molga = w_molga
tables
in_rgdir = it_rgdir
EXCEPTIONS
NO_RECORD_FOUND = 1
OTHERS = 2
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
w_year = p_year .
w_year1 = p_year .
w_month = 01 .
w_date = 01 .
w_month1 = 04 .
do 12 times .
concatenate w_year1 w_month1 w_date into w_begda.
concatenate w_year w_month into w_period.
w_month = w_month + 1 .
w_month1 = w_month1 + 1 .
if w_month1 = 13 .
w_month1 = 1 .
w_year1 = w_year1 + 1 .
endif .
call function 'RP_LAST_DAY_OF_MONTHS'
exporting
day_in = w_begda
importing
last_day_of_month = w_endda
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function 'ZPF_SEQNR'
exporting
begin_date = w_begda
end_date = w_endda
period = w_period
IMPORTING
OUT_SEQNR =
tables
rgdir = it_rgdir
seqnr = it_seqnr
EXCEPTIONS
NO_RECORD_FOUND = 1
OTHERS = 2
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
wa_seq_dat-seqnr = it_seqnr-seqnr .
wa_seq_dat-begda = w_begda.
wa_seq_dat-endda = w_endda.
wa_final-est_code = 'DUMMY'.
append wa_seq_dat to it_seq_dat .
clear it_seqnr .
enddo .
endform. " GET_RGDIR
form get_result .
loop at it_seq_dat into wa_seq_dat .
w_index = sy-tabix .
check wa_seq_dat-seqnr is not initial .
refresh it_payresult.
*clear wa_seq_dat-seqnr.
call function 'PYXX_READ_PAYROLL_RESULT'
exporting
clusterid = 'IN'
employeenumber = it_pernr-pernr
sequencenumber = wa_seq_dat-seqnr
READ_ONLY_BUFFER = ' '
READ_ONLY_INTERNATIONAL = ' '
ARC_GROUP = ' '
CHECK_READ_AUTHORITY = 'X'
FILTER_CUMULATIONS = 'X'
CLIENT =
IMPORTING
VERSION_NUMBER_PAYVN =
VERSION_NUMBER_PCL2 =
changing
payroll_result = it_payresult
EXCEPTIONS
ILLEGAL_ISOCODE_OR_CLUSTERID = 1
ERROR_GENERATING_IMPORT = 2
IMPORT_MISMATCH_ERROR = 3
SUBPOOL_DIR_FULL = 4
NO_READ_AUTHORITY = 5
NO_RECORD_FOUND = 6
VERSIONS_DO_NOT_MATCH = 7
ERROR_READING_ARCHIVE = 8
ERROR_READING_RELID = 9
OTHERS = 10
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
IF WA_payresult-LGART = P_WAGE .
move it_payresult-inter-rt to v1 .
loop at v1 into wa.
if w_index = '1'.
if wa-lgart = '/111'.
wa_final-twg-apr = wa-betrg.
elseif wa-lgart = '/3F1'.
wa_final-ttee-apr = wa-betrg.
elseif wa-lgart = '/3F4'.
wa_final-tft-apr = wa-betrg.
elseif wa-lgart = '/3F3'.
wa_final-ter-apr = wa-betrg.
W_TOTAL = W_TOTAL + WA-BETRG .
endif.
elseif w_index = '2'.
if wa-lgart = '/111'.
wa_final-twg-may = wa-betrg.
elseif wa-lgart = '/3F1'.
wa_final-ttee-may = wa-betrg.
elseif wa-lgart = '/3F4'.
wa_final-tft-may = wa-betrg.
elseif wa-lgart = '/3F3'.
wa_final-ter-may = wa-betrg.
W_TOTAL = W_TOTAL + WA-betrg.
endif.
elseif w_index = '3'.
if wa-lgart = '/111'.
wa_final-twg-jun = wa-betrg.
elseif wa-lgart = '/3F1'.
wa_final-ttee-jun = wa-betrg.
elseif wa-lgart = '/3F4'.
wa_final-tft-jun = wa-betrg.
elseif wa-lgart = '/3F3'.
wa_final-ter-jun = wa-betrg.
W_TOTAL = W_TOTAL + WA-BETRG.
endif.
elseif w_index = '4'.
if wa-lgart = '/111'.
wa_final-twg-jul = wa-betrg.
elseif wa-lgart = '/3F1'.
wa_final-ttee-jul = wa-betrg.
elseif wa-lgart = '/3F4'.
wa_final-tft-jul = wa-betrg.
elseif wa-lgart = '/3F3'.
wa_final-ter-jul = wa-betrg.
W_TOTAL = W_TOTAL + WA-BETRG.
endif.
elseif w_index = '5'.
if wa-lgart = '/111'.
wa_final-twg-aug = wa-betrg..
elseif wa-lgart = '/3F1'.
wa_final-ttee-aug = wa-betrg.
elseif wa-lgart = '/3F4'.
wa_final-tft-aug = wa-betrg.
elseif wa-lgart = '/3F3'.
wa_final-ter-aug = wa-betrg.
W_TOTAL = W_TOTAL + WA-BETRG.
endif.
elseif w_index = '6'.
if wa-lgart = '/111'.
wa_final-twg-sep = wa-betrg.
elseif wa-lgart = '/3F1'.
wa_final-ttee-sep = wa-betrg.
elseif wa-lgart = '/3F4'.
wa_final-tft-sep = wa-betrg.
elseif wa-lgart = '/3F3'.
wa_final-ter-sep = wa-betrg.
W_TOTAL = W_TOTAL + WA-BETRG.
endif.
elseif w_index = '7'.
if wa-lgart = '/111'.
wa_final-twg-oct = wa-betrg.
elseif wa-lgart = '/3F1'.
wa_final-ttee-oct = wa-betrg.
elseif wa-lgart = '/3F4'.
wa_final-tft-oct = wa-betrg.
elseif wa-lgart = '/3F3'.
wa_final-ter-oct = wa-betrg.
W_TOTAL = W_TOTAL + WA-BETRG.
endif.
elseif w_index = '8'.
if wa-lgart = '/111'.
wa_final-twg-nov = wa-betrg.
elseif wa-lgart = '/3F1'.
wa_final-ttee-nov = wa-betrg.
elseif wa-lgart = '/3F4'.
wa_final-tft-nov = wa-betrg.
elseif wa-lgart = '/3F3'.
wa_final-ter-nov = wa-betrg.
W_TOTAL = W_TOTAL + WA-betrg.
endif.
elseif w_index = '9'.
if wa-lgart = '/111'.
wa_final-twg-dec = wa-betrg.
elseif wa-lgart = '/3F1'.
wa_final-ttee-dec = wa-betrg.
elseif wa-lgart = '/3F4'.
wa_final-tft-dec = wa-betrg.
elseif wa-lgart = '/3F3'.
wa_final-ter-dec = wa-betrg.
W_TOTAL = W_TOTAL + WA-betrg.
endif.
elseif w_index = '10'.
if wa-lgart = '/111'.
wa_final-twg-jan = wa-betrg.
elseif wa-lgart = '/3F1'.
wa_final-ttee-jan = wa-betrg.
elseif wa-lgart = '/3F4'.
wa_final-tft-jan = wa-betrg.
elseif wa-lgart = '/3F3'.
wa_final-ter-jan = wa-betrg.
W_TOTAL = W_TOTAL + WA-betrg.
endif.
elseif w_index = '11'.
if wa-lgart = '/111'.
wa_final-twg-feb = wa-betrg.
elseif wa-lgart = '/3F1'.
wa_final-ttee-feb = wa-betrg.
elseif wa-lgart = '/3F4'.
wa_final-tft-feb = wa-betrg.
elseif wa-lgart = '/3F3'.
wa_final-ter-feb = wa-betrg.
W_TOTAL = W_TOTAL + WA-betrg.
endif.
elseif w_index = '12'.
if wa-lgart = '/111'.
wa_final-twg-mar = wa-betrg.
elseif wa-lgart = '/3F1'.
wa_final-ttee-mar = wa-betrg.
elseif wa-lgart = '/3F4'.
wa_final-tft-mar = wa-betrg.
elseif wa-lgart = '/3F3'.
wa_final-ter-mar = wa-betrg.
W_TOTAL = W_TOTAL + WA-betrg.
endif.
w_total = w_total + wa-betrg.
endif .
*
*
if wa-lgart = '/111'.
wa_final-totalwages = wa_final-totalwages + wa-betrg.
elseif wa-lgart = '/3F1'.
wa_final-totee = wa_final-totee + wa-betrg.
elseif wa-lgart = '/3F4'.
wa_final-pft = wa_final-pft + wa-betrg.
elseif wa-lgart = '/3F3'.
wa_final-toter = wa_final-toter + wa-betrg.
endif.
endloop.
endloop.
append wa_final to it_final.
refresh : it_rgdir , v1 , it_seqnr , it_payresult, it_seq_dat.
clear : w_index , wa_final.
*refresh it_final.
endform. " GET_RESULT
&----
*& Form IT_FCAT
&----
text
----
--> p1 text
<-- p2 text
----
form it_fcat .
*added to display employer code
perform create_fcat using 'EST_CODE' 'IT_FINAL' 'Employer Code' '1' '15' .
*end of add
perform create_fcat using 'EST_EXTN' 'IT_FINAL' 'Emp Pf Exacno' '2' '15' .
perform create_fcat using 'ESTT_CODE' 'IT_FINAL' 'Emp Pf Acno' '3' '15' .
*COMMENTED
*PERFORM CREATE_FCAT USING 'EMP_NO' 'IT_FINAL' 'Emp No' '3' '15'.
*END OF COMMENTED
perform create_fcat using 'EMP_NAME' 'IT_FINAL' 'Emp Name' '4' '15' .
perform create_fcat using 'TOTALWAGES' 'IT_FINAL' 'Emp Total Wages' '5' '15'.
perform create_fcat using 'TOTEE' 'IT_FINAL' 'Emp Totee' '6' '15'.
perform create_fcat using 'PFT' 'IT_FINAL' ' Emp PFT' '7' '15'.
perform create_fcat using 'TOTER' 'IT_FINAL' 'Emp Toter' '8' '15'.
perform create_fcat using 'TWG-APR' 'IT_FINAL' 'Emp Twg(APR)' '9' '15'.
perform create_fcat using 'TWG-MAY' 'IT_FINAL' 'Emp Twg(May)' '10' '15'.
perform create_fcat using 'TWG-JUN' 'IT_FINAL' 'Emp Twg(Jun)' '11' '15'.
perform create_fcat using 'TWG-JUL' 'IT_FINAL' 'Emp Twg(Jul)' '12' '15'.
perform create_fcat using 'TWG-AUG' 'IT_FINAL' 'Emp Twg(aug)' '13' '15'.
perform create_fcat using 'TWG-SEP' 'IT_FINAL' 'Emp Twg(Sep)' '14' '15'.
perform create_fcat using 'TWG-OCT' 'IT_FINAL' 'Emp Twg(Oct)' '15' '15'.
perform create_fcat using 'TWG-NOV' 'IT_FINAL' 'Emp Twg(Nov)' '16' '15'.
perform create_fcat using 'TWG-DEC' 'IT_FINAL' 'Emp Twg(Dec)' '17' '15'.
perform create_fcat using 'TWG-JAN' 'IT_FINAL' 'Emp Twg(Jan)' '18' '15'.
perform create_fcat using 'TWG-FEB' 'IT_FINAL' 'Emp Twg(Feb)' '19' '15'.
perform create_fcat using 'TWG-MAR' 'IT_FINAL' 'Emp Twg(Mar)' '20' '15'.
perform create_fcat using 'TTEE-APR' 'IT_FINAL' ' Emp Ttee(Apr)' '21' '15'.
perform create_fcat using 'TTEE-MAY' 'IT_FINAL' ' Emp Ttee(May)' '22' '15'.
perform create_fcat using 'TTEE-JUN' 'IT_FINAL' ' Emp Ttee(Jun)' '23' '15'.
perform create_fcat using 'TTEE-JUL' 'IT_FINAL' ' Emp Ttee(Jul)' '24' '15'.
perform create_fcat using 'TTEE-AUG' 'IT_FINAL' ' Emp Ttee(Aug)' '25' '15'.
perform create_fcat using 'TTEE-SEP' 'IT_FINAL' ' Emp Ttee(Sep)' '26' '15'.
perform create_fcat using 'TTEE-OCT' 'IT_FINAL' ' Emp Ttee(Oct)' '27' '15'.
perform create_fcat using 'TTEE-NOV' 'IT_FINAL' ' Emp Ttee(Nov)' '28' '15'.
perform create_fcat using 'TTEE-DEC' 'IT_FINAL' ' Emp Ttee(Dec)' '29' '15'.
perform create_fcat using 'TTEE-JAN' 'IT_FINAL' ' Emp Ttee(Jan)' '30' '15'.
perform create_fcat using 'TTEE-FEB' 'IT_FINAL' ' Emp Ttee(Feb)' '31' '15'.
perform create_fcat using 'TTEE-MAR' 'IT_FINAL' ' Emp Ttee(Mar)' '32' '15'.
perform create_fcat using 'TFT-APR' 'IT_FINAL' 'Emp Tft(Apr)' '33' '15'.
perform create_fcat using 'TFT-MAY' 'IT_FINAL' 'Emp Tft(May)' '34' '15'.
perform create_fcat using 'TFT-JUN' 'IT_FINAL' 'Emp Tft(Jun)' '35' '15'.
perform create_fcat using 'TFT-JUL' 'IT_FINAL' 'Emp Tft(Jul)' '36' '15'.
perform create_fcat using 'TFT-AUG' 'IT_FINAL' 'Emp Tft(Aug)' '37' '15'.
perform create_fcat using 'TFT-SEP' 'IT_FINAL' 'Emp Tft(Sep)' '38' '15'.
perform create_fcat using 'TFT-OCT' 'IT_FINAL' 'Emp Tft(Oct)' '39' '15'.
perform create_fcat using 'TFT-NOV' 'IT_FINAL' 'Emp Tft(Nov)' '40' '15'.
perform create_fcat using 'TFT-DEC' 'IT_FINAL' 'Emp Tft(Dec)' '41' '15'.
perform create_fcat using 'TFT-JAN' 'IT_FINAL' 'Emp Tft(Jan)' '42' '15'.
perform create_fcat using 'TFT-FEB' 'IT_FINAL' 'Emp Tft(Feb)' '43' '15'.
perform create_fcat using 'TFT-MAR' 'IT_FINAL' 'Emp Tft(Mar)' '44' '15'.
perform create_fcat using 'TER-APR' 'IT_FINAL' 'Emp Ter(Apr)' '45' '15'.
perform create_fcat using 'TER-MAY' 'IT_FINAL' 'Emp Ter(May)' '46' '15'.
perform create_fcat using 'TER-JUN' 'IT_FINAL' 'Emp Ter(Jun)' '47' '15'.
perform create_fcat using 'TER-JUL' 'IT_FINAL' 'Emp Ter(Jul)' '48' '15'.
perform create_fcat using 'TER-AUG' 'IT_FINAL' 'Emp Ter(Aug)' '49' '15'.
perform create_fcat using 'TER-SEP' 'IT_FINAL' 'Emp Ter(Sep)' '50' '15'.
perform create_fcat using 'TER-OCT' 'IT_FINAL' 'Emp Ter(Oct)' '51' '15'.
perform create_fcat using 'TER-NOV' 'IT_FINAL' 'Emp Ter(Nov)' '52' '15'.
perform create_fcat using 'TER-DEC' 'IT_FINAL' 'Emp Ter(Dec)' '53' '15'.
perform create_fcat using 'TER-JAN' 'IT_FINAL' 'Emp Ter(Jan)' '54' '15'.
perform create_fcat using 'TER-FEB' 'IT_FINAL' 'Emp Ter(Feb)' '55' '15'.
perform create_fcat using 'TER-MAR' 'IT_FINAL' 'Emp Ter(Mar)' '56' '15'.
endform. " IT_FCAT
form create_fcat using fnam tnam txt pos out_len .
gs_fcat_init-fieldname = fnam .
gs_fcat_init-tabname = tnam .
gs_fcat_init-seltext_l = txt.
gs_fcat_init-seltext_m = txt.
gs_fcat_init-seltext_s = txt.
gs_fcat_init-col_pos = pos.
gs_fcat_init-outputlen = out_len.
append gs_fcat_init to gt_fcat .
endform .
‎2008 Sep 05 7:08 AM
Hi Rachel,
Instead of fetching data using PERNR , fetch data using company code (BUKRS) which is present in PA0001 table.
select pernr from pa0001 into table it_pernr where bukrs = ccode.
Hope this helps
Thanks
Lakshman
‎2008 Sep 05 6:56 AM
Hi....
tables: pa0001
select-options: s_pernr for pa0001-pernr.
select * from ------ where pernr in s_pernr.we can change it as....
parameters: p_bukrs like pa0002-bukrs.
select * from ----- where bukrs = p_bukrs.Thanks,
Naveen.I
‎2008 Sep 05 6:59 AM
Pls put your code in code section Surrounded for better visibility.
‎2008 Sep 05 7:08 AM
Hi Rachel,
Instead of fetching data using PERNR , fetch data using company code (BUKRS) which is present in PA0001 table.
select pernr from pa0001 into table it_pernr where bukrs = ccode.
Hope this helps
Thanks
Lakshman
‎2008 Sep 05 7:33 AM
Thank you soooooo much laxmanan . thanx a lot for your timely help.
Regards
Rachel
‎2008 Sep 05 7:49 AM
Hi lakshman
if both the condition has to retained
like i can enter my personal number as well my company code
can i write my two select stament
SELECT PERNR FROM PA0000 INTO TABLE IT_PERNR WHERE PERNR IN S_PERNR.
select pernr from pa0001 into table it_pernr where bukrs = p_ccode.
if i write like this ...i am getting the data
or wat can be done
sorry for the trouble and thnx for the help\
Regards
Rachel
‎2008 Sep 05 8:03 AM
Hi Rachel,
You can use both the conditions in the same select statement,
select pernr from pa0001 into table it_pernr where pernr in s_pernr and bukrs = p_ccode.
Hope this helps
Thanks
Lakshman
‎2008 Sep 05 8:04 AM
Hi....Rache..
select * from ------ where pernr in s_pernr
and bukrs = p_bukrs.Do like this.
Thanks,
Naveen.I
‎2008 Sep 05 8:09 AM
hi
iam using two tables
pa0000 personal no
pa0001 company code
then how can i use
ELECT PERNR FROM PA0000 INTO TABLE IT_PERNR WHERE PERNR IN S_PERNR and bukrs = p_ccode.
pls any other solutions
Thanx a lot
Rachel
‎2008 Sep 05 8:31 AM
Hi Rachel,
define another internal table,
data: begin of it_pernr1 occurs 0 ,
pernr type pa0000-pernr ,
end of it_pernr1.
SELECT PERNR FROM PA0001 INTO TABLE IT_PERNR1 for all entries in table it_pernr WHERE pernr = it_pernr-pernr and bukrs = p_ccode.
Then use IT_PERNR1 for further processing.
Another way is to fetch data into the new internal table.
SELECT PERNR FROM PA0001 INTO TABLE IT_PERNR1 for WHERE bukrs = p_ccode.
Then delete entries in it_pernr internal table for the entries avialable in it_pernr1 and use it_pernr for further processing.
loop at it_pernr1.
read table it_pernr with key pernr = it_pernr1-pernr.
if sy-subrc = 0.
delete it_pernr index sy-tabix.
endif.
endloop.
hope this helps.
Thanks
Lakshman
‎2008 Sep 05 10:09 AM
hi i have given in this way...
select-options s_pernr for pernr-pernr .
parameters p_ccode type bseg-bukrs.
parameters p_year type bkpf-gjahr .
select pernr from pa0001 into table it_pernr where pernr in s_pernr and bukrs = p_ccode.
but the problem is that...it is fetching only if i give the company code.
they want it irrespective of the ccode,
(i.e) if i give personal number
and year
it shud fetch data,
and if i give ccode and year
it shud fetch data...
wat can be done in the existing select statement
Thanx for showing interest and for kindly and timely help
Regards
RAchel
‎2008 Sep 05 10:11 AM
Hi....
Do one thing...
select-options: s_ccode for pa0002-bukrs no extention no-intervals.
select pernr from pa0001 into table it_pernr where pernr in s_pernr and bukrs in s_ccode.delare company code like this...
Because parameters do the same...
Or...
you can go for Ranges...
Or one more way is...
select-options s_pernr for pernr-pernr .
parameters p_ccode type bseg-bukrs.
parameters p_year type bkpf-gjahr .
if p_ccode is not initail.
select pernr from pa0001 into table it_pernr where pernr in s_pernr and bukrs = p_ccode.
else.
select pernr from pa0001 into table it_pernr where pernr in s_pernr.
endif.Thanks,
Naveen.I
‎2008 Sep 05 10:28 AM
thanx naveen
its working ...let me release the request but then they keep on changing the requir....:( will face it anyways...thanx
Regards
Rachel
‎2008 Sep 05 10:38 AM
Hi....
Have a look at RANGES.
This concept is also mandatory in certain conditions.
You can see F1 documentation for this and
also SDN search...
Thanks,
Naveen.I
‎2008 Sep 06 8:30 AM
hi EXPERT
i want to take off the duplicates
eg
Emp Name
BALAJI
BALAJI
Bala
nela
anbu
MUMBAI
R
R
Amman
Amman
i have used
1. SORT it_final.
DELETE ADJACENT DUPLICATES FROM it_final.
and
2. select distict -
but i dont find any change
it appears with duplicates
...
CAN YOU PLS HELP ME OUT
THANX IN ADVANCE.\
RACHEL
‎2008 Sep 06 8:54 AM
Hi Arun
try this -
DELETE ADJACENT DUPLICATES FROM IT_ITAB COMPARING <col_name>.
or
DELETE ADJACENT DUPLICATES FROM IT_ITAB COMPARING all fields.