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

Work area

Former Member
0 Likes
322

Hello gurus,

I'm not an ABAP man, but i need to do this, and it's not working.

My pre-requisite is to extract two fields on extractor 0employee_attr (enhancement append). This two fields, one of them is an date field and i want to get the last date from pa0302 with massn equals to 34.

My code is this:

WHEN '0EMPLOYEE_ATTR'.

TABLES: pa0302.

DATA: lv_tabix TYPE sy-tabix,

zahrms_biw_io_occupancy TYPE hrms_biw_io_occupancy.

DATA: lt_occupancy TYPE TABLE OF hrms_biw_io_occupancy WITH HEADER LINE,

lt_occupancy_wa TYPE hrms_biw_io_occupancy.

DATA: wa TYPE pa0302,

wa_line type pa0302.

LOOP AT i_t_data INTO zahrms_biw_io_occupancy.

lv_tabix = sy-tabix.

  • Seleccionar todos os registos do empregado com medida 34 da tabela PA0302

SELECT * FROM pa0302 INTO wa WHERE

pernr EQ zahrms_biw_io_occupancy-pernr AND massn EQ '34'

ORDER BY begda DESCENDING.

  • Atribui valores aos campos da estrutura append

zahrms_biw_io_occupancy-zzzmassn = wa-massn.

zahrms_biw_io_occupancy-zzzdata_medida = wa-begda.

  • Modifica tabela temporária de acordo com o primeiro registo que será o mais recente

  • ZAHRMS_BIW_IO_OCCUPANCY = lt_occupancy_wa.

  • Modifica estrutura de extracção final com os dados pretendidos

MODIFY i_t_data FROM zahrms_biw_io_occupancy.

ENDSELECT.

ENDLOOP.

ENDCASE."

The problem is that when i get date field (zahrms_biw_io_occupancy-zzzdata_medida = wa-begda), it run two times (is on the select). I need that it gives me the first value from wa (the upper date of massn = 34).

Could you please help me?

Vitor Ramalho

P.S. Points will be reagarded.

1 ACCEPTED SOLUTION
Read only

George_Lioumis
Active Participant
0 Likes
289

Hi.

Write the select as follows:

SELECT * FROM pa0302 INTO wa WHERE

pernr EQ zahrms_biw_io_occupancy-pernr AND

massn EQ '34'

ORDER BY begda DESCENDING.

zahrms_biw_io_occupancy-zzzmassn = wa-massn.

zahrms_biw_io_occupancy-zzzdata_medida = wa-begda.

exit.

ENDSELECT.

if sy-subrc = 0.

MODIFY i_t_data FROM zahrms_biw_io_occupancy.

endif.

Regards,

George

1 REPLY 1
Read only

George_Lioumis
Active Participant
0 Likes
290

Hi.

Write the select as follows:

SELECT * FROM pa0302 INTO wa WHERE

pernr EQ zahrms_biw_io_occupancy-pernr AND

massn EQ '34'

ORDER BY begda DESCENDING.

zahrms_biw_io_occupancy-zzzmassn = wa-massn.

zahrms_biw_io_occupancy-zzzdata_medida = wa-begda.

exit.

ENDSELECT.

if sy-subrc = 0.

MODIFY i_t_data FROM zahrms_biw_io_occupancy.

endif.

Regards,

George