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

Two abap questions,help

Former Member
0 Likes
1,137

Hi all , I have wrote some codes ,but it show errors when it run to the last line .

The error is :You attempted to access an unassigned field symbol

could someone tell me how to solve this problem?

another question is when will SAPMM07M run ?

the codes are:

FIELD-SYMBOLS: <ITAB> TYPE ANY TABLE.

DATA: FIELD(50),

LT_MSEG LIKE STANDARD TABLE OF MSEG WITH HEADER LINE.

FIELD = '(SAPMM07M)XMSEG[]'.

IF <ITAB> IS ASSIGNED.

UNASSIGN <ITAB>.

ASSIGN (FIELD) TO <ITAB>.

ELSE.

ASSIGN (FIELD) TO <ITAB>.

ENDIF.

APPEND LINES OF <ITAB> TO LT_MSEG.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,089

Hi,

SAPMM07M is not executed in your context.

SAPMM07M should be executed to capture the XMSEG.

Regards,

Srini.

6 REPLIES 6
Read only

Former Member
0 Likes
1,089

HELP

Read only

Former Member
0 Likes
1,090

Hi,

SAPMM07M is not executed in your context.

SAPMM07M should be executed to capture the XMSEG.

Regards,

Srini.

Read only

0 Likes
1,089

Hi Ling,

Where have you written the above code, is it in a User exit/Customer exit in the flow of program "SAPMM07M".

If yes, at runtime in the debug mode, enter (SAPMM07M)XMSEG[] and see if you can see the values.

Now if you have written your code in a report program and is not triggered in the flow of SAPMM07M, then your code will never work.

Because, when you say ASSIGN (FIELD) to <ITAB>, this is not pointing anywhere as (SAPMM07M)XMSEG[] is not avaialble at runtime.

And since the assign didn't work, any further reference to the Field-Symbol will fail.

APPEND LINES OF <ITAB> TO LT_MSEG.

Regards,

Chen

Edited by: Chen K V on Mar 23, 2010 9:04 AM

Read only

0 Likes
1,089

Thanks Chen.

You are correct.

These codes come from SAP user exit.

because I dont understand what these codes mean.

I copy these codes into my report.When I run my report with these codes , SAP showed error to me.

Now , I know the reason of error.

I should run these codes in program SAPMM07M.

Thanks so much.

Read only

0 Likes
1,089

All the Best !!!

Regards,

Chen

Read only

Former Member
0 Likes
1,089

Hi Ling Wang,

Modufy cod elike this.


FIELD-SYMBOLS: <itab> TYPE ANY TABLE.
DATA: field(50),
lt_mseg LIKE STANDARD TABLE OF mseg WITH HEADER LINE.

field = '(SAPMM07M)XMSEG[]'.
IF <itab> IS ASSIGNED.
  ASSIGN (field) TO <itab>.
  APPEND LINES OF <itab> TO lt_mseg.
ENDIF.

Regards,

Pravin