Friday, April 1, 2011

Address Regions Telephone Value Help



 

wdDoInit()


 


// @lamrc begin


// initialize node elements

     ILAMRCElement
newElement
=
wdContext.nodeLAMRC().createLAMRCElement();

     wdContext.nodeLAMRC().addElement(newElement);


// @lamrc end


 


 

wdDoModifyView()


 


// @lamrc begin


 


if
(firstTime==true)
{


 

     // bind country dropdowns with context variables

     IWDDropDownByKey
homePhoneDropdown
=
(IWDDropDownByKey)
view.getElement("LAMRC_Home_Country_Selections");

     homePhoneDropdown.bindSelectedKey("SelectedInfotype.Zzland1");    

     IWDDropDownByKey
cellPhoneDropdown
=
(IWDDropDownByKey)
view.getElement("LAMRC_Cell_Country_Selections");

     cellPhoneDropdown.bindSelectedKey("SelectedInfotype.Zzcland1");            

        

     // if there's no telephone number, then default country code in LAND1

     if
(wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().getTelnr().length()<5)
{

         homePhoneDropdown.setSelectedKey(wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().getLand1());            

     }

     // if there's cell telephone number, then default country code in LAND1

     if
(wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().getNum01().length()<5)
{

         cellPhoneDropdown.setSelectedKey(wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().getLand1());            

     }


 


 

//     Remove these comments if we want to dynamically display the US Area Code and

//     also define and map context LAMRC.homePhoneNumber and LAMRC.cellPhoneNumber    to

//     replace SelectedInfotype.telnr and SelectedInfotype.num01

    

//     //    if selected country code is US, initialize the area code

//     if (homeCountryCodeKey.toString().compareToIgnoreCase("US")==0) {

//         // get area code

//         // copy SAP fields to LAMRC telephone number fieds for formatting US phone numbers

//         String areaCode = wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().getTelnr().substring(0,3);

//         String homePhone = wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().getTelnr().substring(3);

//         wdContext.nodeLAMRC().currentLAMRCElement().setHomeAreaCode(areaCode);

//         wdContext.nodeLAMRC().currentLAMRCElement().setHomePhoneNumber(homePhone);

//     } else {

         // copy SAP fields to LAMRC telephone number fieds for non-US phone numbers

//         String homePhone = wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().getTelnr();

//         wdContext.nodeLAMRC().currentLAMRCElement().setHomePhoneNumber(homePhone);        

//     }

    

//     Remove these comments if we want to dynamically display the US Area Code and

//     also define and map context LAMRC.homePhoneNumber and LAMRC.cellPhoneNumber    to

//     replace SelectedInfotype.telnr and SelectedInfotype.num01


 

//     // if selected country code is US, then initialize the area code

//     if (cellCountryCodeKey.toString().compareToIgnoreCase("US")==0) {

//         // copy SAP fields to LAMRC telephone number fieds for formatting US phone numbers

//         String areaCode = wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().getNum01().substring(0,3);

//         String homePhone = wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().getNum01().substring(3);

//         wdContext.nodeLAMRC().currentLAMRCElement().setCellAreaCode(areaCode);

//         wdContext.nodeLAMRC().currentLAMRCElement().setCellPhoneNumber(homePhone);

//     } else {

         // copy SAP fields to LAMRC telephone number fieds for non-US phone numbers

//         homePhone = wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().getNum01();

//         wdContext.nodeLAMRC().currentLAMRCElement().setCellPhoneNumber(homePhone);        

//     }


 


}


 


// get selections country code from the selected country for home number


ISimpleValueSet
elementValueSetHome
=

     wdThis.wdGetAPI()

         .getContext()

//         .getTypeOf("SelectedInfotype." + fieldInfo[i].fieldName)

         .getTypeOf("SelectedInfotype.Zztelefto")

         .getSVServices()

         .getValues();

    
 


// get selections country code from the selected country for home number


