Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

loop problem

Former Member
0 Likes
487

Hi Guy's,

Please help me, changed parameter as select-option for this purpose changed code little bit. report out put displaying fundcenters details. but i changed at selection screen checked output it displaying after one fundcenter information 2nd fundcenter inforamtion comes along with like: 2fundcenter information --1fundcenter information.

please suggest me where i did mistake.

INITIALIZATION .

PERFORM fill_selcri_sberei .

AT SELECTION-SCREEN.

IF NOT spdatv[] IS INITIAL.

IF spdatv-low LT '20060601'

AND ( rb_ax_y EQ 'X' OR

rb_ax_a EQ 'X' ).

MESSAGE

'Deprt should be Greater than June 1 2006, If Amex Serv is Selected'

TYPE 'E'.

ENDIF.

ENDIF.

IF spdatv[] IS INITIAL.

IF rb_ax_y EQ 'X' OR

rb_ax_a EQ 'X'.

MESSAGE

'Deprt should be Greater than June 1 2006, If Amex Serv is Selected'

TYPE 'E'.

ENDIF.

ENDIF.

  • Start of selection ----------------------------------------

START-OF-SELECTION.

  • Move the select options to internal tables (import parameter for fn)

move_sel_option : sel_buk s_bukrs ,

sel_pern s_pernr ,

sreinr s_reinr ,

spdatv s_pdatv ,

sberei s_berei .

***----


select fictr

into table it_fc

from FMFCTR

where fictr in s_fictr.

**----


  • Call the function to get all trips corresponding to sel criteria

clear wa_fc.

loop at it_fc into wa_fc.

CALL FUNCTION 'ZHR_GET_FUND_TRIPS'

EXPORTING

  • p_fictr = p_fictr

p_fictr = wa_fc-fictr

p_sub = p_sub

TABLES

s_bukrs = s_bukrs

s_pernr = s_pernr

s_reinr = s_reinr

s_pdatv = s_pdatv

s_berei = s_berei

i_trip = i_trip

EXCEPTIONS

OTHERS = 1.

"all itrips should be amex used y and trip not cancelled?

IF rb_ax_y = 'X' OR rb_ax_a = 'X'.

DELETE i_trip WHERE usr_ax_ser_used = 'N'.

ENDIF.

IF rb_ax_n = 'X' OR rb_ax_n1 = 'X'.

DELETE i_trip WHERE usr_ax_ser_used = 'Y'.

ENDIF.

*endloop. "&&&&&&&&

  • Generate the data for list output

LOOP AT i_trip .

  • check if duty country is US in dbtab ZOVTFLAG

IF i_trip-usr_ax_ser_used EQ 'N'.

SELECT * FROM zovtflag UP TO 1 ROWS

WHERE pernr = i_trip-pernr

AND start_date <= i_trip-pdatv " at departure

AND end_date >= i_trip-pdatv

AND duty_country = 'US' .

ENDSELECT.

IF sy-subrc NE 0 .

CONTINUE .

ENDIF .

ENDIF.

MOVE-CORRESPONDING i_trip TO i_output .

PERFORM get_other_trans.

PERFORM get_subgrp_txt . " get employee subgrp 06.07.02

PERFORM get_pnr_info . " get the PNR number 06.07.02

  • Get airfare status details from dbtab ZTVL_AIR_INFO

SELECT SINGLE * FROM ztvl_air_info

WHERE reinr = i_trip-reinr .

IF sy-subrc = 0 .

PERFORM get_amt_comment .

ELSE . " no record found in ZTVL_AIR_INFO

i_output-flgzero = 'X' .

i_output-comment = text-018.

i_output-exp_type = 'A'.

ENDIF .

  • find out if the trip was accounted after departure, change comment

CLEAR v_accdt .

SELECT accdt pdvrs FROM zptrv_perio INTO (v_accdt, v_dummy)

UP TO 1 ROWS

WHERE pernr = i_trip-pernr

AND reinr = i_trip-reinr

AND uebrf = '1'

ORDER BY pdvrs DESCENDING .

ENDSELECT .

IF v_accdt > i_trip-pdatv AND i_output-flgzero = 'X' .

i_output-comment = text-020.

i_output-exp_type = 'C'.

ENDIF .

*endloop. "&&&&&&&&

APPEND i_output . CLEAR i_output .

ENDLOOP .

  • Write the output

SORT i_output BY comment pernr.

*Expenses Diners Accounted Message # Text

*Nul Nul Before Depart 18 Air Exp not posted (No Accr, No Diners)

*0 0 Before Depart 14 Airfare Expenses not charged

*0 0 Aft Deprt 20 Trip was acc after deprt(No Accr, No Din)

*0 $ Before Depart 17 Air exp for Diners (No Accr)

*$ 0 Before Depart 1 Air Exp Accrued, No Diners Posting

*$ $ N/A 2 Air Exp (Accrued and Diners Posting)

  • Message 20 was made the same as message 18. Sara email

  • old msg 020: Trip was accounted (No Accr, No Diners)

  • flgzero = A = accrued, no diners

  • flgzero = X = no accrual, no diners

  • flgzero = ' ' = accrued and diners

IF rb_ax_y = 'X'.

"only A & B & C (should not occur)

DELETE i_output WHERE exp_type EQ 'D'

