cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI to update infotype HRP1017 & HRT1017

hassimkhan
Explorer
0 Kudos

Hello expert,

I've search the net and this forum, i still cant find any bapi to update these two infotype. Could anyone please tell me?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Hassim,

this is one infotype, not two. It just happens to have two tables.

Have you done a where used list in function modules for the two tables and the structures they are made of?

That will give you the answer in 90% of this kind of questions.

kind regards

Sven

hassimkhan
Explorer
0 Kudos

Hello i've done as u've said and got as fm: hr_it1017_write_document , is it this one?

Former Member
0 Kudos

I don't know. Nobody knows the BAPIs and all other stuff for morethan 1100 infotypes by heart

Check it out!

Answers (1)

Answers (1)

former_member226225
Contributor
0 Kudos

Hi hassim,

Please find the below code to update IT1017 . This can be updated by using these fm's  and he tables parameter you can take reference for the IT1017 otherwise we can do BDC program for PP02 Tcode and select IT1017.

CALL FUNCTION 'RH_INSERT_INFTY'

EXPORTING

FCODE = 'INSE'

VTASK = 'B'

TABLES

INNNN = ITAB

EXCEPTIONS

NO_AUTHORIZATION = 1

ERROR_DURING_INSERT = 2

REPID_FORM_INITIAL = 3

CORR_EXIT = 4

BEGDA_GREATER_ENDDA = 5

OTHERS = 6.

IF SY-SUBRC = 0.

CALL FUNCTION 'RH_UPDATE_DATABASE'

EXPORTING

VTASK = 'D'

EXCEPTIONS

CORR_EXIT = 1

OTHERS = 2.

SUBRC = SY-SUBRC.

ENDIF.

Hope this will be helpful.

Thanks & Regards,

Raghunadh Kodali.

Former Member
0 Kudos

Hi Raghunad,

I would not expect this to work for a table-infotype. It certainly would for a simple one with an HRP table only.

You can try, of course, but these infotypes are a bit special.

Kind regards

Sven

former_member226225
Contributor
0 Kudos

Hi Sven,

Absolutely you are correct.

I tried for it and achieved it using RH_INSERT_INFTYP.

Below is the code to update IT1017 for the tables HRP1017 and HRT1017.


Please find the below code.


REPORT  ztest_rh_update_1017.

DATA : gt_hrp1017 TYPE TABLE OF p1017,

        gs_hrp1017 TYPE p1017.

DATA: BEGIN OF pplog_tab OCCURS 1.

         INCLUDE STRUCTURE pplog.

DATA: END OF pplog_tab.

TABLES pppar.

DATA : ptsub LIKE t777d-ptnnnn VALUE 'PT1017'.

DATA : pt_tabnr LIKE d021t-fldn VALUE 'P1017-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'.

DATA: BEGIN OF dyn_tab OCCURS 1,

         vdata LIKE pplog-vdata,

         opera(1),

       END OF dyn_tab.

FIELD-SYMBOLS : <ptsub>, <pttabnr>,

                 <ptsub_char> TYPE any.

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 =   'P1017'.

pppar-edynr =   '2000'.

pppar-ldynr =   '3000'.

pppar-lvdat =   '000'.

pppar-lpsub =   '000'.

pppar-dialg =   'RH_INFOTYP_1017'.

pppar-repid =   'MP101700'.

pppar-dvary =   'INSE'.

pppar-dbtab =   'HRP1017'.

pppar-tbtab =   'HRT1017'.

pppar-ptnnnn  =   'PT1017'.

pplog_tab-mandt =   '800'.

pplog_tab-plvar =   '01'.

pplog_tab-otype =   'S'.

pplog_tab-objid =   '50013077'.

pplog_tab-infty =   '1017'.

pplog_tab-istat =   '1'.

pplog_tab-begda =   sy-datum.

pplog_tab-endda =   '99991231'.

pplog_tab-varyf =   'E'.

pplog_tab-seqnr     = '000'.

pplog_tab-aedtm sy-datum.

pplog_tab-uname sy-uname.

pplog_tab-itxnr =   '00000000'.

APPEND pplog_tab.

break abaper.

CALL FUNCTION 'RH_INSERT_INFTY'

   EXPORTING

     fcode               = 'INSE'

     vtask               = 'B'

*   ORDER_FLG           = 'X'

*   COMMIT_FLG          = 'X'

*   AUTHY               = 'X'

*   PPPAR_IMP           =

*   OLD_TABNR           = ' '

     repid               = sy-repid

     form                = '%TAB_DB'

*   KEEP_LUPD           =

*   WORKF_ACTV          = 'X'

   TABLES

     innnn               = pplog_tab[]

*   ILFCODE             =

   EXCEPTIONS

     no_authorization    = 1

     error_during_insert = 2

     repid_form_initial  = 3

     corr_exit           = 4

     begda_greater_endda = 5

     OTHERS              = 6.

IF sy-subrc <> 0.

* Implement suitable error handling here

ELSE.

   CALL FUNCTION 'RH_UPDATE_DATABASE'

     EXPORTING

       vtask     = 'D'

     EXCEPTIONS

       corr_exit = 1

       OTHERS    = 2.

   COMMIT WORK.

ENDIF.

*&---------------------------------------------------------------------*

*&      Form  %tab_db

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->%TD_TAB    text

*      -->%TD_SET    text

*      -->%TD_TABIX  text

*----------------------------------------------------------------------*

FORM %tab_db TABLES %td_tab

              USING  %td_set

                     %td_tabix.

   DATA: %td_tab_count TYPE p.

   FIELD-SYMBOLS: <%td_tab_char> TYPE any.                 "ANDUNI

   ASSIGN %td_tab TO <%td_tab_char> CASTING TYPE c.        "ANDUNI

   REFRESH %td_tab.

   <%td_tab_char> = 'ALL'.                        "ANDUNI

   APPEND %td_tab.

   DESCRIBE TABLE %td_tab LINES %td_tab_count.

   IF %td_tab_count = 0.

     %td_tab = <ptsub>.                                   "ANDUNI

     <%td_tab_char> = <ptsub_char>.                        "ANDUNI

   ENDIF.

   IF tdata_sort NE space.

     SORT %td_tab.

   ENDIF.

ENDFORM.                    "%tab_db



I hope this will be helpful for IT1002 as well.




Thanks & Regards,

Raghunadh Kodali