Application Development 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: 

Virtual Characteristic using BADI gives an error "Field symbol has not been assigned yet."

447

My Compute code:

Define code:

I still got an error in this line:

The problem is for <ZUSER>.

For <ZVIRT_ORG> there is no error.


Could you please help me?

16 REPLIES 16

roberto_forti
Contributor
302

Hi,

Review logic about component p_cha_0TCTUSERNM of structure c_s_data.

For this issue "Field symbol has not been assigned yet" consider below example to avoid DUMP.

If <ZUSER> IS ASSIGNED.
 SELECT ...
ELSE.
...
ELSE.

302

Hi Roberto,

Thank you for your answer.

using statement you proposed I have eliminated shortdump. End have received following results:

For these record 0TCTUSERNM should be assigned because it is Z6RXJ.

I have seen this value also during debugging:

Do you have any further hint?

Best regards

Adam

0 Kudos
302

Hi, for that scenario try below example.

ASSIGN COMPONENT 'K___471' OF STRUCTURE c_s_data TO <ZUSER>.

0 Kudos
302

Hi Roberto,

<ZUSER> is assigned correctly now

Compute code:

However there is new error in line 12

Do you have any idea how to fix it?

Best regards

Adam

matt
Active Contributor
0 Kudos
302

This is not right. You should not hard code the field name. If the structure changes, your program will be returning the wrong field.

matt
Active Contributor
0 Kudos
302

What is the type of ORGUNIT in /BI0/MEMPLOYEE and what is the type of the field named in P_CHA_ZVIRT_ORG in structure c_s_data.

0 Kudos
302

Hi Matthew,

So how it should be correct? Why p_cha_0TCTUSERNM was not fetched?

Adam

matt
Active Contributor
0 Kudos
302

Why not debug or look at the code where it is assigned? Look at how p_cha_zvirt_org is assigned - it might give you a clue.

0 Kudos
302

Hi Adam,

First, I wrote "Review logic about component p_cha_0TCTUSERNM of structure c_s_data"

Second, as I wrote it is an example.

Regards,

0 Kudos
302

Hi Adam,

Please, Try below example:

1. New data object statement

DATA: lv_orgunit type (data element from /BIO/MEMPLOYEE-ORGUNIT)

2. Change as below code 

from: "INTO <ZVIRT_ORG>" to: INTO lv_orgunit

3. After select check as below code 

IF sy-subrc EQ 0.

ASSIGN lv_orgunit TO <ZVIRT_ORG>.

ELSE.
...
ENDIF.

Regards,

302

Thank you Roberto, finally it works and my report is completed.

I am really thankfull.

Best Regards

Adam

0 Kudos
302

Great Adam! Best Regards

DoanManhQuynh
Active Contributor
302

the assign statement will assign value of p_cha_0TCTUSERNM, p_cha_ZVIT_ORG to the field symbol, which i see in your debug screen have initial value (space and 0). what you want is:

ASSIGN COMPONENTS 'component_name' of structure c_s_data to <zuser>.

but actually you got:

assign components '' of structure c_s_data to <user>.

obviously you got dump because there is no component name '' in c_s_data.

check your program where you setting those p_cha_xxx to setting right component name.

matt
Active Contributor
0 Kudos
302

This is the correct approach. Find out why p_cha_0TCTUSERNM is not being assigned any value.

roberto_forti
Contributor
0 Kudos
302

Hi Adam, Have you gotten it? Regards

raymond_giuseppi
Active Contributor
0 Kudos
302

During copy of the sample implementation provided with the BAdI you forgot the check 'if P_CHA_... > 0. You should first debug or analyze source of your implementation of IF_EX_RSR_OLAP_BADI~INITIALIZE method, to find why the P_[CHA,KYF]xxx value is initial.