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

sort one field

Former Member
0 Likes
809

Hi friends,

INFOTYPES: 0000, 0001, 0002.

START-OF-SELECTION.

GET PERNR .

PROVIDE * FROM P0000 BETWEEN PN-BEGDA AND PN-ENDDA where p0000-STAT2 = '3'.

WRITE: /2 P0000-PERNR, 23 P0001-ENAME,

91 P0001-BTRTL ,114 P0002-GBDAT .

ENDPROVIDE.

SELECT PLSTX PLANS FROM T528T INTO (ITAB-PLSTX, ITAB-PLANS) WHERE PLANS = P0001-PLANS.

WRITE: 57 ITAB-PLSTX.

ENDSELECT.

END-OF-SELECTION.

Here i wanna sort GBDAT which is date of birth in ascending order.

thanks in advance,

sk

Hi friends,

INFOTYPES: 0000, 0001, 0002.

START-OF-SELECTION.

GET PERNR .

PROVIDE * FROM P0000 BETWEEN PN-BEGDA AND PN-ENDDA where p0000-STAT2 = '3'.

WRITE: /2 P0000-PERNR, 23 P0001-ENAME,

91 P0001-BTRTL ,114 P0002-GBDAT .

ENDPROVIDE.

SELECT PLSTX PLANS FROM T528T INTO (ITAB-PLSTX, ITAB-PLANS) WHERE PLANS = P0001-PLANS.

WRITE: 57 ITAB-PLSTX.

ENDSELECT.

END-OF-SELECTION.

Here i wanna sort GBDAT which is date of birth in ascending order.

thanks in advance,

sk

6 REPLIES 6
Read only

Former Member
0 Likes
770

Whats the solution?

Read only

0 Likes
770

hi,

i have given coding. U see this coding. Tell me the answer.

Because i m new in ABAP-HR well as ABAP.

bye

sk

Read only

0 Likes
770

Dear Sandeep,

Provide in HR-ABAP works like a loop in Normal ABAP.

The infotype records are imported to internal table Pnnnn (e.g. P0001 for infotype 0001). These tables are then processed in PROVIDE-ENDPROVIDE loop.

If You want to access records of two infotypes in a single Provide.. You can use code similar to following.

PROVIDE * FROM P0001

  • FROM P0002

BETWEEN PN-BEGDA AND PN-ENDDA.

WRITE:/ .....

END PROVIDE.

And remember that P0001 and P0002 are internal tables.. if you want all the data in the sorted format .. you can append the data into another Internal table (e.g I_PA0001), and Print it after the END_OF_SELECTION event.. sort by the field you want to, and Print, this would solve your sorting problem..

Read only

0 Likes
770

Hi,

See this.

========

&----


*& Report ZSCD_TEST14

*&

&----


*&

*&

&----


REPORT ZSCD_TEST14.

INFOTYPES: 0000, 0001, 0002.

tables : pernr, t528T.

types: begin of ty_p0000,

pernr type p0000-pernr,

ename type p0001-ename,

btrtl type p0001-btrtl,

gbdat type p0002-gbdat,

PLSTX type T528T-PLSTX,

end of ty_p0000.

data: it_p0000 type standard table of ty_p0000,

wa_p0000 type ty_p0000.

START-OF-SELECTION.

GET PERNR .

PROVIDE * FROM P0000 BETWEEN PN-BEGDA AND PN-ENDDA where p0000-STAT2 = '3'.

wa_p0000-pernr = p0000-pernr.

wa_p0000-ename = p0001-ename.

wa_p0000-btrtl = p0001-btrtl.

wa_p0000-gbdat = p0002-gbdat.

ENDPROVIDE.

SELECT PLSTX PLANS FROM T528T INTO (t528T-PLSTX, t528T-PLANS) WHERE PLANS = P0001-PLANS.

*WRITE: 57 t528T-PLSTX.

wa_p0000-plstx = t528T-plstx.

append wa_p0000 to it_p0000.

ENDSELECT.

END-OF-SELECTION.

sort it_p0000 by GBDAT.

loop at it_p0000 into wa_p0000.

WRITE: /2 wa_p0000-PERNR, 23 wa_p0000-ENAME,

60 wa_p0000-BTRTL ,75 wa_p0000-GBDAT , 90 wa_p0000-plstx.

endloop.

========

reagrds,

Read only

0 Likes
770

Hi Ramesh ,

I m really very thankful to u for ur very important guidence for me.

Thanks,

SK

Read only

0 Likes
770

Hi Pranu,

I m thankful for u also . U have provided me very important coding for problem solving and as a learning point of view .

Thanks,

sk