Trigger a waiting ABAP program from a User Exit of CO01
Hi all,
We would like to launch a ABAP program from a User Exit (EXIT_SAPLCOZV_001) of CO01, this ABAP program has a special characteristic: using Function Module RFC_PING_AND_WAIT, so this program will be existing until terminating event coming.
Our purpose is terminate CO01 normally before finishing of ABAP program. We don't know if it's possible?
Actually:
1. when we use SUBMIT ..., the process will stop CO01 (stop not normally) and then launch ABAP program. => This is not suitable for our purpose.
2. when we use SUBMIT ... and RETURN, CO01 will wait for finishing of ABAP program => This is not suitable for our purpose too, because we wish CO01 terminated normally when ABAP program is still existing and waiting for its terminating event.
Do you have a solution that is suitable for our purpose, could you please help us?
(The context is below:
Time: Begin-->CO finished> ABAP finished-->
Launch CO01 --> Call User Exit --> Call ABAP program for waiting --> CO01 saved normally.
> ABAP program still waiting ---> waiting for terminating event
Thanks a lot,
Vinh Vo
Hi,
Try with the function module BP_EVENT_RAISE, it takes eventid, and eventparm as import parameters in the User exit.
1) With Eventid, you create a background job of the ABAP program and schedule it. Eventparm can be the Production order number.
2) So when ever the Event is triggered the FM gets triggered and which in turn run the ABAP program, so the foreground the CO01 transaction runs without waiting for the ABAP program to complete.
Regards
Bala Krishna
Similar Messages
-
ABAP program error for user EXIT
Hi, I wrote code in EXIT_SAPLRSAP_001
When check and active it there were no syntax errors but when go rsa3 and check it gives an error at the follwing line
it_mcekpo[] = c_t_data[].
Runtime error: The internal talbles are neither compitable nor convertable.
I have defined it_mcekpo as below:
DATA BEGIN OF IT_MCEKPO OCCURS 1.
include structure mcekpo.
DATA END OF IT_MCEKPO.
But when I double click on 'c_t_data[]' , I get a message "object not defined, do you want do define".
Can some one tell me how should I define this, what aption I should choose and what is the strcture.
I am trying to add afnam, banfn and bednr from ekpo table to MC02M_0ITM (2LIS_02_ITM).
And is there any naming convention for 'it_mcekpo' and 'c_t_data'?
Any help is appreciated.
(This is my first userexit)
data: begin of it_ekpo occurs 0,
ebeln like ekpo-ebeln,
ebelp like ekpo-ebelp,
afnam like ekpo-afnam,
banfn like ekpo-banfn,
bednr like ekpo-bednr,
bukrs like ekpo-bukrs,
end of it_ekpo.
when '2LIS_02_ITM'.
it_mcekpo[] = c_t_data[].
select ebeln ebelp afnam banfn bednr bukrs
from ekpo into table it_ekpo
for all entries in it_mcekpo
where ebeln = it_mcekpo-ebeln and
ebelp = it_mcekpo-ebelp.
performance imprv.
if not it_ekpo is initial.
sort it_ekpo by ebeln ebelp.
endif.
loop at it_mcekpo.
read table it_ekpo with key ebeln = it_mcekpo-ebeln
ebelp = it_mcekpo-ebelp
binary search.
if sy-subrc = 0.
it_mcekpo-zzafnam = it_ekpo-afnam.
it_mcekpo-zzbanfn = it_ekpo-banfn.
it_mcekpo-zzbednr = it_ekpo-bednr.
it_mcekpo-zzabukrs = it_ekpo-bukrs.
endif.
modify it_mcekpo.
endloop.Hi,
TRY the below code :
TYPES BEGIN OF TYPE_02ITM.
INCLUDE STRUCTURE MC02M_0ITM.
TYPES END OF TYPE_02ITM.
TYPES: BEGIN OF TYPE__ekpo,
ebeln like ekpo-ebeln,
ebelp like ekpo-ebelp,
afnam like ekpo-afnam,
banfn like ekpo-banfn,
bednr like ekpo-bednr,
bukrs like ekpo-bukrs,
end of type_ekpo.
CASE I_DATASOURCE.
when '2LIS_02_ITM'.
WHEN '2LIS_02_ITM'.
DATA:
ITAB_EKPO TYPE STANDARD TABLE OF TYPE_EKPO
WITH HEADER LINE
WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
DATA:
ITAB_02ITM TYPE STANDARD TABLE OF TYPE_02ITM
WITH HEADER LINE
WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
ITAB_02ITM[] = C_T_DATA[] .
select ebeln ebelp afnam banfn bednr bukrs
from ekpo into table itab_ekpo
for all entries in ITAB_02ITM
where ebeln = ITAB_02ITM-ebeln and
ebelp = ITAB_02ITM-ebelp.
performance imprv.
if not itab_ekpo is initial.
sort itab_ekpo by ebeln ebelp.
endif.
loop at ITAB_02ITM.
read table itab_ekpo with key ebeln = ITAB_02ITM-ebeln
ebelp = ITAB_02ITM-ebelp
binary search.
if sy-subrc = 0.
ITAB_02ITM-zzafnam = itab_ekpo-afnam.
ITAB_02ITM-zzbanfn = itab_ekpo-banfn.
ITAB_02ITM-zzbednr = itab_ekpo-bednr.
ITAB_02ITM-zzabukrs = itab_ekpo-bukrs.
endif.
modify ITAB_02ITM.
endloop.
c_t_data[] = ITAB_02ITM[].
With rgds,
Anil Kumar Sharma .P -
Call ABAP program from Unix script passing dynamic filename
Hi,
Does anyone know if it is possible to call an ABAP program from a Unix script passing a dynamic filename to the ABAP program?
We are receiving a file from an external company and on receipt of the file want to call an ABAP program passing the filename. The filename is made up of File ID, Date and Time which we need to read in the ABAP program. We usually use Events to trigger a program which is fine when the filename if static however since this filename will be dynamic we cannot do this. In addition we cannot just rename the file to a static name in the Unix script as we need to know the value of the date and time from the file ID in the ABAP program. I can change the ABAP program to check our /in directory for a Filename that starts with the fixed File ID however I thought there must be a better way of doing this. We want the external company to put this information in a file header record but they don't want to change the file contents. Any ideas would be appreciated.
Thanks,
Sinead.You could follow the following method
1.Let the external file reside in the SAP application layer in a defined path e.g. /usr/sap/tmp/interface/working/
2.Write an ABAP program which will include the following steps:-
i) read all files in the file path using function module EPS_GET_DIRECTORY_LISTING
ii) Read the data from files existing in the directory using OPEN_DATASET statement
iii) After the files have been read move the files to another directory e.g. /usr/sap/tmp/interface/backup/ or you can delete the file.
3.Schedule this program to be executed depending on the frequency of the external file being generated. -
Startrfc - SAP utility to invoke ABAP programs from External systems
We have used the startrfc uitlity that comes along with the SAP Presentation CD. This is bundled with the SAP RFC SDK kit. The startrfc utility can be used to invoke ABAP programs from external systems or servers.
When using the startrfc from the SAP server using the parameters
startrfc -h 10.60.0.31 -s 01 -c 100 -u USERNAME -p PASS -F <Function Module> -E TPPARAM=\usr\sap\trans\bin\tp_domain_<SID>.PFL -T LIST,300,w=list.txt
the desired results are achieved.
However when using the same startrfc with the exact parameters from another server we get the message " Incorrect user or password". If we use the SAP GUI from this server to connect to the SAP server using the same username and password we are able to connect to the SAP system.
Has anyone encountered any similar issues with Startrfc? Any suggestion will be appreciated.
Thanks,
~NileshHi NIlesh,
Did you check that the password and user ID entered are in capita letters?
Thanks and Regards,
RK -
Removing or destroying an ABAP program from memory
Hello!
Is there a command to kill, unload, remove or destroy a previously called ABAP program from memory? Let me explain what I'm trying to do:
I'm doing some WM developments and I use the function L_TO_CONFIRM to confirm transfer orders. This function belongs to function group L03B (program SAPLL03B) and eventually it makes external calls to subroutines belonging to program SAPML03T.
If my Z program calls this funcion, the SAPLL03B program is responsible for loading SAPML03T into memory and everything works fine. The loaded programs list (on the debugging menu) are like this:
No Program Group with
52 SAPLL03B
78 SAPML03T 52
This is also what I get if testing L_TO_CONFIRM from SE37, where it also works.
But I wanted to reuse some subroutines from SAPML03T on my Z program, so I call something like this:
PERFORM set_quit_icon(sapml03t) ...
This call happens before the function call, so SAPML03T gets loaded by my Z program first, and stays on the memory. The list of loaded programs then looks like this:
No Program Grouped with
1 ZWMO_023
27 SAPML03T 1
So after calling the external subroutine in SAPML03T, I do some more coding and finally call the function L_TO_CONFIRM. Inside this call, my list looks like:
No Program Group
1 ZWMO_023 => My Z program
27 SAPML03T 1
28 SAPLL03B
So SAPML03T is grouped with my Z program and not SAPLL03B as it would be if I hadn't called the external subroutine first.
Now, the problem:
Since SAPML03T and SAPLL03B apparently share some global data (at least global workarea/table LTAK), in a normal call (SAPML03T)LTAK gets filled by a select statement and instantly (and somewhat inexplicable from what I new until now) (SAPLL03B)LTAK also gets filled by the same data. Well, I've only seen stuff like this with field-symbols but this is not the case. I would bet this two workareas would always be in fact two different workareas, but during the straight function call they are not. They are the same (I wish I could find their pointer addresses (like C++ stuff) to prove they were the same, but I couldn't). But if I call the external subroutine first and SAPML03T gets loaded, then I do have two different LTAKs and that's where I have problems, because L_TO_CONFIRM was coded considering this single workarea thing and when I have two, it doesn't work.Yes, I tought about that.
As a matter of fact, just last week we had another global memory issue in a costing user-exit and we tried solving it with a STARTING NEW TASK. This initialy solved our problem, but this command leads to the opening of a new gui session, and when running this cost calculation procedure in the background, a short dump COMMUNICATION FAILURE was raised, probably because of the lack of a SAP GUI link. We then used DESTINATION 'NONE' and this solved the problem (I think it also opens a new LUW).
Also my WM problem is on a Z application that will be running under SAP Console, and I don't think opening a new GUI session with STARTING NEW TASK under SAP Console will work. I should try it anyway. - edited: I just remebered I did this a couple years go and it works
I could use DESTINIATION 'NONE' in this case too, since the funcion module is RFC-enabled already. There are a few ways to solve the problem (which is already solved by the way). My main question still is about removing a whole program from SAP memory through ABAP commands.
Thank you very much! -
Hi Everyone,
I am trying to develop a ABAP Program to unlock users in sap client. Please if anyone can help me I will be thankful to them.
Thanks in advance.
Regards,
Gaurav.eh, such a functionality already exists. in SU01 you got a button for that.
-
How to translate the key words in ABAp program from lower case to upper cas
How to translate the key words in ABAp program from lower case to upper case?
Hi Kittu,
You need to set the Pretty Printer settings to achieve key words in ABAP program from lower case to upper case.
Utilities -> Settings -> Pretty Printer (tab) -> Select third radio button.
Thats all.
<b>Reward points if this helps.
Manish</b> -
Call an ABAP Program from Web Application designer
Hi Gurus,
I have an requirement in which I need to fetch an CSV file from the server and place the file into an internal table in R/3.I got the function module and wrote the program for this,but now I need to call this ABAP program from Web Application designer.
To make it more explicit ,I need to call an ABAP Program /function module from the WAD.I am new to WAD Please help.
AnkitHi Ankit,
take a look:
/thread/725385 [original link is broken]
WAD and ABAP
How to call a ABAP or ABAP Class from the WEB
/people/kai.wachter/blog/2008/03/11/how-to-write-own-items-in-bi-70-java-runtime
Regards
Andreas -
Calling ABAP Program from a Process Chain
I am calling an ABAP Program from Process Chain by adding a Process Type u201CABAP Programu201D,
My ABAP program writes lots of information using write statements.
I looked in Process Chain Log; I do not see output from Write statement. I am pretty sure my write statements were executed. I also looked in SM37 job log. I do not see any more information.
Where to see the output generated from ABAP.
Thanks.Hi,
First find out where your ABAP program the data written.You need to write it into and spool then only you can see it.
Transaction SP01, you can use the FM 'GET_PRINT_PARAMETERS' in your abap program to write to spool.
Thanks,
Ravi -
Call ABAP program from a Feature - PE03
We are in process of upgrading from 4.6 C to ECC 6.0. One feature (CSTV1) will not activate because there is a limit on generated programs to under 10,000 ABAP statements. SAP told me to call an ABAP program from the feature to reduce the number of ABAP statements in the generated program. Has anyone created a feature that called an ABAP program? I searched SAP help and I can't find any information about calling a ABAP program.
Thanks in advance,
Mark AshabranerHi Mark,
You can try it this way.. Get the name of the ABAP Program generated by the feature from its attributes. it will be something like '1PAPA/FEAT020Z0106'...May be you can change this program ie put a substantial chunk of this code in a subroutine in another program & call that with a PERFORM from this Program..
~Suresh -
Call ABAP Program from outside SAP
Hi all,
How can I call an ABAP program from outside SAP, for example from a C++ executable, a .NET assembly or a JAVA package ? Are their "adapters" provided by SAP for this ?
AngelaHi Angela,
as mho already stated:
For external connections to ABAP, the sap-proprietary "remote function call (RFC)" is a common way.
SAP delivers an RFC-library for this, and for some development environments SAP even offers a connector on top of this library to make connectivity more easy (SAP Java Connector, SAP Business Connector, SAP Connector for Microsoft .Net). An RFC is always starting function modules in ABAP, not ABAP programs, and these function modules need the attribute "remote-enabled".
(Remark: in the context of SAP NetWeaver Process Integration, SAP offers adapters for connectivity, also for ABAP systems.)
For ABAP systems on basis code line 6.20 and above, the remote-enabled function modules can externally be used as web services.
Information on RFC can be found in the SAP Help Portal http://www.help.sap.com, e.g. [RFC Call - Example Program|http://help.sap.com/saphelp_nw04/helpdata/en/3d/733760ccb411d2b4550060941936e3/frameset.htm]. A search in SDN provides links to the Help Portal as well.
>
Angela GALACY wrote:
> For example, what if I develop an EJB inside NetWeaver, will I be able to access this from any J2EE client ?
This part is beyond the ABAP question, and my guess is pretty simple: like on any other J2EE server.
Regards, Boris -
How to access the abap program from MS Excel?
Hi ,
How to access the abap program from MS Excel or MS access ?
The abap program "z..." has the below input and output attributes
Input : Date,Index and file name with location (.htm or .xls)
Output : htm or xls file downloaded at the above location.
Please help me here.Do we haev to use BAPI and RFC?If yes,please tell me how to use them
Regards
DineshMaybe this could help you up -;)
[Simple SE38 Emulator using Microsoft Excel|Simple SE38 Emulator using Microsoft Excel]
Greetings,
Blag. -
Is it safe/okay to use RSNAST00 program in a user-exit?
Hi Experts,
I got a business requirement and its:
After SAVEing the sales order......by using the user-exit USEREXIT_SAVE_DOCUMENT I have to trigger custom IDOC (currently its in the system and using for some other application) outbound direction to XYZ logical system.
But, the functional spec is asking me to to use RSNAST00 program in the above said user-exit.
So pls clarify,
1) Is it safe to use this RSNAST00 program in the user-exits?
2) If so, Wht is the best/safest approach to use it? is it by using SUBMIT AND RETURN statement? or do we have any other?
3) Actually, guess this is not good approach (achieving via ABAP workbench/triggering IDOC outbound by custom code of user-exit) to meet this functionality.......its a configuration task need to done by functional guy.Thank you Vinod.
If thats the ONLY concern, then I can write a seperate FM, where in I will use SUBMIT RSNAST00 AND RETURN statements, and I will call this FM in a SEPERATE / BACKGROUND TASK, which works in a seperate LWU.
Pls. shade some light
Thank you -
Send email from PA30 user exit
When I try to send an email from user exit in ZXPADU02 it never makes it to SOST. WIll always go to SBWP outbox if I set the flag but never gets sent to receiver address.
If I paste the following code into a report it works fine. Is there some other parameter for this FM or some additional process needed to send email from a user exit?
DATA: maildata TYPE sodocchgi1.
DATA: mailtxt TYPE TABLE OF solisti1 WITH HEADER LINE.
DATA: mailrec TYPE TABLE OF somlrec90 WITH HEADER LINE.
CLEAR maildata.
REFRESH: mailtxt, mailrec.
maildata-obj_name = 'SRVC_EMAIL'.
maildata-obj_descr = 'Email test'.
maildata-obj_langu = sy-langu.
mailtxt-line = 'Test line from user exit'.
APPEND mailtxt.
mailrec-receiver = '[email protected]'.
mailrec-rec_type = 'U'.
APPEND mailrec.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = maildata
document_type = 'RAW'
put_in_outbox = 'X'
commit_work = 'X'
TABLES
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.Put the function call 'SO_NEW_DOCUMENT_SEND_API1'
in a report Program & SUBMIT that report from ZXPADU02.
Arya -
Starting a GP from a User Exit?
Hi all,
How do I start a GP from a user exit?
The scenario is like this: when a notification is created in SAP (transaction QM01), it should trigger the GP.
Thank you very much,
Frederik-JanThe actual place to find the information you need to start GP using Web Services (which you can then implement in a User Exit) is here
http://help.sap.com/saphelp_nw2004s/helpdata/en/44/44c59fd7c72e84e10000000a155369/frameset.htm
Maybe you are looking for
-
My iPod's weather app keep crashing. I already tried resetting, updating (theres always an error) restoring and all of that. I don't know what to do now!
-
Azure MFA User Portal - Cannot Connect
The issue that I am having is that after installing the User Portal, I receive this error message: Error communicating with the local Multi-Factor Authentication service. Please contact your administrator. I found a recent MSDN forum question titled
-
Error in CRM_ICI_TRACE
Hi, Exception CX_CRM_MCM_EXCEPTION Exception text Message class CRM_IC_APPL_UI_CHMSG message number 060 message Cannot log on to communication management software system Program name CL_CRM_MCM_SESSION============CP Include name CL_CRM_MCM_SESSION==
-
What flash player is advised for iPad?
I need a good substitution for a flash player for my iPad. College classes are posting videos that require a flash player......what would be best?
-
Loading object type data -- solution required ASAP
Hi I have the following table content (id number primary key, content contenttype) where contenttyoe is (doc blob, mimetype varchar2(100)) In order to load Bulk data I use ths following script but it keeps giving errors Please can anyone help LOAD DA