Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error in Field symbol assignment

Former Member
0 Likes
2,255

What is wrong in following code ???

At line --> (Bold) I am gettin sy-subrc 4.

field-symbols: <F> type any,

<FSVALUE> type any.

SPLIT P_QUOTATION_TEXT-TEXT_LINE AT CRLF INTO TABLE I_SPLIT.

IF NOT I_SPLIT[] IS INITIAL.

LOOP AT I_SPLIT ASSIGNING <F>.

--> ASSIGN COMPONENT SY-TABIX OF STRUCTURE <F> TO <FSVALUE>.

IF SY-SUBRC = 0.

WA_TEXT-ITM_NUMBER = P_QUOTATION_TEXT-ITM_NUMBER.

WA_TEXT-TEXT_ID = C_HEADERTEXT.

WA_TEXT-LANGU = 'EN'.

WA_TEXT-FORMAT_COL = '*'.

WA_TEXT-TEXT_LINE = <FSVALUE>.

APPEND WA_TEXT TO I_TEXT.

CLEAR WA_TEXT.

ENDIF.

ENDLOOP.

What is wrong in following code ???

At line --> (Bold) I am gettin sy-subrc 4.

field-symbols: <F> type any,

<FSVALUE> type any.

SPLIT P_QUOTATION_TEXT-TEXT_LINE AT CRLF INTO TABLE I_SPLIT.

IF NOT I_SPLIT[] IS INITIAL.

LOOP AT I_SPLIT ASSIGNING <F>.

--> ASSIGN COMPONENT SY-TABIX OF STRUCTURE <F> TO <FSVALUE>.

IF SY-SUBRC = 0.

WA_TEXT-ITM_NUMBER = P_QUOTATION_TEXT-ITM_NUMBER.

WA_TEXT-TEXT_ID = C_HEADERTEXT.

WA_TEXT-LANGU = 'EN'.

WA_TEXT-FORMAT_COL = '*'.

WA_TEXT-TEXT_LINE = <FSVALUE>.

APPEND WA_TEXT TO I_TEXT.

CLEAR WA_TEXT.

ENDIF.

ENDLOOP.

9 REPLIES 9
Read only

Former Member
0 Likes
1,443

hi,

you can first ASSIGN the whole structure with <F> not in the loop at statement and then in other ASSIGN statement you will not get that error.

Hope that will help.

Reward if useful.

Sumit Agarwal

Read only

Former Member
0 Likes
1,443

U should use sy-index instead of sy-tabix.

sy-tabix holds the current record index fetched by the loop at ..endloop statement.

sy-index stores the counter of the loop pass of do..enddo.

SPLIT P_QUOTATION_TEXT-TEXT_LINE AT CRLF INTO TABLE I_SPLIT.

IF NOT I_SPLIT[] IS INITIAL.

LOOP AT I_SPLIT ASSIGNING <F>.

do.

--> ASSIGN COMPONENT SY-indeX OF STRUCTURE <F> TO <FSVALUE>.

IF SY-SUBRC = 0.

WA_TEXT-ITM_NUMBER = P_QUOTATION_TEXT-ITM_NUMBER.

WA_TEXT-TEXT_ID = C_HEADERTEXT.

WA_TEXT-LANGU = 'EN'.

WA_TEXT-FORMAT_COL = '*'.

WA_TEXT-TEXT_LINE = <FSVALUE>.

APPEND WA_TEXT TO I_TEXT.

CLEAR WA_TEXT.

else.

exit.

ENDIF.

enddo.

ENDLOOP.

Read only

0 Likes
1,443

Hello,

I already tried this one, but still sy-subrc is coming 4. I am totally lost now.

Read only

Former Member
0 Likes
1,443

What is the declaration of i_split?

Read only

0 Likes
1,443

I_SPLIT TYPE TABLE OF CHAR134.

But it correctly updating with values. Issue in next assign statement, the value is not correctly passing in next field-symbols

Read only

0 Likes
1,443

It is not working because your table doesn't have an structure.

If you would declare the table with this type


types: begin of this_type,
a type char134,
end of this_type.

It would work, because that's an structure.

However, I'm pretty sure that is not what you are trying to get.

You already have the value of the table in <fs>. Why do you want to assing the same value to another field symbol?. It doesn't make sense.

What are you trying to get?

Read only

0 Likes
1,443

The issue is, when user entered value from Portal in R/3 it stored with ## value i.e. 0D0A. Now to get rid of this symbol we are taking user entered value in i_split which is correctly populating. from i_split internal table value we r updating in BAPI structure.

I_SPLIT has value which I already checked through debugging. Value also assinged to <F>. But when we are assinging <F> value to another <FSVALUE> the sy-subrc is 4.

changing I_split decleration, I don't think so make any sense.

Edited by: Nilesh Shete on Jun 27, 2008 9:17 PM

Read only

0 Likes
1,443

I'll try to get clearer


SPLIT P_QUOTATION_TEXT-TEXT_LINE AT CRLF INTO TABLE I_SPLIT.

You are splitting at CRLF, fine. I_split has only one field or none if you want to get more thecnical.


LOOP AT I_SPLIT ASSIGNING <F>.

Here you are starting to loop at each entry of i_split, assigning each entry to , again only one field


ASSIGN COMPONENT SY-TABIX OF STRUCTURE <F> TO <FSVALUE>.

Again, this will never work because as you are declaring it i_split doesn't have an structure, also doesn´t have an structure only one field

It doesn't make any sense that you are assigning the same field to another field-symbol when you already have one.

And even if you used the type I told you, it would only work in the first pass because only in the first pass you can assign the component 1 of the structure because the structure only has one field, there would not be any component 2,3... etc.

Again I don't understand what you are trying to do, if you want to assign that loop pass text to a table, just pass the field-symbol you already have

Read only

Former Member
0 Likes
1,443

Not need problem solved with workaround solution to update long text from Portal tp SAP.