Skip to Content

Data was not getting saved to data base ?

METHOD save_employee.
  DATA : gs_empl TYPE yempl_details.
   DATA : lv_success TYPE abap_bool.
 FIELD-SYMBOLS: <empl_attr_n> LIKE LINE OF gt_employee.
   lv_success = 'X'.
READ TABLE gt_employee ASSIGNING <empl_attr_n> WITH
  KEY guid = cs_key-guid
 employee_id = cs_key-employee_id.
   CHECK sy-subrc = 0.
     WHEN 'C' OR 'M'.
     MOVE-CORRESPONDING <empl_attr_n> TO gs_empl.
       MODIFY yempl_details FROM gs_empl.
   mode_yempl_details       = 'E'
   client                   = sy-mandt
   guid                     =  cs_key-guid
   employee_id              = cs_key-employee_id.
   CLEAR cs_key.

Hello Experts,

I have requirement that in sap crm web ui, when user click on 'new' button it was navigating to create view. The mobile no field was showing initially zeros. This should not be shown so for that particular field in domain level i kept conversion exit as ALPHA and also in create method i written a statement of 'delete leading zeros'. In web ui after giving all values and clicking on save the Mobile No. field which has conversion exit and leading zero that was not getting saved into data base custom table. Insted it was saving all zeros to data base.

When i debugged the API Custom class i got to know that there was problem in save_method.

Above is method for save employee details into data base.

Here data was successfully passing to <empl_attr_n>,but only one field i,e. mobile number field which was char format is not passing not to gs_empl.
So it was not saving to data base.

Please any suggestions.

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Sep 12, 2017 at 08:36 AM

    Hi Harish,

    You need to convert into internal formats for particular field using FM,



    Add comment
    10|10000 characters needed characters exceeded

    • Hi Harish,

      SHIFT lv_data-employee_moblie LEFT DELETING LEADING '0'.

      condense lv_data-employee_moblie.

      SHIFT lv_data-employee_pcode LEFT DELETING LEADING '0'.

      condense lv_data-employee_moblie.


      You can do in final work area field .