cancel
Showing results for 
Search instead for 
Did you mean: 

Mandatory field check on TextEdit resulted in Dump

Former Member
0 Kudos

Hello Friends,

I have few custom fields on a view. Marked the property of state as required. one of them is TextEdit field.

On the click of a button, I have used the class ,CL_WD_DYNAMIC_TOOL to validate the fields.

whether this field is empty or not .

System checks each of the inputfields correctly..but when it comes to TextEdit .. it results in dump..

When I debugged,.... the textedit can contain multiple lines.. it is not able to check whether it is empty or not. (maybe i am incorrect).

Any reasons for this behaviour?

I know that i can handle this via attribute binding and check whether that field is empty or not and then raise a message.

but why the dump?

Regards,

Vinay

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

I used the same class for checking mandatory for a text edit element and the code worked fine. Maybe the below code can help you.



METHOD wddobeforeaction .
  DATA lo_api_controller TYPE REF TO if_wd_view_controller.
  DATA lo_action         TYPE REF TO if_wd_action.

  lo_api_controller = wd_this->wd_get_api( ).
  lo_action = lo_api_controller->get_current_action( ).

  IF lo_action IS BOUND.
    CASE lo_action->name.
      WHEN 'GO'.
        CALL METHOD cl_wd_dynamic_tool=>check_mandatory_attr_on_view
    EXPORTING
      view_controller  = lo_api_controller
      display_messages = ABAP_TRUE
      .
    ENDCASE.
  ENDIF.
ENDMETHOD.

Edited by: Lorraine Fernandes on Dec 8, 2011 11:27 AM

Former Member
0 Kudos

Hello Lorraine,

Sorry... that was not TextEdit on which the dump was occurring..

Thanks so much for taking time for trying it out.

The dump is happening on the Radio buttons.

I have placed a UI Element of type RadioButtonByKey and binded to a field in DDIC strucutre whic has 2 domain values

Y and N.

When the application opens up , neither will be selected by defalult(as a part of tech requirement).

Now i have made it as mandaotry ( changed the property of state to required). So that the user has to select either of the one.

So when i use the dynamic tool for mandatory check, compiler will check for two values simultaneously and since the nature of the functionality is such that it will check for one attribute at a time. And so the dump.

Any thoughts to resolve this issue.

Regards,

Vinay

Former Member
0 Kudos

Hi Vinay

I tried this out for radio button by key and it is working for me.

Cardinality of the node containing the radio button attribute : 1:1

For the context attribute bound to radio button : Tick checkbox for property "Null Value"

This should solve your problem.

Former Member
0 Kudos

Hello Lorraine,

If i use the TextEdit and RadioButton as mentioned in tthe above stpes separately... .. application works fine..

When i use the TextEdit and Radiobutton as mandatory in a veiw...On running the application...the check is fine when both the

TE and RB are empty.. messages are shown...

But when i enter some text in TED and DO NOT SELECT any RB and click on OK.button... it dumps..

I think... some view refresh is required or modifyview is required...

Dump error from portal....

500 SAP Internal Server Error

ERROR: Comparison of two data objects not supported. (termination: RABAX_STATE)

FROM ST22.....

dump happens at the following point.. at if..

if <attr> is initial or <attr> = ' '.

l_context_element ?= element.

read table l_context_element->pending_input with table key table_line = attribute

transporting no fields.

if sy-subrc <> 0.

is_empty = abap_true.

endif.

endif.

Can you try out know how to resolve.I will also keep on trying..

TIA ...

Regards,

Vinay

Edited by: Vinay Reddy on Dec 8, 2011 10:11 AM

Edited by: Vinay Reddy on Dec 8, 2011 10:15 AM

Former Member
0 Kudos

Hi Vinay

I am not able to replicate the error you're getting. I too have added both text edit and radio button and both are mandatory.

The appln does not dump when I enter text text in TED and keep RB unselected.....

I suggest you add the code to wddobeforeaction.......maybe that should help you.

Former Member
0 Kudos

Hello Lorraine,

Can you check with binding...

I declared a node(LONG_TEXT) on component controller and added an attribute MY_TEXT of data type STRING_TABLE.

i have also maintained this node in the context view as well.

I have binded the TE on the view to this attribute.

Is my binding correct.

Regards,

Vinay

Edited by: Vinay Reddy on Dec 8, 2011 11:06 AM

Former Member
0 Kudos

Yes, binding seems to be correct. In the same node i have attribute pointing to the radio button by key. Both have state as required. Works for me....

Former Member
0 Kudos

Hello Lorraine,

I am unable to replicate your succesful approach.

So.. could you please, i request you, let me know the design steps.

Especially the minute details so that i may not miss anything..

Actually my entire custom component is completed except for this dump.

Regards,

Vinay

Former Member
0 Kudos

Hi Vinay

The code I used is mentioned above. Steps in detail are as below............

You could try to create a new component and try the steps below in it.

1. Create a zradio domain char 1 with below range

Y - Yes

N - No

2. Create a data element zradio and attached above domain to it.

3. Create a node in component controller cardinality 1:1 with two attributes

text attribute of type stringtable. state = required

and radio attribute of type data element created above. Tick null value checkbox for this attribute. state = required

4. Add textedit and radio button by key UI elements to the view along with a button. Perform context mapping and data binding for the two context attributes. Create action GO for the button. In onactiongo method I am firing plug to an empty view.......

5. Added my code to wdbeforeaction which is mentioned in my previous post above.........

6. So when i click on GO, the wdbeforeaction willl check if textedit and radiobutton is filled or not. If filled, then plug will be fired to my empty view.

Former Member
0 Kudos

Hello Lorraine..

Probabaly.. you have to try out in my SAP System....

I followed.. your step by step process and double checked... each and every line..

But the same problem persists... anyways.. i will keep on trying by changing properties...

By the way..i am giving you an snapshot during debugging time..

Class and method...- CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW

inside the above method.. one more method... int_check_mandatory_attribute

inside that method.. the dump is at this line.. .. if <attr> is initial or <attr> = ' '.

so.. when validating this line.. i see that fs <attr> is filled with the textedit data during runtime..

ideally when it is filled.. the control should not be here at all.. some value is checked incorrectly.. in the above methods.

Can you pls check during runtime.. whats happening to this attributes and how the check is happening..

I am really clueless...

Is there any patch to be applied.... our system is a unicodes system..

Regards

Vinay

Former Member
0 Kudos

Hi Vinay

Try to implement the below SAP notes in your system(whichever is relevant) using transaction SNOTE.

1448860

1344057

1537929

1026272

1091460

948753

1113684

1022080

1238337

1041621

Regards

Lorraine

Former Member
0 Kudos

Hello Loarraine,

Thanks for the OSS messages and all the code and workaround for this issue..

For now.. i have used the techniquie of adding all the mandtatroy attributes in a table and checking using the other mthod.

At this point, the tech team is not supposed to imp any OSS messages.So.. once we see green then we can go ahead.

But thanks a ton for patient replies. These were inedeed helpful.

Regards,

Vinay