OR exp_type EQ 'E'

OR exp_type EQ 'F'.

ENDIF.

IF rb_ax_a = 'X'.

"only e

DELETE i_output WHERE exp_type EQ 'A'

OR exp_type EQ 'B'

OR exp_type EQ 'C'

OR exp_type EQ 'D'

OR exp_type EQ 'F'.

ENDIF.

IF rb_ax_n = 'X'.

"only A & B

DELETE i_output WHERE exp_type EQ 'C'

OR exp_type EQ 'D'

OR exp_type EQ 'E'

OR exp_type EQ 'F'.

ENDIF.

IF rb_ax_n1 = 'X'.

"only c

DELETE i_output WHERE exp_type EQ 'A'

OR exp_type EQ 'B'

OR exp_type EQ 'D'

OR exp_type EQ 'E'

OR exp_type EQ 'F'.

ENDIF.

LOOP AT i_output.

                                        • jid 3/23/07 ***************

  • if the trip/upi is in amd_detail 'amex' cash

  • batch, don't print it. Assume that it's been

  • ticketed

SELECT SINGLE * FROM zamd_detail INTO

wa_in_cash_batch

WHERE traveller_id = i_output-pernr

AND trip_num = i_output-reinr

AND card_type = 'AMEX'

AND charge_type = 'A'. " only cash batch airfare

IF sy-subrc EQ 0.

CONTINUE.

ENDIF.

                                        • jid 3/23/07 ***************

AT NEW comment.

NEW-PAGE.

ENDAT.

  • IF p_selall = ' ' AND i_output-flgzero = ' ' .

  • CONTINUE .

  • ENDIF .

WRITE 😕 i_output-pernr COLOR 2,

i_output-ename COLOR 2,

i_output-ptext COLOR 2,

72 i_output-gsber COLOR 2,

79 i_output-reinr COLOR 2,

i_output-pdatv COLOR 2,

i_output-pdatb COLOR 2,

112 i_output-startcitydesc COLOR 2,

(14) i_output-expamt COLOR 2,

i_output-expdate COLOR 2,

  • i_output-comment COLOR 2, "put in heading 3rd line

i_output-ptr_pnrloc COLOR 2,

i_output-ptr_sbr_reinr COLOR 2,

i_output-ptr_exp_air_fare COLOR 2,

(14) i_output-other_trans_amt COLOR 2.

flg_dataexist = 'X' .

AT END OF pernr.

ULINE.

ENDAT.

ENDLOOP .

IF flg_dataexist NE 'X' .

MESSAGE i028 .

ELSE .

  • Write selection criteria at the end of the list

WRITE :sy-uline ,

'Selection criteria' COLOR 3 INTENSIFIED OFF.

  • WRITE: /'Company Code:' , sel_buk-low COLOR 2,

  • ' to', sel_buk-high COLOR 2,

WRITE: /'Fund Center :' , wa_fc-fictr COLOR 2.

"p_fictr COLOR 2 IF NOT p_sub IS INITIAL .

WRITE '(Including Subordinates)' .

ENDIF .

WRITE : /'Personnel No:', sel_pern-low COLOR 2,

' to' , sel_pern-high COLOR 2,

/'Trip Number :' , sreinr-low COLOR 2,

'to' , sreinr-high COLOR 2,

/'Departure Dt:' ,spdatv-low COLOR 2,

'to' , spdatv-high COLOR 2 .

IF rb_ax_y = 'X'.

WRITE: / text-032, 'and', text-027.

ENDIF.

IF rb_ax_n = 'X'.

WRITE: / text-033, 'and', text-028.

ENDIF.

IF rb_ax_n1 = 'X'.

WRITE: / text-033, 'and', text-031.

ENDIF.

IF rb_ax_a = 'X'.

WRITE: / text-032,'and', text-029.

ENDIF.

WRITE sy-uline .

ENDIF .

*clear wa_fc.

endloop.

  • Top of Page

TOP-OF-PAGE .

FIELDS OF i_output

WHERE pernr = i_output-pernr

AND ptr_trip_st_dt = i_trip-pdatv.

ENDSELECT.

ENDIF .

ENDIF .

ENDFORM. " GET_PNR_INFO

&----


*& Form GET_SUBGRP_TXT

&----


  • Get employee sungrp description

----


FORM get_subgrp_txt.

SELECT SINGLE ptext FROM t503t INTO i_output-ptext

WHERE sprsl = 'E'

AND persk = i_trip-persk.

ENDFORM. " GET_SUBGRP_TXT

Edited by: sai shanhu on Jul 16, 2008 5:51 PM

1 ACCEPTED SOLUTION
Read only

Clemenss
Active Contributor
0 Likes
441

Hi Sai,

please include code lines in \

...

sequence. Then it is possible to read it.

Regards,

Clemens

2 REPLIES 2
Read only

Clemenss
Active Contributor
0 Likes
442

Hi Sai,

please include code lines in \

...

sequence. Then it is possible to read it.

Regards,

Clemens

Read only

Former Member
0 Likes
441

Hi Sai,

Its better if you debug the program and check out. It will be more helpful. Because I am not knowing what are what in the code you have pasted. Did you paste the code completely? I find something missing in the function Module you are calling and also in the MOVE statements you are using . Just check them once again.

Regards,

Swapna.