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

Get value from another program using assign field symbol

Former Member
0 Likes
64,986

Dear experts,

I'm using a user_exit, the FM doesn't pass the value with import parameters. I need to get value from the main program.

I know a way to get value by using assign to field-symbol, e.g:

FIELD-SYMBOLS: <FS_AFVGD> TYPE AFVGD.

ASSIGN ('(SAPLCOKO1)AFVGD') TO <FS_AFVGD>.

Then I can get data of structure AFVGD from the program SAPLCOKO1.

My question is how can I get data with a internal table?

I need get a table data, and if i use 'Assign ('(program)variant'), will I only get a structure data? Any other ways to use?

Will very appreciated if you can help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
27,577

Hi ,

try like this sample code


ASSIGN ('(SAPLCOKO1)AFVGD[]') TO <FS_AFVGD>.

regards

Prabhu

13 REPLIES 13
Read only

Former Member
0 Likes
27,578

Hi ,

try like this sample code


ASSIGN ('(SAPLCOKO1)AFVGD[]') TO <FS_AFVGD>.

regards

Prabhu

Read only

0 Likes
27,577

It's Useful. Thanks.

Read only

0 Likes
27,577

Hi,

Does this apply for copying a value from a Method.

Regards,

SAP User

Read only

0 Likes
27,577

Hi pruthvi_raj_kosala,

Use the shared memory object to copy the data across two different classes or programmes. Use the below link for reference.

https://blogs.sap.com/2012/04/02/shared-memory-enabled-classes-and-create-data-area-handle/

Read only

Former Member
0 Likes
27,577

Hai,

Check this link. I hope its useful

Thanks&Regards

Ravi Seela

Read only

Former Member
0 Likes
27,577

Zhang, as these tables are with header lines, you need to add [ ] after the table name.. and you will be done

Read only

Former Member
0 Likes
27,577

Thank you all!

Yes, it is right! Add [] after the variant can pass the internal table exactly.

Now I had another question:

I am using user_exit PPCO0005 with FM:EXIT_SAPLCOSD_001.

I can get the operation data in T-CODE: CO02 with this code:

FIELD-SYMBOLS: <FS_AFVGB> TYPE TABLE.

ASSIGN ('(SAPLCOBO)AFVG_BT[]') TO <FS_AFVGB>.

Then <FS_AFVGB> will pass the opertaion data to me.

However, when I changed the work center and press enter in CO02, the system also trigger this user_exit,but I can't get the new work center I had changed in CO02, <FS_AFVGB> get the old value of operation data, that means, I can only get the old work center.

Can anyone tell me how I can get the current work center?

Maybe the program SAPLCOBO is not right or internal table AFVG_BT[] is not right? But I can't find the right one.

Can anyone advise me? Thanks a lot!

Read only

0 Likes
27,577

Hi you can achieve this,

i have tried and it worked perfectly.

try this code.

DATA:  lv_name_xvbap(30)  VALUE   '(SAPMV45A)XVBAP[]'.
 
FIELD-SYMBOLS: <xvbap> TYPE TABLE OF vbap.
 
ASSIGN (lv_name_xvbap) TO <xvbap>.

You should give the Program name, if you dont know the program name, just inside your exit use this FM to know the Program name

DATA: i_callstack TYPE sys_callst,
        w_callstack TYPE sys_calls.
 
  CALL FUNCTION 'SYSTEM_CALLSTACK'
    IMPORTING
      et_callstack = i_callstack.

in debug mode read the i_callstack for program name,

after yu know the program name exactly use it in above method,

Read only

0 Likes
27,577

Hi playsuji,

The problem to pass internal table has been solved.

Another question is to get operation data(work center) from production order in the user_eixt PPCO0005, FM:EXIT_SAPLCOSD_001

I can't get the current work center via:

FIELD-SYMBOLS: <FS_AFVGB> TYPE TABLE.

ASSIGN ('(SAPLCOKO1)AFVG_BT[]') TO <FS_AFVGB>.

Read only

0 Likes
27,577

Beware, SAP Labs team members have stated in discussions at ASUG that this "loophole" will soon cease to exist....

Read only

Tamas_Hoznek
Product and Topic Expert
Product and Topic Expert
0 Likes
27,577

That's pretty bad as this was available for quite some time and I'm sure many developers used (or should I say, maybe misused ) this "feature". Which means that those programs will now break.

Could you elaborate when did they say this will happen?

Read only

Former Member
0 Likes
27,577

Hi Zhang ,

whats your requirment , wanna put some validation or change values ?

PX0005 -->triggers at the time of creation .....better to check its documentation before you start codings ?

regards

Prabhu

Read only

0 Likes
27,577

Hi Prabhu,

I wanna change the issue storage location according to the work center that user maintained in CO02, so I need to get work center first.

what is PX0005? Could you explain the mean of PX0005?

Thanks.