Application Development and Automation 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: 
Read only

Creating custom infotype.

Former Member
0 Kudos
1,648

Hi experts,

Good day i am creating custom info-type from abap program by using HR_INFOTYPE_OPERATION, Program is terminating at line num 270 :

"ASSIGN record TO <record> CASTING TYPE (tabname). "XDP UniCode"

over here tabname value is like P9999 but actual table is PA9999

The very first statement of this FM is :

DATA TABNAME  LIKE DNTAB-TABNAME VALUE 'P'.


so how can i change the vlaue from P to PA.



Thanks in advance,

Hafiz.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Kudos
1,554

Dear ,

here is my complete code you can take a look .

DATA: wa_pa9999TYPE pa9999.

*      l_bapireturn TYPE BAPIRETURN1,

*      bapipakey_tab TYPE BAPIPAKEY.

    ADD 1 TO wa_pa9999-seqnr.

    wa_pa9999-subty = SBTYPE .

    wa_pa9999-endda = ENDDATE.

    wa_pa9999-begda = STARTDATE .

***Locking the object

     CALL FUNCTION 'ENQUEUE_EPPRELE'

       EXPORTING

         pernr          = PNO

       EXCEPTIONS

         foreign_lock   = 1

         system_failure = 2

         OTHERS         = 3.

     CALL FUNCTION 'HR_INFOTYPE_OPERATION'

       EXPORTING

         infty                  = '9999'

         number                 = PNO

    subtype                = wa_pa999-subty

*   objectid               = wa_pa9999-objps

*   lockindicator          = wa_pa9999-sprps

    validityend            = wa_pa9999-endda

    validitybegin          = wa_pa9999-begda

*   recordnumber           = wa_pa9999-seqnr

         record                 = wa_pa999

         operation              = 'MOD'

   TCLAS                  = 'A'

   DIALOG_MODE            = '0'

   nocommit               = space

      IMPORTING

        return                 = LBAPIRETURN

        key                    = BAPIPAKEYTAB

             .

***Unlocking the object

     CALL FUNCTION 'DEQUEUE_EPPRELE'

       EXPORTING

         pernr = PNO.

write pno.

ENDFUNCTION.

19 REPLIES 19
Read only

former_member188827
Active Contributor
0 Kudos
1,554

you mean to say that you are inserting record in a custom infotype "9999" using the FM. Please do the following first:

  • Try inserting the record manually in infotype using PA30 to ensure that the data you are trying to insert is correct and infotype is generated correctly as well.
  • In case first step is successful please paste your code.

Regards

Mehwish

Read only

0 Kudos
1,554

Dear Mehwish ,

First step is working fine

Here is my code:

all function 'HR_INFOTYPE_OPERATION'

exporting

infty = '9999'

number = 10000245

subtype = 9015

validityend = 05.02.2015

validitybegin = 05.02.2015

recordnumber = 000

record = pa9999

operation = 'INS'

tclas = 'A'

dialog mode = '0'

importing

return = l_return.

so again my question is FM: HR_INFOTYPE_OPERATION is valid for PA right??

Read only

0 Kudos
1,554

Hi,

How are you declaring PA9999 it should be type P9999 as declared below.

data: pa9999 type p9999.

now pass pa9999 to the FM and it should work.

Read only

0 Kudos
1,554

Dear Gaurav,

I'm using FM HR_INFOTYPE_OPERATION

not declaring any thing

Read only

0 Kudos
1,554

Please share your complete code with declarations.

Regards

Mehwish

Read only

0 Kudos
1,554

Hi,

all function 'HR_INFOTYPE_OPERATION'

exporting

infty = '9999'

number = 10000245

subtype = 9015

validityend = 05.02.2015

validitybegin = 05.02.2015

recordnumber = 000

record = pa9999 ---------> Please decalre this Work area as '  Data : pa9999 type p9999.

operation = 'INS'

tclas = 'A'

dialog mode = '0'

importing

return = l_return.

It will solve your issue...

Thanks,

Vijay SR

Read only

0 Kudos
1,554

Dear Mehwish,

