cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert new record in 583 infotype from webdypro abap

sivab4u
Active Participant
0 Kudos

Dear Experts,

I was trying to insert new record into 583 infotype from Webdyn pro Abap, for this i was using hr_infotype_operations function module.

The issue is 583 infotype screen fields are of structure P0583, except for one field Convayence type Field is of Q0583  and this field is mandatory field, so now when i pass all the values of structure P0583 into HR_INFOTYPE_OPERATIONS all the field values of P0583 structure values are getting populated, except for Convayence Type field. becoz of which i am getting error as enter all required fields.

So i how do i achieve this requirement from webdynpro abap. Thanks in advance.

Sample Code:

Data ls_0583 type p0583.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

  EXPORTING

    INFTY                  = '0583'

    NUMBER                 = ls_0583-PERNR

*   SUBTYPE                =

*   OBJECTID               =

*   LOCKINDICATOR          =

  VALIDITYEND            = ls_0583-ENDDA

   VALIDITYBEGIN          = ls_0583-BEGDA

**   RECORDNUMBER           =

   RECORD                 = ls_0583

   OPERATION              = 'INS'

*   TCLAS                  = 'A'

   DIALOG_MODE            = '2'

*   NOCOMMIT               =

*   VIEW_IDENTIFIER        = '07'

*   SECONDARY_RECORD       =

IMPORTING

   RETURN                 = l_return

**   KEY                    =

*          .

*    call function 'BAPI_EMPLOYEE_DEQUEUE'

*      exporting

*        number = ls_0583-pernr

*     IMPORTING

*       RETURN = l_return

*

*      .



Regards,

Siva

Accepted Solutions (1)

Accepted Solutions (1)

sivab4u
Active Participant
0 Kudos

Guys my issue got resolved, but it is a work a round. Hope the solution will be helpful.

Requirement:

Have to update 583 infotype & 0008 infotype.

Solution:

As HR_INFOTYPE_OPERATION is not working 583 infotype so i called function module in method,

This FM internally calls a report with submit syntax. the purpose of this report is to run a bdc internally and update 583 infotype.

and for 0008 i was using HR_INFOTYPE_OPERATION operations.

Regards,

Siva

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Have you checked the data type & is there any conversion exits for CONTY field?

Thanks

KH

sivab4u
Active Participant
0 Kudos

Hi katrice,

There is no conversion exits for Conty field

Regards,

Siva

KK07
Contributor
0 Kudos

Can you debug in class CL_HRPA_INFOTYPE_0583 method SPECIFIC_COMPUTATIONS and see why you are getting this error.

former_member201275
Active Contributor
0 Kudos

Hi Siva,

It is not related to the CONTY field, as mentioned above set dialog_mode to '1' and then execute and it will stop at every screen so you will see the error.

sivab4u
Active Participant
0 Kudos

Hi Krishna,

I have put break point in the method but break-point is not getting triggered, hope the method is not being called.

Now i have done a work around, from webdynpro i am calling function module and in the function module i am running a BDC to update 583 infotype, so it updating the 583 infotype.

But the issue now is, when i maintain 583 infotype from pa30 click on save it is opening 0008 infotype, with internal calculation and i have to click on save. i.e for a record entry in 583 a record also is getting created in 0008.

so i have recorded using SHDB but here 0008 screen is not called so only 583 is being updated and no record in 0008.

can anyone help how to achive this either using BDC recording or using HR_INFOTYPE_OPERATIONS,

Regards,

Siva

sivab4u
Active Participant
0 Kudos

Hi Glen,

I have made dialog_mode to '1' and i am getting below error, all the values in yellow are getting updated except for Coveyance Type.

I believe this Convayance type is not getting updated as it is of Q0583 Structure.

Please guide if i am missing anything.

former_member201275
Active Contributor
0 Kudos

No, nothing to do with Q0583.

It is something to do with the backend processing logic somewhere for this field i.e. some BADI, or how the screen is configured for this field, or there is some check table, i.e. something else, but the field you must update is P0583-CONTY.

sivab4u
Active Participant
0 Kudos

Hi Glen,

is there any badi we can push data before PBO of 583 infotype. so that convayence type screen field will be filled with suitable value.

Regards,

Siva

former_member201275
Active Contributor
0 Kudos

You can maybe have a look at BADI 'HRPAD00INFTY'.

Also, the fm hr_infotype_operation doesn't always work so great for all infotypes you should look for other solution.

nishantbansal91
Active Contributor
0 Kudos

Hi Siva,

Please share the test data & please check in debugging the value you are passing is passing to Q structure .

Thanks

Nishant

sivab4u
Active Participant
0 Kudos

Dear Nishant,

As i was unable to check the values being passed to screen from WDA, so i have made Zprogram and changed Dialog Mode in HR_INFOTYPE_OPERATIONS to '2', so i found out that all the values are getting passed to relevant screen fields, except for Convanence Type screen field as it is of Q0583 Structure and whereas all other fields are of P0583 structure, so how do i pass the value to conveyance type field.

Regards,

Siva

former_member201275
Active Contributor
0 Kudos

Basically the Q* fields are used because they display a different value on the screen as to what is in the underlying tabel i.e. the value goes through a conversion process.

The reason your program is not working is you are putting the wrong value in P0583-CONTY field. If you go to SE11 and PA0583 and then do a dropdown you wuill see your values there that you should be entering in your program.

To give you another example, if you look at infotype 0002, in PA0002 the ANRED field has a '1' or a '2' in the dictionary, however on the screen i.e. Q0002-ANRED you will see 'Mr' or 'Mrs' because obviously a 1 or a 2 is meaingless on the screen output.

The same logic is for your PA0583 field, so you need to make sure you are passing the correct values then this will work.

