2008 Nov 06 4:57 PM
Hi,
I was just wondering has anyone here tried to use RH_INSERT_INFOTYPE on an infotype that stores multiple lines of text?
I have created the infotype 9530 but when I look at the table P9530 I don't see my text field. Instead I see a field called TABNR which I can use to read the table HRT9530.
I would really appreciate if someone could provide me with some sample code on how I can insert values into my new infotype.
Many thanks for any help provided,
Colm
2008 Nov 06 5:13 PM
Why don't you try to fm HR_INFOTYPE_OPERATION for updating infotypes
a®
2008 Nov 06 5:13 PM
Why don't you try to fm HR_INFOTYPE_OPERATION for updating infotypes
a®
2008 Nov 06 5:21 PM
From reading around I see that I should use RH_INSERT_INFOTYPE because it is a PD infotype and not a PA infotype.
If it was a PA infotype then I think I would be using HR_INFOTYPE_OPERATION.
However I am not sure. Have you used HR_INFOTYPE_OPERATION to add multilines of text to an Infotype?
Thanks,
Colm
2008 Nov 06 5:38 PM
For PD i have used fm RH_PNNNN_MAINTAIN for function codes you may have check for table T77FC
PS For multiline insert i don't have much info
a®
2008 Nov 07 5:23 PM
2008 Nov 07 5:25 PM
*Here are the data declerations required to call the Function Module
TABLES pppar.
DATA: BEGIN OF pplog_tab OCCURS 1.
INCLUDE STRUCTURE pplog.
DATA: END OF pplog_tab.
DATA: BEGIN OF dyn_tab OCCURS 1,
vdata LIKE pplog-vdata,
opera(1),
END OF dyn_tab.
DATA : ptsub LIKE t777d-ptnnnn VALUE 'PT9530'.
DATA : pt_tabnr LIKE d021t-fldn VALUE 'P9530-TABNR'.
DATA: %upd_repid LIKE sy-repid,
%upd_form TYPE edperform.
DATA : tdata_sort LIKE t77cd-tdata_sort VALUE ' '.
DATA: fcode_for_insert LIKE hrrhap-fcode.
CONSTANTS: tabnr_fdname LIKE dfies-fieldname VALUE '-TABNR'.
CONSTANTS: def_vtask_space LIKE hrrhap-vtask VALUE ' ',
def_commit_flg_no LIKE hrrhap-commit_flg VALUE ' ',
def_authy_no LIKE hrrhap-authy VALUE 'X'.
FIELD-SYMBOLS : <ptsub>, <pttabnr>,
<ptsub_char> TYPE ANY.
*Here are the required fields that are passed into the Funtion Module
*I reckon we're going to need to gain access to these fields in the BSP
*when we are calling the FM but we should have them as they are
*basically object data and the data for the infotype. i.e start date,
*enddate object type etc...
fcode_for_insert = 'INSE'.
pppar-fcode = 'INSE'.
pppar-listb = '0'.
pppar-break = '0'.
pppar-cycle = '0'.
pppar-updat = '1'.
pppar-clear = '1'.
pppar-timco = '2'.
pppar-vtask = 'D'.
pppar-enque = '1'.
pppar-langu = '1'.
pppar-pstat = 'INSE'.
pppar-ppnnn = 'P9530'.
pppar-edynr = '2000'.
pppar-ldynr = '3000'.
pppar-lvdat = '000'.
pppar-lpsub = '000'.
pppar-dialg = 'RH_INFOTYP_9530'.
pppar-repid = 'MP953000'.
pppar-dvary = 'INSE'.
pppar-dbtab = 'HRP9530'.
pppar-tbtab = 'HRT9530'.
pppar-ptnnnn = 'PT9530'.
pplog_tab-mandt = '074'.
pplog_tab-plvar = '01'.
pplog_tab-otype = '01'.
pplog_tab-objid = '50007032'.
pplog_tab-infty = '9530'.
pplog_tab-istat = '1'.
pplog_tab-begda = '20081107'.
pplog_tab-endda = '20081108'.
pplog_tab-varyf = 'E'.
pplog_tab-seqnr = '000'.
pplog_tab-aedtm = '20081107'.
pplog_tab-uname = 'CGAVIN'.
pplog_tab-itxnr = '00000000'.
APPEND pplog_tab.
*The function module calls this routine in this program to append the
*lines of text. We will need to decide how we are going to handle this.
*Probably a program that is sitting in PRD with the routine in it??
%upd_repid = 'Z_TEST_RH_INSERT_INFTY_MULTI'.
%upd_form = '%TAB_DB' .
*Here is the data that gets appended to the infotype.
dyn_tab-vdata = 'LINE1'.
APPEND dyn_tab.
dyn_tab-vdata = 'LINE2'.
APPEND dyn_tab.
*Call the Function Module
CALL FUNCTION 'RH_INSERT_INFTY'
EXPORTING
fcode = fcode_for_insert
vtask = 'B'
commit_flg = def_commit_flg_no
authy = def_authy_no
pppar_imp = pppar
repid = %upd_repid
form = %upd_form
TABLES
innnn = pplog_tab
EXCEPTIONS
no_authorization = 01
error_during_insert = 02.
IF sy-subrc <> 0.
*Some type of error messaging
ELSE.
*The initial funtion module call only places the data in the buffer
*This function module writes that data in the buffer to the database
CALL FUNCTION 'RH_UPDATE_DATABASE'
EXPORTING
vtask = 'S'
EXCEPTIONS
corr_exit = 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.
ENDIF.
*Here is an example of how we will read multiline text data from the
*Infotype
DATA: t9530 LIKE p9530 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'RH_READ_INFTY'
EXPORTING
plvar = '01'
otype = '01'
objid = 50007032
infty = '9530'
TABLES
innnn = t9530.
DATA lt_hrt9530 TYPE TABLE OF hrt9530.
LOOP AT t9530.
SELECT *
FROM hrt9530
INTO TABLE lt_hrt9530
WHERE tabnr = t9530-tabnr.
ENDLOOP.
*---------------------------------------------------------------------*
* FORM %TAB_DB *
*---------------------------------------------------------------------*
* This is the form that controls appending the data into the *
* text fields. It was a SAP standard form that I modified slightly. *
* I don't think we need to change it any more *
*---------------------------------------------------------------------*
* --> %TD_TAB *
* --> %TD_SET *
* --> %TD_TABIX *
*---------------------------------------------------------------------*
FORM %tab_db TABLES %td_tab
USING %td_set
%td_tabix.
DATA: %td_tab_count TYPE p.
FIELD-SYMBOLS: <%td_tab_char> TYPE ANY.
ptsub = pppar-ptnnnn.
pt_tabnr = pppar-ppnnn.
CONCATENATE pt_tabnr tabnr_fdname INTO pt_tabnr.
%upd_repid = sy-repid.
%upd_form = '%TAB_DB'.
ASSIGN ptsub TO <ptsub>.
ASSIGN <ptsub> TO <ptsub_char> CASTING TYPE c.
ASSIGN pt_tabnr TO <pttabnr>.
ASSIGN %td_tab TO <%td_tab_char> CASTING TYPE c.
REFRESH %td_tab.
LOOP AT dyn_tab.
<ptsub_char> = dyn_tab.
<%td_tab_char> = <ptsub_char>.
APPEND %td_tab.
ENDLOOP.
DESCRIBE TABLE %td_tab LINES %td_tab_count.
IF %td_tab_count = 0.
CLEAR <ptsub>.
<%td_tab_char> = <ptsub_char>.
ENDIF.
IF tdata_sort NE space.
SORT %td_tab.
ENDIF.
ENDFORM. "%tab_db