I've shared it please take a look thanks.

Read only

0 Kudos
1,554

Dear Vijay,

Please take a look to my latest post i've shared my complete code

Read only

0 Kudos
1,554

Hi,

Its ok , but you have to change the data decalaration part...

DATA: wa_pa9999TYPE pa9999. --> Dont decalare as pa9999, instead declare the structure p9999...


Data : wa_pa9999TYPE p9999.


Change and check...


Thanks,

Vijay Sr

Read only

RaymondGiuseppi
Active Contributor
0 Kudos
1,554

How did you create the custom Infotype, table PA9xxx and structure P9xxx should be similar/compatible:

  • P9xxx = pskey + pshd1 + PS9xxx
  • PA9xxxx = mandt + pakey + pshd1 + PS9xxx

Hint: FM expect P9xxx structure, not PA9xxx. (check FM and online documentation and perform some where-used search)

Regards,

Raymond

Read only

former_member190578
Participant
0 Kudos
1,554

The name doesn't matter.

I has to be the structure of your Infotype, not a table or variable....

data: pa9999 type p9999.   (from Gaurav Dubey)

or

Data: ls_record type p9999,

or

myrecordneme type p9999.

Read only

Former Member
0 Kudos
1,555

Dear ,

here is my complete code you can take a look .

DATA: wa_pa9999TYPE pa9999.

*      l_bapireturn TYPE BAPIRETURN1,

*      bapipakey_tab TYPE BAPIPAKEY.

    ADD 1 TO wa_pa9999-seqnr.

    wa_pa9999-subty = SBTYPE .

    wa_pa9999-endda = ENDDATE.

    wa_pa9999-begda = STARTDATE .

***Locking the object

     CALL FUNCTION 'ENQUEUE_EPPRELE'

       EXPORTING

         pernr          = PNO

       EXCEPTIONS

         foreign_lock   = 1

         system_failure = 2

         OTHERS         = 3.

     CALL FUNCTION 'HR_INFOTYPE_OPERATION'

       EXPORTING

         infty                  = '9999'

         number                 = PNO

    subtype                = wa_pa999-subty

*   objectid               = wa_pa9999-objps

*   lockindicator          = wa_pa9999-sprps

    validityend            = wa_pa9999-endda

    validitybegin          = wa_pa9999-begda

*   recordnumber           = wa_pa9999-seqnr

         record                 = wa_pa999

         operation              = 'MOD'

   TCLAS                  = 'A'

   DIALOG_MODE            = '0'

   nocommit               = space

      IMPORTING

        return                 = LBAPIRETURN

        key                    = BAPIPAKEYTAB

             .

***Unlocking the object

     CALL FUNCTION 'DEQUEUE_EPPRELE'

       EXPORTING

         pernr = PNO.

write pno.

ENDFUNCTION.

Read only

0 Kudos
1,554

hi,

Change

DATA: wa_pa9999TYPE p9999


instead of


DATA: wa_pa9999TYPE pa9999. (not pa9999)


thanks,

Vijay SR

Read only

0 Kudos
1,554

Declare wa_9999 as

data wa_9999 type p9999.

Read only

0 Kudos
1,554

Hi,

Thanks it's help alot but info type is not calculating days and inserted record for value as 0.

Regards,

Hafiz

Read only

0 Kudos
1,554

Hi,

Thanks it's help alot but info type is not calculating days and inserted record for value as 0.

Regards,

Hafiz

Read only

0 Kudos
1,554

Hi Hafiz,

1) In Exporting parameter ''record'' parameter is passed by wa_pa999 and it is not declared

    anywhere in your  above code.

2) And I see that you have defined wa_pa9999 type pa9999 and passed the value to this work area,

    Instead you define wa_pa9999 as

    data: wa_pa9999 type p9999. and check once.

Regards,

Shadab.

Read only

0 Kudos
1,554

Share snapshot of your infotype with fields. Does it calculate days automatically when you press enter or save in PA30?

Regards

Mehwish

Read only

0 Kudos
1,554

Dear Mehwish,

Thanks for your help i've done it by using commit after FM.

Thanks alot