Vous êtes sur la page 1sur 4

4/18/2014

Calculate and Default wage type amount in infotype 0008 (basic salary)

Search

Hom e Tra i ni ngs Qui z Ti ps Tutori a l s Functi ona l Ce rt Q's I nte rvi e w Q's Jobs Te sti m oni a l s Adve rti se Conta ct Us

Corporate Trainings
Document Categories:
ABAPTM
Adobe Forms
ABAP-HR
ALE & IDocs
ALV
BAPI
BASIS
BSP
Business Objects
Business Workflow
CRM NEW
LSMW
SAP Script/Smart Forms
BI/BW
eXchange Infrastructure (XI)
Enterprise Portals (EP)
eCATT
Object Oriented Programming
SAP Query
Userexits/BADIs
WebDynpro for Java/ABAPTM
Others

What's New?
Inserting data from Internal
Table into the step Send Mail
Display GL Account long text
using enhancement
framework
Differences between
polymorphism in JAVA and
ABAP
Passing multiline parameters
from an ABAP Class event to a
Workflow container
Concept of Re-evaluate agents
for active work items in SAP
Workflow
Dynamic creation of
component usage in ABAP
WebDynpro
Adobe Forms: Display symbols
like copyright and others
Deactivate Hold functionality in
Purchase order (ME21N)
Quiz on OOABAP
Add fields in FBL5N using
BADIs
Tutorial on Wide casting
Defining a Range in Module
Pool Program
Copy fields from one
structure/table into another
structure/table
Side Panel Usage in NWBC
Introduction to SAP Event
Management
Display Statistical Report using
Function Module
Adding Explicit Enhancement
to custom program
Display data dynamically using
Field Symbols
SAP BODS - Beginners guide
Display text vertically (Rotate
text) in Adobe Form
Sending email with multiple
tabs of excel as a single
attachment
Copying Sales Order
attachments to the invoice

All India Coding Contest


techgig.com/Best-Coder-Challenge
10293 Coders Already Registered For India's
Top Coder Title. Enroll Now

Download
Free
Software
mobogenie.com
1,000,000+
apps&games Try
Mobogenie Now!

Calculate and Default wage type amount in infotype 0008 (Basic


Salary)
By Rajesh Badita, Arshiya International Ltd
1.

Introduction

To calculate amount for wage type 1010 called special allowance based on some parameters and
to default the same amount in infotype 0008 in Process After Input (PAI) Event on screen .
This can be implemented through USER-EXIT PBAS0001. This user-exit is used for defaulting
values or keying validations checks to transaction PA40 or PA30 for any PA or Recruitment
infotypes
2.

Steps

Go to CMOD transaction and create project say ZHR_PA.

Virtual
Classroom
Videos
S.A.PTrainin
g
inBangalore
Easy Project
Management

Assign enhancement PBAS0001

Click on components push button and double click on function exit EXIT_SAPFP50M_002

Contribute?
http://saptechnical.com/Tutorials/HRABAP/Wageamount/Default.htm

1/4

4/18/2014

Calculate and Default wage type amount in infotype 0008 (basic salary)

Contribute?
Sample Specs

Now double click on ZXPADU02 which is include program.

What's Hot?
Web Dynpro for ABAP Tutorials
Join the Mailing List
Enter name and email address below :
Name:

Email:

Subscribe

Unsubscribe

GO
Implement ABAP logic:

Create a structure ZTBLGART as shown in below screenshot

TYPE-POOLS: abap.
DATA: lw_p0000 TYPE p0000,
lw_p0002 TYPE p0002,
lw_p0008 TYPE p0008,
lw_p0023 TYPE p0023,
lv_spa TYPE pc207-betrg,
gt_p0000 TYPE TABLE OF p0000,
gw_p0000 TYPE p0000.
DATA: lv_retirement_date LIKE p0002-gbdat.
DATA: wa_0008 TYPE p0008,
lv_wgetype TYPE pa0008-lga01,
lv_payment TYPE t510-betrg,
lv_syindex TYPE n LENGTH 2.
DATA: lv_cal_begda TYPE begda,
lv_cal_endda TYPE endda,
lv_cnt TYPE i,
gt_pa2001 TYPE TABLE OF pa2001.
DATA : return TYPE bapireturn1.
DATA: dy_table TYPE REF TO data,
dy_line TYPE REF TO data,
xfc TYPE lvc_s_fcat,
ifc TYPE lvc_t_fcat.
DATA : idetails TYPE abap_compdescr_tab,
xdetails TYPE abap_compdescr.
DATA : ref_table_des TYPE REF TO cl_abap_structdescr.

