‎2011 Dec 13 3:55 AM
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.
‎2011 Dec 13 4:30 AM
Hi ,
try like this sample code
ASSIGN ('(SAPLCOKO1)AFVGD[]') TO <FS_AFVGD>.
regards
Prabhu
‎2011 Dec 13 4:30 AM
Hi ,
try like this sample code
ASSIGN ('(SAPLCOKO1)AFVGD[]') TO <FS_AFVGD>.
regards
Prabhu
‎2020 Aug 24 6:22 PM
‎2023 Jun 09 5:31 PM
Hi,
Does this apply for copying a value from a Method.
Regards,
SAP User
‎2023 Jun 12 7:22 AM
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/
‎2011 Dec 13 4:32 AM
‎2011 Dec 13 4:38 AM
Zhang, as these tables are with header lines, you need to add [ ] after the table name.. and you will be done
‎2011 Dec 13 7:10 AM
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!
‎2011 Dec 13 7:34 AM
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,
‎2011 Dec 13 8:37 AM
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>.
‎2011 Dec 13 4:36 PM
Beware, SAP Labs team members have stated in discussions at ASUG that this "loophole" will soon cease to exist....
‎2011 Dec 14 1:17 AM
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?
‎2011 Dec 14 8:07 AM
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
‎2011 Dec 14 8:26 AM
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.