cancel
Showing results for 
Search instead for 
Did you mean: 

How to read Web UI context attribute value with type

Former Member
0 Kudos
114

Hi,

I am trying to retreive context attribute value with type. I have a date field I would like to retreive to check if it is equal to SY-DATUM but I cannot find a function that let me do that. I first tried to use the get_property_as_string, but the format is dd.mm.yyyy and is not compliant with SY-DATUM type.

Is there anyway to retreive values from context with original type ?

Thanks in advance for your help.

Thibault

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

Hi Thibault,

This code will work.

DATA: lv_valid_from TYPE bu_datfrom.

  TRY.
      CALL METHOD ir_paym_entity->get_property_as_value(
                     EXPORTING
                       iv_attr_name = 'ALIDFROM' "#EC NOTEXT
                     IMPORTING
                       ev_result    = lv_valid_from ).

    CATCH cx_crm_cic_parameter_error.
  ENDTRY.


  IF lv_valid_from EQ sy-datum.
   
  ENDIF.

Regards

Leon

Former Member
0 Kudos

Thanks Vishal,

You answer seems to be a good one since I don't have to bother with international date formats. I am going to try it.

Thanks for your help.

Thibault

Former Member
0 Kudos

Hi,

In web ui if u give date into date field, internally it wil not take as SY_DATUM type. so, manually u have to convert into SY-DATUM type. once try the follwing code.

DATA: lv_year(4) type n,

lv_month(2) type n,

lv_day(2) type n.

if date is not initial.

lv_year = date+6(4).

lv_month = date+0(2).

lv_day = date+3(2).

concatenate lv_year lv_month lv_day into date.

endif.

check date = sy-datum.

Regards

Prameela

Edited by: ch.prameela on Feb 1, 2012 11:04 AM

Former Member
0 Kudos

Hi Thibault,

Try this it will work.



**********************************************************************
      DATA lv_date TYPE sy-datum.  "or type dats both will work.
      DATA lr_bol_col TYPE REF TO if_bol_bo_property_access.
      lr_bol_col = lr_coco->typed_context->result->collection_wrapper->get_current( ).

      CALL METHOD lr_bol_col->get_property_as_value
        EXPORTING
          iv_attr_name = 'VALIDITY_FROM '
        IMPORTING
          ev_result    = lv_date.
**********************************************************************

Best Regards,

Vishal.

Former Member
0 Kudos

Hi,

Check the static methods of this utility class for dates- CL_CRM_UIU_BT_DATE_TOOLS .

Regards,

Nithish-