Object
homeCountryCodeKey
=
wdContext.nodeSelectedInfotype().getCurrentElement().getAttributeValue("Zzland1");    


String
homeCountryCodeText
=
elementValueSetHome.getText(homeCountryCodeKey);

    
 


// get selections country code from the selected country for cell number


Object
cellCountryCodeKey
=
wdContext.nodeSelectedInfotype().getCurrentElement().getAttributeValue("Zzcland1");    


String
cellCountryCodeText
=
elementValueSetHome.getText(cellCountryCodeKey);


 


//    if selected country code is US, then show the area code

// Remove these comments if we want to dynamically display the US Area Code        

// IWDInputField homeAreaCode = (IWDInputField)view.getElement("LAMRC_Home_Area_Code");


IWDTextView
homeAreaCode
=
(IWDTextView)view.getElement("LAMRC_Home_Area_Code");


if
(homeCountryCodeKey.toString().compareToIgnoreCase("US")==0)
{

     // get area code

     // copy SAP fields to LAMRC telephone number fieds for formatting US phone numbers

     homeAreaCode.setVisible(WDVisibility.VISIBLE);            


}
else
{

     // copy SAP fields to LAMRC telephone number fieds for non-US phone numbers

     homeAreaCode.setVisible(WDVisibility.NONE);


}


//    if selected country code is US, then show the area code

// Remove these comments if we want to dynamically display the US Area Code        

// IWDInputField cellAreaCode = (IWDInputField)view.getElement("LAMRC_Cell_Area_Code");


IWDTextView
cellAreaCode
=
(IWDTextView)view.getElement("LAMRC_Cell_Area_Code");


if
(cellCountryCodeKey.toString().compareToIgnoreCase("US")==0)
{

     // copy SAP fields to LAMRC telephone number fieds for formatting US phone numbers

     cellAreaCode.setVisible(WDVisibility.VISIBLE);            


}
else
{

     // copy SAP fields to LAMRC telephone number fieds for non-US phone numbers

     cellAreaCode.setVisible(WDVisibility.NONE);


}


 


// since we do not want to have the dropdown for country code, we update the shadow node element w/o value help attached to the UI


if
(homeCountryCodeKey.toString().length()
!=
0
)
{

     wdContext.nodeLAMRC().currentLAMRCElement().setHomeCountryCode("+"
+
homeCountryCodeText);    

     wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().setAttributeValue("Zztelefto","+"
+
homeCountryCodeText);


}
else
{

     wdContext.nodeLAMRC().currentLAMRCElement().setHomeCountryCode("");    

     wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().setAttributeValue("Zztelefto","");


}

    
 


if
(cellCountryCodeKey.toString().length()
!=
0
)
{

     wdContext.nodeLAMRC().currentLAMRCElement().setCellCountryCode("+"
+
cellCountryCodeText);    

     wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().setAttributeValue("Zzctelefto","+"
+
cellCountryCodeText);


}
else
{

     // no value selected (empty selection)

     wdContext.nodeLAMRC().currentLAMRCElement().setCellCountryCode("");    

     wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().setAttributeValue("Zzctelefto",""
);


}    

            


// @lamrc end


 

Map placeholder action handler

// placeholder action handler order to refresh screen


public
void
onActionLAMRC_Country_Code(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent
wdEvent
)


{


//@@begin onActionLAMRC_Country_Code(ServerEvent)


// action required on dropdown selection in order to refresh the screen

    //    MessageManager msgMgr = (MessageManager) wdThis.wdGetAPI().getComponent().getMessageManager();

    //    msgMgr.reportWarning(" used for testing");


//@@end


}


 


 

Map SAP default telephone number to LAMRC context node in order to hide error messages


 



 


 

Define Layout and UI Elements (shown has option to dynamic display of area code)


