SAP for Higher Education and Research Discussions
Spark conversations about student engagement, research optimization, and administrative efficiency using SAP in higher education and research. Join in!
cancel
Showing results for 
Search instead for 
Did you mean: 

Student LifeCycle Management | PIQ_ADDRESS_MAINT

Former Member
0 Kudos

Hi experts.

I have some modifications to operate into PIQ_ADDRESS_MAINT component.

Right now, a student can have manifold addresses (same number of phone number, fax, ...) but just a mobile number (indep part).

So I want to add a mobile field.

In GUI, no problem, there is anode ADDRESS_DETAIL/MOBILE already existing.

But the problem comes from management of phone and mobile numbers because they use the same objects.

The difference betweek those two data is the attribut r_3_user (1 for phone number and 3 for mobile number, i don't use values 0 and 2 because I just want a main number for each one).

Anyone know if there is specific rules for this part because I got bevahiour problems like if I want to add a phone number to an address (where there is a already a phone number), it delete the phone number to save the mobile number !

I am trying too to update a number (with the same value) when the other one is really updated or inserted (but it doesn't not work when the first one is updated and the other one is inserted, I got (in french) : "Entrées table BAPIADTEL_X av. code mise à jour I doivent être séparées à la fin ").

I am stuck if I can't resolve it !

Here is my main modifications into module function HRIQ_RFC_ST_ADDRESS_CHANGE:

* Compare phone numbers
IF is_address_old-tel_no        <> is_address_new-tel_no         OR
     is_address_old-telephone     <> is_address_new-telephone      OR
     is_address_old-tel_extension <> is_address_new-tel_extension  OR
     is_address_old-tel_country   <> is_address_new-tel_country.

*   Telephone
    ls_bapiadtel_old-telephone = is_address_old-telephone.
    ls_bapiadtel_new-telephone = is_address_new-telephone.

*   Extension
    ls_bapiadtel_old-extension = is_address_old-tel_extension.
    ls_bapiadtel_new-extension = is_address_new-tel_extension.

*   Country Key
    CALL FUNCTION 'HRIQ_GET_COUNTRY_KEY'
      EXPORTING
        iv_country_name = is_address_old-tel_country
      IMPORTING
        ev_country_key  = ls_bapiadtel_old-country.

    CALL FUNCTION 'HRIQ_GET_COUNTRY_KEY'
      EXPORTING
        iv_country_name = is_address_new-tel_country
      IMPORTING
        ev_country_key  = ls_bapiadtel_new-country.

    ls_bapiadtel_old-r_3_user = ''.
    ls_bapiadtel_new-r_3_user  = '1'.

    CLEAR lv_difference.
    CALL FUNCTION 'HRIQ_COMPARE_ADDRESS_X'
      EXPORTING
        i_ddic_name = 'BAPIADTEL'
        i_rec_old   = ls_bapiadtel_old
      IMPORTING
        e_diff      = lv_difference
      CHANGING
        i_rec_new   = ls_bapiadtel_new.

    ls_bapiadtel_x = lv_difference.

    IF is_address_old-telephone <> ''.  "Existing telephone number
      ls_bapiadtel_x-updateflag = 'U'.   "Update
    ELSE.
      ls_bapiadtel_x-updateflag = 'I'.   "New one, insert
    ENDIF.
    IF lv_difference <> ''.
      APPEND ls_bapiadtel_x TO lt_bapiadtel_x.
      APPEND ls_bapiadtel_new TO lt_bapiadtel.
    ENDIF.
*** BEGIN RFOR 11/01 ***
    lo_new_tel = abap_true.
  ELSE.
* Update the same phone if a mobile number is inserted
    ls_bapiadtel_old-r_3_user = '1'.

    ls_bapiadtel_x-telephone = 'X'.
    ls_bapiadtel_x-r_3_user = 'X'.
    ls_bapiadtel_x-updateflag = 'U'.

    APPEND ls_bapiadtel_x TO lt_bapiadtel_x.
    APPEND ls_bapiadtel_old TO lt_bapiadtel.

    lo_new_tel = abap_false.
*** END RFOR 11/01 *****
  ENDIF.

* Mobile number
  IF is_address_old-mobile <> is_address_new-mobile
    OR is_address_old-mobile_country <> is_address_new-mobile_country.

    clear ls_bapiadtel_old.
    clear ls_bapiadtel_new.
    MOVE-CORRESPONDING is_address_old TO ls_bapiadtel_old.
    MOVE-CORRESPONDING is_address_new TO ls_bapiadtel_new.
    ls_bapiadtel_old-telephone = is_address_old-mobile.
    ls_bapiadtel_new-telephone = is_address_new-mobile.

    ls_bapiadtel_old-country = is_address_old-mobile_country.
    ls_bapiadtel_new-country = is_address_new-mobile_country.

*   Flag to set as mobile number
*   ''   Telephone is Landline Telephone
*   '1'  Telephone is Default Under Landline Telephones
*   '2'  Telephone is Mobile Telephone but Not Default Mobile Phone
*   '3'  Telephone is Default Mobile Telephone
*   'X'  Obsolete - No Longer Valid
    ls_bapiadtel_old-r_3_user = ''.
    ls_bapiadtel_new-r_3_user  = '3'.

    CALL FUNCTION 'HRIQ_COMPARE_ADDRESS_X'
      EXPORTING
        i_ddic_name = 'BAPIADTEL'
        i_rec_old   = ls_bapiadtel_old
      IMPORTING
        e_diff      = lv_difference
      CHANGING
        i_rec_new   = ls_bapiadtel_new.

    ls_bapiadtel_x = lv_difference.
    IF lv_difference <> ''.
      IF is_address_old-mobile = ''.
        ls_bapiadtel_x-updateflag = 'I'.
      ELSE.
        ls_bapiadtel_x-updateflag = 'U'.
      ENDIF.
      IF is_address_new-mobile = ''.
        ls_bapiadtel_x-updateflag = 'D'.
      ENDIF.
      APPEND ls_bapiadtel_x TO lt_bapiadtel_x.
      APPEND ls_bapiadtel_new TO lt_bapiadtel.
    ENDIF.
  ELSE.
* If a phone number inserted or updated, update the same mobile number
    IF lo_new_tel = abap_true.
      ls_bapiadtel_old-r_3_user = '3'.

      ls_bapiadtel_x-telephone = 'X'.
      ls_bapiadtel_x-r_3_user = 'X'.
      ls_bapiadtel_x-updateflag = 'U'.

      APPEND ls_bapiadtel_x TO lt_bapiadtel_x.
      APPEND ls_bapiadtel_old TO lt_bapiadtel.
    ELSE.
* Or delete the phone number inserted
      clear lt_bapiadtel_x.
      clear lt_bapiadtel.
    ENDIF.
  ENDIF.

Many thanks for your help.

Edited by: CoinCoin on Jan 11, 2010 5:50 PM

3 REPLIES 3

Former Member
0 Kudos

There is some problemes with forum posts display too ...

Edited by: CoinCoin on Jan 11, 2010 6:16 PM

0 Kudos

Helloi CoinCoin,

Could you please start a new thread and enter the issue?

Regards,

Shalini

0 Kudos

CoinCoin: as far as I recall, if in your <code> section you include an asterisk (usually because you have a comment in your code), it'll "destroy" the code formatting on the post, please avoid this.

Michael