Open all | Close all
|
Retrieve text for Organisation unit
| Retrieve text for Organisation unit |
|
Simply use the code below to retrieve the organisation unit text. Using the function module will return the
full text as seen in PA20 where as using table t527x will only return the first 25 characters of the org. text.
|
DATA: ld_orgtx(40) type c.
*Retrieve Org. Unit text
PERFORM get_org_unit USING p0001-orgeh
p0001-begda
p0001-endda
CHANGING ld_orgtx.
*&---------------------------------------------------------------------*
*& Form get_org_unit
*&---------------------------------------------------------------------*
* Retrieve Org. Unit text
*----------------------------------------------------------------------*
FORM get_org_unit USING p_orgeh
p_begda
p_endda
CHANGING p_orgtx.
DATA: orgeh_short(12) TYPE c,
orgeh_stext(40) TYPE c,
read_return TYPE i.
* Returns full orgunit text, entry in table t527x is sometimes
* truncated so that it fits into a 25 character field
CALL FUNCTION 'HR_READ_FOREIGN_OBJECT_TEXT'
EXPORTING
otype = 'O'
* otype = ot_orgunit
objid = p_orgeh "p0001-orgeh
begda = p_begda "p0001-begda
endda = p_endda "p0001-endda
reference_date = p_begda "p0001-begda
IMPORTING
short_text = orgeh_short
object_text = orgeh_stext
return = read_return
EXCEPTIONS
nothing_found = 1
wrong_objecttype = 2
missing_costcenter_data = 3
missing_object_id = 4
OTHERS = 5.
IF sy-subrc EQ 0.
p_orgtx = orgeh_stext.
ELSE.
* If function module fails return text from text table
select single orgtx
from t527x
into p_orgtx
where orgeh eq p_orgeh and "Replace with org. unit field
sprsl eq sy-langu and
( endda ge sy-datum and
begda le sy-datum ).
ENDIF.
ENDFORM. " get_org_unit
|
|
|