2007 Mar 12 5:56 PM
Hi,
I have selected a couple of personnal numbers (key) and i loop them into wa_pernr_select which is used in an functional module (HR_READ_INFOTYPE) to get information for this personal number.
What i want to do is to exclude the record if a certain condition is true (bukrs ne bukrs).
I don't want to exit the whole loop just exclude a specific record. I have tried with continue and exit but i doesn't seem to work. Any suggestions?
LOOP AT it_pernr INTO wa_pernr_sel.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
tclas = 'A'
pernr = wa_pernr_sel
infty = '0001'
.........
TABLES
infty_tab = p0001_endda
......
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
tclas = 'A'
pernr = wa_pernr_sel
infty = '0001'
.........
TABLES
infty_tab = p0001_begda
......
IF p0001_begda-bukrs NE p0001_endda-bukrs.
EXIT.
ELSE.
MOVE p0001_endda-bukrs TO wa_out_data_wage-bukrs.
ENDIF.
ENDLOOP.
Best Regards
Claes
2007 Mar 12 6:10 PM
I wonder why CONTINUE will not work in the place of EXIT in your current code.
You can also use
CHECK p0001_begda-bukrs EQ p0001_endda-bukrs.
MOVE p0001_endda-bukrs TO wa_out_data_wage-bukrs.
I also see that p0001_begda and p0001_endda are internal tables and will NOT make sense to compare like p0001_begda-bukrs EQ p0001_endda-bukrs, as here you are only comparing the headers which MAY or MAY NOT contain data which makes sense to compare. What if both the tables have multiple rows of data, how will you compare BUKRS fields from multiple rows then?
Hi,
I have selected a couple of personnal numbers (key) and i loop them into wa_pernr_select which is used in an functional module (HR_READ_INFOTYPE) to get information for this personal number.
What i want to do is to exclude the record if a certain condition is true (bukrs ne bukrs).
I don't want to exit the whole loop just exclude a specific record. I have tried with continue and exit but i doesn't seem to work. Any suggestions?
LOOP AT it_pernr INTO wa_pernr_sel.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
tclas = 'A'
pernr = wa_pernr_sel
infty = '0001'
.........
TABLES
infty_tab = p0001_endda
......
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
tclas = 'A'
pernr = wa_pernr_sel
infty = '0001'
.........
TABLES
infty_tab = p0001_begda
......
IF p0001_begda-bukrs NE p0001_endda-bukrs.
EXIT.
ELSE.
MOVE p0001_endda-bukrs TO wa_out_data_wage-bukrs.
ENDIF.
ENDLOOP.
Best Regards
Claes
2007 Mar 12 6:02 PM
Hi,
Please try this if continue or exit doesn't work.
LOOP AT it_pernr INTO wa_pernr_sel.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
tclas = 'A'
pernr = wa_pernr_sel
infty = '0001'
.........
TABLES
infty_tab = p0001_endda
......
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
tclas = 'A'
pernr = wa_pernr_sel
infty = '0001'
.........
TABLES
infty_tab = p0001_begda
......
IF p0001_begda-bukrs EQ p0001_endda-bukrs.
MOVE p0001_endda-bukrs TO wa_out_data_wage-bukrs.
ENDIF.
ENDLOOP.
Regards,
Ferry Lianto
2007 Mar 12 6:02 PM
Replace this....
IF p0001_begda-bukrs NE p0001_endda-bukrs.
EXIT.
ELSE.
MOVE p0001_endda-bukrs TO wa_out_data_wage-bukrs.
ENDIF.
With this -;)
IF p0001_begda-bukrs NE p0001_endda-bukrs.
CONTINUE.
ELSE.
MOVE p0001_endda-bukrs TO wa_out_data_wage-bukrs.
ENDIF.
Greetings,
Blag.
2007 Mar 12 6:09 PM
How did you define your internal tables p0001_endda and p0001_begda? Do they have header lines?
If not, your IF does not make sense (and even if they do it is not clean the way you do it since the FM might have processed the table and therefor set your header line randomly).
Did you set a break point and check before the IF?
2007 Mar 12 6:10 PM
I wonder why CONTINUE will not work in the place of EXIT in your current code.
You can also use
CHECK p0001_begda-bukrs EQ p0001_endda-bukrs.
MOVE p0001_endda-bukrs TO wa_out_data_wage-bukrs.
I also see that p0001_begda and p0001_endda are internal tables and will NOT make sense to compare like p0001_begda-bukrs EQ p0001_endda-bukrs, as here you are only comparing the headers which MAY or MAY NOT contain data which makes sense to compare. What if both the tables have multiple rows of data, how will you compare BUKRS fields from multiple rows then?
2007 Mar 12 6:36 PM
Hi,
I thought that this should work since it is only possible for a person to have one (1) bukrs at a specific time. But obviously it doesn't....
Have you any suggestions of how i can do instead?
Regards
Claes
2007 Mar 12 6:42 PM
Well, if you known (and validated) that 1 employee can only have 1 comp code and that all the records in the table have the same BUKRS, you can read the 1st record of each table in a work area and compare those.
Guenther
2007 Mar 12 6:38 PM
Hey,
Are you using the p0001_endda and p0001_begda for importing data or exporting.
If you are using this for importing then your logic doesn't work coz data in both the tables is same. Same parameters yield same output.
If you have the table as export parameters then try debugging and getting the scenario with different data.
This requirement of yours is a logical error. Check the logic or send complete details for help.
Let me know if you have any more questions.
Regards
Rakeesh
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |