cancel
Showing results for 
Search instead for 
Did you mean: 

Fetching decription from table HRT1002

Former Member
0 Kudos

This is related to learning and development.

How can description(text) be fetched from table HRT1002 which one gets by passing TABNR?

TABNR i got from table HRP1002 subty (002,003,004) by passing object id of the business event.

I need to fetch that text in a subroutine pool and pass it to sap script to be displayed there.

That text is very large.

Response will be appreciated.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member214498
Contributor
0 Kudos

Hi Mohit

CALL FUNCTION 'RH_READ_HRP1002'

EXPORTING

ACT_PLVAR = my_obj-plvar

ACT_OTYPE = my_obj-otype

ACT_OBJID = my_obj-objid

ACT_SUBTY = '0120'

ACT_LANGU = 'E'

ACT_BEGDA = gk_par_tab-begda

ACT_ENDDA = gk_par_tab-endda

TABLES

ACT_P1002 = itab

EXCEPTIONS

NO_DATA_FOUND = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

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

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

ENDIF.

read table itab with key subty = '0003'. " reading the first two lines of notes

IF SY-SUBRC = 0.

SELECT * INTO wa_1002 FROM HRT1002

WHERE TABNR = itab-tabnr.

IF wa_1002-TABSEQNR = '000001'.

tline1 = wa_1002-tline.

ELSEIF wa_1002-TABSEQNR = '000002'.

tline2 = wa_1002-tline.

EXIT.

ENDIF.

Clear:wa_1002.

ENDSELECT.

Pass the appropriate subty ( whether general text, notes etc ) to the above mentioned fm. then get the tabnr and in second step query hrt1002 as mentioned above. Myself have used it. I have the same requirement.

Reward points, if helpful

Former Member
0 Kudos

Thanks it looks gud..but i hv got few doubts..can u clear

First u have declared itab like what?

Second is wa_1002 like HRT1002?

Third, if i want to read all the lines of notes and i dont know how many lines r there then what is needed to be done?

Former Member
0 Kudos

Hi Mohit,

Using the call function you will get the value of TABNR and using the TABNR value , in the table hrt1002 you will have the seqnr value will vary from 0001 to 0007 (eg., this denotes that you will have seven lines of notes ) .

Loop the tabnr for that objectid and you can get all the lines of notes .

Regards

Gajalakshmi

Former Member
0 Kudos

Buddy that is fine but i need to pass all this text to sapscript..so until n unless am sure how many seqnr values will be there, how do i pass it to script?

there can be 3 or 4 or 8 seqnr's..so how do i determine this thing dynamicaly so that it can be passed to script.

Former Member
0 Kudos

Hi Mohit ,

In the programming, u will loop it and append it in a table .

1. Give an element in the form , call it in your program using the function write_form , before that mention the loop .

2.So , dynamically the tlines will be picked provided u use correct queries.

3. Write the select statement , loop, call the function , give enough space for the window to write all the tlines .

Still you have a problem , reply . All the best .

Former Member
0 Kudos

Thanks 4 d response but the problem is that i am using standard driver program so i cant do anything with write form.

Anything i can do is only in subroutine pool and script which i copied from a standard one.

One solution i see is that a standard text needs to be created(using a method or fm) for the text fetched and then included in script..is this approach correct n if so how can one proceed with it?

Message was edited by:

mohit chopra

Former Member
0 Kudos

Please see if function module HR_READ_FOREIGN_OBJECT_TEXT will work for you. This is what we generally use to get text from the HRP tables.

- April King

Former Member
0 Kudos

Hi april king,

I need text from HRT table and not HRP table.so that function module wont work for me.

Former Member
0 Kudos

Okay. Try these:

RH_HRP_DESCRIPTION_READ (you pass the HRP value, it returns the HRT)

HRIQ_READ_DESCRIPT_FOR_OBJECTS

- April