cancel
Showing results for 
Search instead for 
Did you mean: 

error The field cannot be changed

Former Member
0 Kudos

Hello Friends,

I have code as below where name1 and LIFNR are the paramenters in WD I am sending it out to FM. But, when I compile I get the error as "The field "LIFNR" cannot be changed" LIFNR is CHAR size 10. I think normally a CHAR data type should hold the numbers. Incase not, then can any one show me how to do type casting or what is the correct way to code so that it holds the value that could be passed to LIFNR.

lv_zvendorlist = name1.

DATA vendnamenum type string.

DATA: vendname type string, vendnum type string.

vendnamenum = lv_zvendorlist.

SPLIT vendnamenum at '-' INTO vendname vendnum.

IF vendnum is NOT INITIAL.

write: vendnum+0(1).

ENDIF.

lv_zlifnr = vendnum.

LIFNR = lv_zlifnr.

Thks & Rgds,

Hemal

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Answerd self.

Former Member
0 Kudos

I have fixed the code by passing the value directly to the field of a context node. the fix is as below for future reference.

lv_zvendorlist = name1.

  • get single attribute

lo_el_inv_input_values->get_attribute(

EXPORTING

name = `ZVENDORLIST`

IMPORTING

value = lv_zvendorlist ).

DATA vendnamenum type string.

DATA: vendname type string, vendnum type string.

vendnamenum = lv_zvendorlist.

SPLIT vendnamenum at '-' INTO vendname vendnum.

lv_zlifnr = vendnum.

  • set single attribute

lo_el_inv_input_values->set_attribute(

EXPORTING

name = `ZLIFNR`

value = lv_zlifnr ).

Thks & Rgds,

Hemal