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

using do varying

Former Member
0 Likes
2,822

hi,

i am new to hr abap..in the infotype PA0008 we have the field wage type(LGA01) and the corresponding amount (BET01)...they are ranges from one to 40 for the wage types...for the particular wage type the wage amount is displayed..now if i want to check for the particualr value 1000 int he wage amount i need to get displayed the wage type...my doubt is if i use the do varyin condition do i get just only the positon of the range or the value???suppose the particular wage amount is in the lga31 type do i get the value or just only the postion of the wage type??

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
0 Likes
1,770

You get the the value and WT intself.

Look at below code.


DATA: GWA_0008 TYPE PA0008,
LGART TYPE PA0008-LGA01,
BETRG TYPE PA0008-BET01.

SELECT SINGLE * FROM PA0008 INTO GWA_0008.

DO 40 TIMES
VARYING LGART FROM GWA_0008-LGA01 NEXT GWA_0008-LGA02
VARYING BETRG FROM GWA_0008-BET01 NEXT GWA_0008-BET02.
  if sy-index = 31.
  "here  LGART will store WT and BETRG corresponding value to it (for LGA31 and BET31)
  endif
ENDDO.

I hope now it is clear.

Regards

Marcin

3 REPLIES 3
Read only

Former Member
0 Likes
1,770

Hi,

did you try F1 on varying? Have also a look into sy-index in the DO-Loop.

Regards, Dieter

Read only

MarcinPciak
Active Contributor
0 Likes
1,771

You get the the value and WT intself.

Look at below code.


DATA: GWA_0008 TYPE PA0008,
LGART TYPE PA0008-LGA01,
BETRG TYPE PA0008-BET01.

SELECT SINGLE * FROM PA0008 INTO GWA_0008.

DO 40 TIMES
VARYING LGART FROM GWA_0008-LGA01 NEXT GWA_0008-LGA02
VARYING BETRG FROM GWA_0008-BET01 NEXT GWA_0008-BET02.
  if sy-index = 31.
  "here  LGART will store WT and BETRG corresponding value to it (for LGA31 and BET31)
  endif
ENDDO.

I hope now it is clear.

Regards

Marcin

Read only

Former Member
0 Likes
1,770

This message was moderated.