(

Make sure that the either ROOT or LAMRC container properties are properly set to avoid stretching of columns when the text are dynamically shown/hidden



 

Map UI Elements with LAMRC Context nodes


 

NOT NEEDED, but use conversion routine

Add method to VcAddressDetails13 onFlush() to back-end

    String
event
=
fpm.getEventData().getEventName();

                if
(event.equals(IFPM.EVENT_REVIEW)){

        // @lamrc

        

        // concatenate to get the US phone number

//        String phoneNumber = wdContext.nodeLAMRC().currentLAMRCElement().getHomePhoneNumber();

//        Remove these comments if we want to dynamically display the US Area Code        

//        if (wdContext.nodeSelectedInfotype().getCurrentElement().getAttributeAsText("Zzland1").equalsIgnoreCase("US")==true) {

//            String areaCode = wdContext.nodeLAMRC().currentLAMRCElement().getHomeAreaCode();

//            wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().setTelnr(areaCode + phoneNumber);

//        } else {

//            wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().setTelnr(phoneNumber);        

//        }


 

        // concatenate to get the US cell phone number

//        Remove these comments if we want to dynamically display the US Area Code        

//        phoneNumber = wdContext.nodeLAMRC().currentLAMRCElement().getCellPhoneNumber();        

//        if (wdContext.nodeSelectedInfotype().getCurrentElement().getAttributeAsText("Zzcland1").equalsIgnoreCase("US")==true) {

//            String areaCode = wdContext.nodeLAMRC().currentLAMRCElement().getCellAreaCode();

//            wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().setNum01(areaCode + phoneNumber);

//        } else {

//            wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().setNum01(phoneNumber);

            // hard-code in order to bypass SAP validation for comm dropdown

            wdContext.nodeSelectedInfotype().currentSelectedInfotypeElement().setCom01("CELL");             

//        }        

        // @lamrc             


 

In the review screen create labels and textView for Personal Mobile field. NOTE: map label 1 to 1 with the TextView in order to user personalization


 

For Korea, specify Z class to bypass SAP's KR phone validation for non-KR telephone numbers

Maintenance View V_T582ITVCHCK


 

Sunday, January 23, 2011

SAP HR Operations


Uploading a PA Infotype record with Cost Assignment



http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/14694



HR_INFOTYPE_OPERATION

http://forums.sdn.sap.com/thread.jspa?threadID=659777

Jaison Joseph

Posts: 76
Registered: 11/11/05
Forum Points: 22
How to update HR infotypes? 
Posted: Jan 23, 2007 1:16 PM
Hi All,

Is there any FM or BAPI for updating following infotypes?
0000 – Action
0001 – Organizational Data
0002 – Personal Data
0006 – Address
0008 – Basic Pay
0041 – Date specifications
0105 - Communication
0315 – Cats.

Thanks in advance

Jaison.
Prabhu Peram 

Posts: 5,930
Registered: 3/25/05
Forum Points: 7,404
Re: How to update HR infotypes?   Very helpful
Posted: Jan 23, 2007 1:22 PM   in response to: Jaison Joseph in response to: Jaison Joseph
check HR_INFOTYPE_OPERATION

Regards
Prabhu
Amit Mittal 

Posts: 6,454
Registered: 1/12/05
Forum Points: 12,890
Re: How to update HR infotypes?   Very helpful
Posted: Jan 23, 2007 1:36 PM   in response to: Jaison Joseph in response to: Jaison Joseph
Hi jaison,
1. this is the full coding.

2. just copy paste in new program.

3. U can change the pernr and amount values, and corresponding infotype as per requirement.

4.

Report abc.

*----------------- Data
DATA : P0015 LIKE P0015.
DATA : RETURN LIKE BAPIRETURN1.
DATA : KEY LIKE BAPIPAKEY.
DATA : RETURNE LIKE BAPIRETURN1 .

*------------- Values (Change as per Requirement)

P0015-PERNR = '1'.
P0015-BEGDA = '2061101'.
P0015-ENDDA = '2061101'.
P0015-LGART = '3075'.
P0015-PREAS = '01'.
P0015-WAERS = 'INR'.
P0015-BETRG = '2500'.
*----- First Enqu

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = p0015-pernr
IMPORTING
RETURN = RETURNE.
*------------- Update

CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0015'
NUMBER = P0015-PERNR
SUBTYPE = P0015-SUBTY
OBJECTID = P0015-OBJPS
LOCKINDICATOR = P0015-SPRPS
VALIDITYEND = P0015-ENDDA
VALIDITYBEGIN = P0015-BEGDA
RECORDNUMBER = P0015-SEQNR
RECORD = P0015
OPERATION = 'INS'
TCLAS = 'A'
DIALOG_MODE = '0'
IMPORTING
RETURN = RETURN
KEY = KEY.

IF RETURN IS NOT INITIAL.
WRITE :/ 'Error Occurred'.
ENDIF.

*--------- Dequeue
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
NUMBER = P0015-PERNR
.

regards,
amit m.
Bryan Cain

Posts: 167
Registered: 6/28/06
Forum Points: 106
Re: How to update HR infotypes? 
Posted: Jan 23, 2007 3:36 PM   in response to: Jaison Joseph in response to: Jaison Joseph
0000 - HR_MAINTAIN_MASTERDATA
0001 - HR_INFOTYPE_OPERATION
0002 - BAPI_PERSDATA_CREATE / BAPI_PERSDATA_CHANGE
0006 - BAPI_ADDRESSEMP_CREATE / BAPI_ADDRESSEMP_CHANGE
0008 - BAPI_BASICPAY_CREATE / BAPI_BASICPAY_CHANGE
0105 - BAPI_EMPLCOMM_CREATE / BAPI_EMPLCOMM_CHANGE
0315 - HR_INFOTYPE_OPERATION

0041 - Not sure, but if you can't find anything in t-code BAPI, you can always use

http://forums.sdn.sap.com/thread.jspa?threadID=76686

Re: searching BAPI to update communication entries for Personal data
Posted: Oct 26, 2005 5:32 PM in response to: Andre Mers
Reply
Hello ,

BAPI_EMPLCOMM_CHANGE works (Rel.4.6C).

the construction is :
* Get existing communication data
CALL FUNCTION 'BAPI_EMPLCOMM_GETDETAILEDLIST'
EXPORTING
employeenumber = employeenumber
IMPORTING
return = wa_retget
TABLES
communication = t_comm.
...
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = employeenumber
IMPORTING
return = wa_retenq.
...
CALL FUNCTION 'BAPI_EMPLCOMM_CHANGE'
EXPORTING
employeenumber = lw_change-employeeno
subtype = lw_change-subtype
objectid = lw_change-objectid
lockindicator = lw_change-lockindic
validitybegin = lw_change-validbegin
validityend = lw_change-validend
recordnumber = lw_change-recordnr
communicationid = lw_change-id
nocommit = 'X'
IMPORTING
return = lw_retchg.
...
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = wa_ret2.
..
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
number = employeenumber
IMPORTING
return = wa_retdeq.

we use it with subtypes '0010' (email) and '0020' (phone).
Regards Wolfgang

http://forums.sdn.sap.com/thread.jspa?threadID=434107


Hruser

Posts: 766
Registered: 10/17/06
Forum Points: 1,020
 
bapi for subtypes  
Posted: Jun 6, 2007 4:13 PM
Click to report abuse...E-mail this message Click to reply to this threadReply
Hi All,

i am looking to access or return all the possible subtypes for an infotype using a bapi/rfc.

ex: BAPI_ADDRESSEMPGETDETAILEDLIST will give me all subtypes maintained for a employee...but that is not what i want... what i want the bapi to do.. is also to give me all possible subtypes..that u can see in f4 of an infotype.

say BAPI_EMPLCOMM_GETDETAILEDLIST only returns maintained subtypes, not all possible subtypes...that actually exist for IT0105...
i want to populate a dropdown of f4 possibilities...

a custom rfc that reads subtype tables(T591x) of infotype the only possibility? or something already exists...and i am not exploiting it correctly?

pls advice..thankx.