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: 

get PA0002-INITS by using Partner (ZI Introducing Employee)

Former Member
0 Kudos

Hello everyone, need to write a routine as follows,

in oder to get the reimbursement for the person who related to this quotation. and the initials should be appears on the quotation sheet, using the ZI introducing employee I can fetch the personnel Nr, and then through HR table PA0002 to get the intials.

Document Nr table VBPA

field VBELN

table -


>field PARVW (ZI)

Personnel Nr. -


>field PERNR

HR table PA0002

field PERNR

field INITS

so far I am doing in this step, there might be some errors in this report.who can help me to finish this report?

Routine: GET_ZI_INITS USING VBELN (DOCNR) CHANGING INITS

DATA:

vbeln LIKE vbak-vbeln,

inits LIKE pa0002-inits,

  • read params

READ TABLE PARAMS WITH KEY 'VBELN'.

MOVE PARAMS-value TO VBELN.

  • VBELN (doc nr)

...

  • get pernr_zi (introducing employee number) from document header

SELECT-SINGLE PERNR FROM VBPA

WHERE

PARVW = ZI

...

IF SY-SUBRC NE 0. " ZI exists?

ENDIF.

  • get initials

SELECT-SINGLE INITS FROM PA0002

WHERE

PERNR EQ pernr_zi and " introducing employee number

ENDDA GE AUDAT and " document date

BEGDA LE AUDAT.

IF SY-SUBRC NE 0.

" what we can do if it is Not good,

I am think of to get the first alphabet of the first name and last name from HR

ENDIF.

  • return params

  • INITS (initials)

...

thank you very much for ur help!

1 REPLY 1

suresh_datti
Active Contributor
0 Kudos

Hi Sean,

I do not see anything wrong with your approach.. Did you get any errors in the actual code? Pl take a look at the following piece to retriev info from PA0002.


data: w_inits type inits,
      w_nachn type nachn,
      w_vorna type vorna.
select nachn vorna inits into (w_nachn,w_vorna,w_inits)
                          up to 1 rows
                          from pa0002
                          where pernr = '00000124' "introducing employee number
                            and begda le sy-datum  "document date
                            and endda ge sy-datum.
endselect.
if sy-subrc ne 0.
* infotype 0002 record does not exist.. PERNR number may be wrong
else.
  if w_inits is initial.
    concatenate w_vorna(1) w_nachn(1) into w_inits.
  endif.
endif.

Regards,

Suresh Datti