sivab4u
Active Participant
0 Kudos

Hi Glen,

I have checked screen field for Mr&Mrs, it is of structure P0002 structure ie (P0002-ANRED) and all the fields in 0002 infotype screen are from P0002, so we can pass single structure into HR_INFOTYPE_OPERATIONS.

But in 0583 infotype all the fields are of structure P0583 except Conveyance Type field is (Q0583), so how to pass two structures into HR_INFOTYPE_OPERATIONS.

Regards,

Siva 

former_member201275
Active Contributor
0 Kudos

No it's not.

The Q* structures are only used to pass values to the dynpro, and only where conversion or mapping is required. In the case of CONTY this is also in P0583 and works exactly the same as P0002.

In P0002 there is field ANRED, whereas the screen field is Q0002-ANREX.

For P0583 the field is CONTY, and screen field is Q0583-CNVCD.

You must fill CONTY with values ranging from 1 to 8, or whatever your range is.

sivab4u
Active Participant
0 Kudos

Hi Glen,

Please find the image which shows how the data is being saved in table level for convayence type, so as per my above source code i am passing as fallows:

if gs_ZHR_CMER-VECHILE_TYPE = '01'.

ls_0583-CONTY = '4'. "'Own Four Wheeler'. "4.

else.

ls_0583-CONTY = '5'. "'Own Four Wheeler'. "5.

endif.


am i missing anything here? in case of reference please refer my code above and let me know if i am missing anything.


former_member201275
Active Contributor
0 Kudos

This is correct. Problem, i think, is that you are not filling other required fields correctly. Please cna you post the dump message here.

former_member201275
Active Contributor
0 Kudos

Change your Operation to 'MOD'. this works.

sivab4u
Active Participant
0 Kudos

Hi Glen,

I am getting return parameter from Function Module as: No data stored for 0583 in the selected period when i changed it to MOD. it is not working .

I am not getting any dump but i am getting fill in required fields. only fields mandatory in 583 screen is start period & Conveyance type. am i missing anything else.

Regards,

Siva

former_member201275
Active Contributor
0 Kudos

Sorry... change it back to INS, and change dialog_mode to '1' instead of '0'. This will stop at the screen with the error.

If you go to SE37 for this function and click in FM Documentation there is more info on this error.

sivab4u
Active Participant
0 Kudos

Any inputs on this...

Gowtham
Contributor
0 Kudos

Hi Siva,

What values you are passing to conveyance ? and kindly share the whole data that you are passing to the Function module.

- Gowtham

sivab4u
Active Participant
0 Kudos

Dear Gautham,

I am passing key value '4'. for coveyance type.

please check my code as below:

data ls_0583 TYPE p0583.

  data gs_ZHR_CMER TYPE ZHR_CMER.

CLEAR ls_0583.

ls_0583-BEGDA = gs_ZHR_CMER-ZDATE.

ls_0583-ENDDA = '99991231'.

ls_0583-PERNR = gs_ZHR_CMER-PERNR.

if gs_ZHR_CMER-VECHILE_TYPE = '01'.

ls_0583-CONTY = '4'. "'Own Four Wheeler'. "4.

else.

ls_0583-CONTY = '5'. "'Own Four Wheeler'. "5.

endif.

ls_0583-VECHILE_TYPE = gs_ZHR_CMER-VECHILE_TYPE.

ls_0583-ENGINE_HP = gs_ZHR_CMER-ENGINE_HP.

ls_0583-MAKE_MODEL = gs_ZHR_CMER-MAKE_MODEL.

ls_0583-DOP_VECHILE = gs_ZHR_CMER-DOP_VECHILE.

ls_0583-USE_VECH_DATE = gs_ZHR_CMER-USE_VECH_DATE.

ls_0583-REG_NO = gs_ZHR_CMER-REG_NO.

ls_0583-REG_NO_FROM = gs_ZHR_CMER-REG_NO_FROM.

ls_0583-REG_NO_TO = gs_ZHR_CMER-REG_NO_TO.

ls_0583-INSURE_POL_NO = gs_ZHR_CMER-INSURE_POL_NO.

ls_0583-POLICY_FROM = gs_ZHR_CMER-INSURE_DATE.

ls_0583-POLICY_TO = gs_ZHR_CMER-INSURE_DATE_to.

ls_0583-INFTY = '0583'.

     call function 'BAPI_EMPLOYEE_ENQUEUE'

       exporting

         number = ls_0583-pernr

       importing

         return = l_return.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

   EXPORTING

     INFTY                  = '0583'

     NUMBER                 = ls_0583-PERNR

*   SUBTYPE                =

*   OBJECTID               =

*   LOCKINDICATOR          =

    VALIDITYEND            = ls_0583-ENDDA

    VALIDITYBEGIN          = ls_0583-BEGDA

*   RECORDNUMBER           =

     RECORD                 = ls_0583

     OPERATION              = 'INS'

*   TCLAS                  = 'A'

    DIALOG_MODE            = '0'

*   NOCOMMIT               =

*   VIEW_IDENTIFIER        =

*   SECONDARY_RECORD       =

  IMPORTING

    RETURN                 = l_return

*   KEY                    =

           .

     call function 'BAPI_EMPLOYEE_DEQUEUE'

       exporting

         number = ls_0583-pernr

      IMPORTING

        RETURN = l_return

       .

The above code i have made in action of approve button.

Gowtham
Contributor
0 Kudos

Hi Siva,

Kindly make sure , type '4' is maintained in following both the tables : T7INCA , T7INCB.

If not maintain the same.

- Gowtham

sivab4u
Active Participant
0 Kudos

Hi Gowtham,

Type '4', is already maintained in both the tables. is there anything else i am missing.

Regards,

Siva