http://saptechnical.com/Tutorials/HRABAP/Wageamount/Default.htm

2/4

4/18/2014

Calculate and Default wage type amount in infotype 0008 (basic salary)
DATA : ref_table_des TYPE REF TO cl_abap_structdescr.
DATA: lv_basic TYPE ansal_15.
FIELD-SYMBOLS <fs_betrg> TYPE ztblgart.
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa>,
<dyn_field>.
FIELD-SYMBOLS <fs_amount> TYPE ANY.
FIELD-SYMBOLS: <l_betrg> TYPE pad_amt7s,
<l_lgart> TYPE lgart.
IF sy-tcode = 'PA40' OR sy-tcode = 'PA30'.
CASE innnn-infty.
WHEN '0008'.
IF ( ( ipsyst-ioper EQ insert OR ipsyst-ioper EQ copy OR ipsystioper EQ 'MOD' ) OR sy-ucomm EQ 'UPD' ).
DATA lv_field TYPE char40.
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = innnn
IMPORTING
pnnnn = lw_p0008.
CLEAR lv_spa.
PERFORM default_spl_allow USING lw_p0008
CHANGING lv_spa.
*** Finding Wage Type field number for the Wage Type 1010
DO 40 TIMES VARYING lv_wgetype FROM lw_p0008-lga01 NEXT lw_p0008lga02.
IF lv_wgetype = '1010'.
lv_syindex = sy-index.
CONCATENATE 'lw_p0008-bet' lv_syindex INTO lv_field.
ASSIGN (lv_field) TO <fs_amount>.
<fs_amount> = lv_spa.
EXIT.
ENDIF.
ENDDO.
IF lv_spa IS NOT INITIAL.
* Get the structure of the table.
ref_table_des ?=
cl_abap_typedescr=>describe_by_name( 'ZTBLGART' ).
idetails[] = ref_table_des->components[].
LOOP AT idetails INTO xdetails.
CLEAR xfc.
xfc-fieldname = xdetails-name .
* xfc-datatype = xdetails-type_kind.
CASE xdetails-type_kind.
WHEN 'C'.
xfc-datatype = 'CHAR'.
WHEN 'N'.
xfc-datatype = 'NUMC'.
WHEN 'D'.
xfc-datatype = 'DATE'.
WHEN 'P'.
xfc-datatype = 'PACK'.
WHEN OTHERS.
xfc-datatype = xdetails-type_kind.
ENDCASE.
xfc-inttype = xdetails-type_kind.
xfc-intlen = xdetails-length.
xfc-decimals = xdetails-decimals.
APPEND xfc TO ifc.
ENDLOOP.
* Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = ifc
i_length_in_byte = 'X'
IMPORTING
ep_table
= dy_table.
ASSIGN dy_table->* TO <dyn_table>.
ASSIGN ('(MP000800)TBLGART[]') TO <dyn_table>.
* Create dynamic work area and assign to FS
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
LOOP AT <dyn_table> ASSIGNING <dyn_wa>.
ASSIGN COMPONENT 'LGART' OF STRUCTURE <dyn_wa> TO <l_lgart>.
IF <l_lgart> = '1010'.
ASSIGN COMPONENT 'BETRG' OF STRUCTURE <dyn_wa> TO <l_betrg>.
<l_betrg> = lv_spa.
EXIT.
ENDIF.

http://saptechnical.com/Tutorials/HRABAP/Wageamount/Default.htm

3/4

4/18/2014

Calculate and Default wage type amount in infotype 0008 (basic salary)
ENDLOOP.
CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
EXPORTING
pnnnn = lw_p0008
IMPORTING
prelp = innnn.
ENDIF.
ENDIF.
ENDCASE.
ENDIF.
Click here to continue...

SAP Training Institute


lithangenovate.in/SAP+Program
Join SAP Authorised Taining Program
Register Now! For More Information.

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM


Home Contribute About Us Privacy Terms Of Use Disclaimer Safe Companies: Advertise on SAPTechnical.COM | Post Job Contact Us
2006-2007 SAPTechnical.COM. All rights reserved.
All product names are trademarks of their respective companies. SAPTechnical.COM is in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver, and and any other SAP trademarks are registered trademarks of SAP AG in Germany and in several other countries.
Every effort is made to ensure content integrity. Use information on this site at your own risk.

Graphic Design by Round the Bend Wizards

http://saptechnical.com/Tutorials/HRABAP/Wageamount/Default.htm

4/4

Vous aimerez peut-être aussi