cancel
Showing results for 
Search instead for 
Did you mean: 

help in shifting field

Former Member
0 Kudos

Hallow I have field of org. unit and I wont that the number of org unit move like the level of the org unit in the structure. I use the function to bring the org.unit and the org.unit below and the level .

I just wont make the org.unit field bigger and move the org.unit in field accordingly to the level that I get from the function.)

<b>Ex.</b>

Org unit level

163****** 1

182*****2

121****3

825 ** 4

163****** 1

Without the asterisk it just for the ex.

LOOP AT org_itab INTO wa_org_itab-objid.

CALL FUNCTION 'RHPH_STRUCTURE_READ'

EXPORTING

plvar = '01'

otype = 'O'

objid = wa_org_itab-objid

wegid = 'ORGEH'

begda = sy-datum

endda = sy-datum

  • PUP_INFO = 'X'

  • WITH_STEXT = 'X'

  • TDEPTH = 0

TABLES

stru_tab = stru_tab

  • EXCEPTIONS

  • CATALOGUE_PROBLEM = 1

  • ROOT_NOT_FOUND = 2

  • WEGID_NOT_FOUND = 3

  • OTHERS = 4

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDLOOP.

MOVE wa_stru_tab-objid TO wa_t_itab-org_unit.

<b>

Thanks for your suggestion.</b>

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

just try like this

data : begin of itab occurs 0,

datas(8),

end of itab.

data : no(1),

pos type i.

itab-datas = '1631'.

append itab.

itab-datas = '1822'.

append itab.

itab-datas = '1213'.

append itab.

itab-datas = '8254'.

append itab.

itab-datas = '1631'.

append itab.

loop at itab.

no = itab-datas+3(1).

shift itab-datas by no places right.

modify itab.

endloop.

regards

shiba dutta

Former Member
0 Kudos

myabe some one have ex. for shifting

thankes

Former Member
0 Kudos

sorry here u can see the ex. better .

Org unit level

163****** 1

182****2

*121***3

***825 ** 4

163****** 1

regards

Former Member
0 Kudos
LOOP AT org_itab INTO wa_org_itab-objid.

CALL FUNCTION 'RHPH_STRUCTURE_READ'
EXPORTING
plvar = '01'
otype = 'O'
objid = wa_org_itab-objid
wegid = 'ORGEH'
begda = sy-datum
endda = sy-datum
* PUP_INFO = 'X'
* WITH_STEXT = 'X'
* TDEPTH = 0
TABLES
stru_tab = stru_tab
* EXCEPTIONS
* CATALOGUE_PROBLEM = 1
* ROOT_NOT_FOUND = 2
* WEGID_NOT_FOUND = 3
* OTHERS = 4
.
IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

SHIFT wa_stru_tab-objid BY level PLACES RIGHT.
MOVE wa_stru_tab-objid TO wa_t_itab-org_unit.
APPEND wa TO itab.
ENDLOOP.

SHIFT string1 BY level PLACES RIGHT.
WRITE / string1.

So level will have the number of right?

Try this may work.

Former Member
0 Kudos

hi judith

i have a problem that after i do the shift statment the field is change and i dont have the org unit just the level .

regards

Former Member
0 Kudos

Could you please be more specific.

If possible explain through ur code.

Former Member
0 Kudos

hi jidith

This I what I do after the function

and in teken_itab-org_unit bring not the org_unit num it bring the level

regards

I bring some field fromstructre tab into teken itab

LOOP AT stru_tab INTO wa_stru_tab.

*----


  • Select Org. Unit Name

*----


CLEAR yhida_stext.

yhida_stext = wa_stru_tab-stext.

MOVE yhida_stext TO wa_teken_itab-yhida_name.

<b>SHIFT wa_stru_tab-objid BY wa_stru_tab-level PLACES RIGHT</b>.

MOVE wa_stru_tab-objid TO wa_teken_itab-org_unit.

*----


  • Select Teken misrot / Reference Number to Table Part

*----


SELECT SINGLE tabnr

FROM hrp1019

INTO wa_teken_itab-tabnr

WHERE objid = wa_stru_tab-objid

AND plvar ='01'

AND otype = 'O'

AND begda <= so_date

AND endda => so_date.

  • IF sy-subrc = 0.

IF sy-subrc NE 0.

wa_teken_itab-yhida_name = yhida_stext.

APPEND wa_teken_itab TO teken_itab.

CLEAR wa_teken_itab.

ELSE.

SELECT amount jobid " Amount of misrot

FROM hrt1019

INTO (wa_teken_itab-amount , wa_teken_itab-jobid )

WHERE tabnr = wa_teken_itab-tabnr.

IF sy-subrc = 0.

MOVE wa_stru_tab-objid TO wa_teken_itab-org_unit.

ENDIF.

teken_hour = ( 185 * wa_teken_itab-amount ).

MOVE teken_hour TO wa_teken_itab-teken_hour.

APPEND wa_teken_itab TO teken_itab.

CLEAR wa_teken_itab.

ENDSELECT.

ENDIF.

ENDLOOP.

Former Member
0 Kudos

What u can do is, before display u will be having it in an internal table right?

Then before display LOOP at the itab and within that u shift based on the level and modify the org. unit based on level.

LOOP AT teken_itab INTO wa_teken_itab.
 SHIFT wa_teken_itab-org_unit BY wa_teken_itab-level PLACES RIGHT.
 MODIFY wa_teken_itab.
CLEAR wa_teken_itab.
ENDLOOP.

Hope I am clear.

Former Member
0 Kudos

i try it and it ihave the same problem

thankes antway