Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

HR_MAINTAIN_MASTERDATA getting PERNR in return

Former Member
0 Kudos

Hi all,

I am using HR_MAINTAIN_MASTERDATA for personnel

But the difficulty is that I am not getting PERNR number in return.

The HR_RETURN table is null. The other tables RETURN and RETURN1 are getting populated but the HR_RETURN is not getting populated.

Any Idea?

12 REPLIES 12

former_member195402
Active Contributor
0 Kudos

Hi,

reading the fm's code it seems that parameter HR_RETURN is only filled in case of update error.

So you will never get an information here in case of success.

Regards,

Klaus


0 Kudos

Thank you Klaus.

I also read this. Do you have any other solution?

I need the pernr in return.

0 Kudos

Hi,

is the update is successful parameters RETURN or RETURN1 should keep the success message and one of the parameters (normally MESSAGE_V1) should contain the PERNR.

Regards,

Klaus

0 Kudos

             CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'

              EXPORTING

                PERNR                    = wa_final-pernr

                ACTIO                    = 'INS'

                TCLAS                    = 'A'

                BEGDA                    = wa_final-begda

                ENDDA                    = '99991231'

                SEQNR                    = '000'

                PLANS                    = '00000000'

                DIALOG_MODE              = '0'

                LUW_MODE                 = '1'

*               NO_EXISTENCE_CHECK       = ' '

*               NO_ENQUEUE               = ' '

              IMPORTING

                RETURN                   = it_return

                RETURN1                  = it_return1

                HR_RETURN                = hr_return

               TABLES

                 proposed_values          = proposed_values

*               MODIFIED_KEYS            =

                               .


ACTIO is marked as 'INS'. I am inserting the record.

So in this case is this possible to get the pernr in return.?

0 Kudos

Hi,

RETURN is of type BAPIRETURN as a plain structure and no table type, RETURN1 is of type BAPIRETURN1 as a plain structure and no table type.

Please use structures (work areas) here, no internal tables.

IT_RETURN and IT_RETURN1 are looking like internal tables because of their prefix.

Regards,

Klaus

0 Kudos

You are right Klaus.

Thank you for the advice...

Former Member
0 Kudos

Hi,

Show me your code

Regards,

Roopa.

0 Kudos

Roopa I am using standard FM. And in the code of this FM you can see that the HR_RETURN will be filled when update error.

Even when I test run this FM and insert a record then also I am not getting this HR_RETURN in return.

CountZero
Explorer
0 Kudos

Here is an example of the code I'm using

CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'

       EXPORTING

         massn           = '91'

         begda           = startdate

         endda           = '99991231'

         plans           = position

         dialog_mode     = mode

         luw_mode        = '0'

         werks           = werks

         persg           = persg

         persk           = persk

       IMPORTING

         return          = return

         return1         = return2

         hr_return       = msg

       TABLES

         proposed_values = values

         modified_keys   = keys.

     IF keys[] IS INITIAL.

          APPEND return2 TO return2_tab.

          ROLLBACK WORK.

          RETURN.

     ELSE.

       COMMIT WORK AND WAIT.

       READ TABLE keys INTO key INDEX 1.

       employeeno = keys-pernr.

     ENDIF.


The error will will be in the structure return2.

Former Member
0 Kudos

Thank you Nathan.

But according to the requirement I have to insert the record.

So you can see that i have put INS in  Actio.

But in your case you have not mention what you are going to do.... are you inserting or updating?

0 Kudos

Hi,

In this case I'm using the Function Module to create a new starter. Depending on the configuration you will need to create an Infotype 0000, 00001, 00003. It really is a case of working though.

The proposed values internal table contains the data you are updating

so for example

values_line-infty = '0001'.

values_line-fname = 'WERKS'.

values_line-fval  = '023'

You need to build this up from the data being passed in. Remember that fields don't default in like they do when running in foreground so you need to supply every field that is required.

As a HINT set the dialog_mode parameter to 1. This will bring up the PA screens if there are any errors.

If you are just creating an infotype and not a new employee then use Function Module  HR_INFOTYPE_OPERATION.

0 Kudos

Look at the returned table parameter MODIFIED_KEYS after the call. Also note that INS is the default value of the parameter.

Regards,

Raymond