Posted: Sat Oct 13, 2007 1:08 pm Post subject: Retrieve Org. Unit text
Shows how to retrieve org unit text
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.
Code:
*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
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.