ABAP Coding for RFC inputs
Hi,
I am new to ABAP coding. I use the WebDynpro ABAP . In that I need to call a RFC and get the data into the portal. I need to pass some input paramer to RFC. How could I do in the ABAP programming ?
thanks
Suresh
Hi suresh,
What you are asking is a not a wdbdynpro specific doubt but it is more related to abap.So i think you need to get some information about creating and using FM and RFC in abap.
Well i would just try to give you the steps that you should follow.
Step 1) Create a function module by using T CODE se37 make it remote enable i.e make it a RFC (you will ust need to check a radio button in properties tab)
Step 2) In rfc try to define the importing and exporting parameters and write your logic in the coding section.
Step 3) After creating RFC successully now u craete your webdynpro component and create a view inside the component.In view accrding to your business requirement you call this RFC in any of the methods i.e either in hooks methods or your custom methods .And pass the parameters to that rfc and get the results from the rfc.
Well i think i have just given you the overview of the process so while development if get any problem feel free to ask
regards
PG
Similar Messages
-
ABAP-Coding for EVERY Key figure in infocube 0RT_C02
Hello gurus;
Does anybody know which is the reason for Abap-coding for every key figure in infocube 0rt_c02 from InfoSource 2lis_13_vditm?
Thanks in advanced!
CsrHi,
this is done like this in the business content because the extractor is providing the data with a process key; this process key is then translated into meaningfull business objects (key figures);
fro instance ProcessKey 202 in application SD is reflecting Credit memos:
* Credit Memo
IF COMM_STRUCTURE-PROCESSKEY = '202'
AND COMM_STRUCTURE-BWAPPLNM EQ 'SD'.
* currency convert
IF COMM_STRUCTURE-COST <> 0. "Value in document UNIT
PERFORM LOC_CURR_CONVERT
USING COMM_STRUCTURE-COST "Value in doc UNIT
COMM_STRUCTURE-TRANS_DATE "Date for exchange
COMM_STRUCTURE-DOC_CURRCY "Document Currency
COMM_STRUCTURE-LOC_CURRCY "Local currency
* COMM_STRUCTURE-EXCHG_RATE "Exchanging rate
COMM_STRUCTURE-/BIC/ZEXRATEAC "Exchanging rate Acctn
CHANGING RESULT.
* the KPI's must be turned to positive because the SD-extractors
* allways deliver them neg. if it's a process back (e.g. return order)
RESULT = RESULT * ( -1 ).
UNIT = COMM_STRUCTURE-LOC_CURRCY.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
ELSE.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 4.
ENDIF.
ELSE.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 4.
ENDIF.
the above routine is quite self explaining the code.
hope this helps...
Olivier.
Message was edited by:
Olivier Cora -
Hello Gurus,
I need some documents or links where i can find enough info to learn abt ABAP coding in transfer, update rules, ABAP routine in infopackage and in the start routine etc. Can any one help me with this?
Looking for some basic concepts of ABAP.
Thank you,
Kumar
[email protected]Hi,
Please check the following links that may be useful for you.
http://help.sap.com/saphelp_46c/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htm
http://help.sap.com/printdocu/core/Print46c/en/Data/htm/english.htm.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/4493c4a6-0301-0010-62a2-efd6ded61e04https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/60cecb1d-0a01-0010-8289-b14fd99062fa
http://www.bwexpertonline.com/downloads/ABAPCodeforRuvinskyarticle.doc
http://www.bwexpertonline.com/downloads/Extractor_Source_Code.doc
http://www.bwexpertonline.com/downloads/Nissen.doc
https://www.sdn.sap.com/irj/sdn/abap
http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm
http://www.sapgenie.com/faq/abap.htm
Regards,
® -
ABAP coding for variable SAP exit
Hi,
I'm looking for a way to see the coding of a SAP-exit query variable: 0FYTLFP.
So this is NO custom-exit (via CMOD).
I've tried the FM: RSVAREXIT<varname> but it doesn't exist.
Via RSRT i couldn't find the piece of coding either.
I'm not looking for the functionality but the piece of coding that is used for this.
How can I find it??
Cheers.Ok, this code works as per my note above. If the period of the system date is the first of the fiscal year, it will return to the previous fiscal year to get a range for YTD.
Basically, this acts as if you're running the query in the previous period for current YTD.
WHEN 'ZFYTLFP'.
CLEAR: ZE_T_RANGE, E_T_RANGE, ZI_T_VAR_RANGE, W_YEAR, W_PERIOD, L_FPER.
DATA: l_poper LIKE t009b-poper.
DATA: l_fiscyear LIKE t009b-bdatj.
DATA: l_curdate LIKE sy-datum.
l_curdate = SY-DATUM.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = l_curdate
i_periv = i_periv
IMPORTING
e_buper = l_poper
e_gjahr = l_fiscyear
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
W_YEAR = l_fiscyear(4).
W_PERIOD = l_poper(3).
IF W_PERIOD = '001'.
W_YEAR = W_YEAR - 1.
W_PERIOD = '012'.
ELSE.
W_PERIOD = W_PERIOD - 1.
ENDIF.
ZE_T_RANGE-LOW(4) = W_YEAR." year
ZE_T_RANGE-LOW+4(3) = '001'.
ZE_T_RANGE-HIGH(4) = W_YEAR. " year
ZE_T_RANGE-HIGH+4(3) = W_PERIOD.
ZE_T_RANGE-SIGN = 'I'.
ZE_T_RANGE-OPT = 'EQ'.
APPEND ZE_T_RANGE TO E_T_RANGE. -
ABAP Coding for uploading flat file
Hello experts,
I have a requirement like this..
i am uploading a flat to SEM-BPS transactional cube.my requirement is like this.
my flat file structure is
PP;QQ;RR;SS
A; X; 1; 1
B: 1: X: X.
Here the PP QQ RR SS are the field names. If PP = A and QQ = X then the record should not update. else the record should be updated (PP = A , RR = 1 )
Kindly provide me the Sample coding
Thanks in advance.
Anil.
Message was edited by:
anil kumarTO load this file, you dont have to adopt the BPS way;it is like any other flat file load.
All you have to do is to delete all records in the data package where PP = a.
Delete data _pcakage where pp = 'AA'.
But i dont understand your other logic ( PP=a, RR =1).
Ravi Thothadri -
Please help me in ABAP coding for the incoming transactional data
Hi
I have the following transactional data
Transaction ID- Buyer- Seg- Fam- Cla -Com-Total
00001 - AB co - Engineering - Machinery - Equipment - Mechanical -15000
00002 - AC co - Engineering - Machinery - Equipment - Mechanical -15850
00003 - DE co - IT - Hardware - Mouse -Optical -5850
00004 - AC co - Engineering - Machinery - Equipment - Architectural -10000
00005 - FE co - Engineering - Machinery - Equipment - NOT_KNOWN -1580
00006 - KC co - Engineering - Machinery - Equipment - NOT_KNOWN -75850
00007 - EG co - Engineering - Machinery - Equipment - Mechanical -180050
00008 - AS co- Engineering - Machinery - Equipment - Architectural -10550
00009 - DE co - IT - Hardware - Mouse -Optical -58500
00010 - EF co - IT - Hardware - Mouse -NOT_KNOWN -555850
00011 - EF co - Engineering - Machinery - Equipment - Mechanical -44850
00012 - AC co - IT - Hardware - NOT_KNOWN -NOT_KNOWN -585550
In this transactional data, SEG-> FAM -> CLA -> COM are in hierarchy
To distiguish the NOT_KNOWN which have different level i like to change there names like this...
NOT_KNOWN_1, NOT_KNOWN_2....like that
I expect the results to be like this
Transaction ID- Buyer- Seg- Fam- Cla -Com-Total
00001 - AB co - Engineering - Machinery - Equipment - Mechanical -15000
00002 - AC co - Engineering - Machinery - Equipment - Mechanical -15850
00003 - DE co - IT - Hardware - Mouse -Optical -5850
00004 - AC co - Engineering - Machinery - Equipment - Architectural -10000
00005 - FE co - Engineering - Machinery - Equipment - NOT_KNOWN_1 -1580
00006 - KC co - Engineering - Machinery - Equipment - NOT_KNOWN_1 -75850
00007 - EG co - Engineering - Machinery - Equipment - Mechanical -180050
00008 - AS co- Engineering - Machinery - Equipment - Architectural -10550
00009 - DE co - IT - Hardware - Mouse -Optical -58500
00010 - EF co - IT - Hardware - Mouse -NOT_KNOWN_2 -555850
00011 - EF co - Engineering - Machinery - Equipment - Mechanical -44850
00012 - AC co - IT - Hardware - NOT_KNOWN_3 -NOT_KNOWN_4 -585550
I like to make this changes in the coming data by writing a start routine
Could anyone provide me the required code to make this happen
Plz help me
Regards
KCHi
My Start routine screen look like this
Declaration of transfer structure (selected fields only)
TYPES: BEGIN OF TRANSFER_STRUCTURE ,
Record number to be filled in case of adding row(s)
to enable 'error handling'
record TYPE rsarecord,
InfoObject TRAID: CHAR - 000060
/BIC/TRAID(000060) TYPE C,
InfoObject SEG5: CHAR - 000060
/BIC/SEG5(000060) TYPE C,
InfoObject FAM5: CHAR - 000060
/BIC/FAM5(000060) TYPE C,
InfoObject CLA5: CHAR - 000060
/BIC/CLA5(000060) TYPE C,
InfoObject COM5: CHAR - 000032
/BIC/COM5(000032) TYPE C,
InfoObject COCE: NUMC - 000015
InfoObject TOTALSEG: CHAR - 000032
/BIC/TOTALSEG(000032) TYPE C,
END OF TRANSFER_STRUCTURE .
Is this information you are lookin or something more
Regards
KC -
Performance of ABAP coding very poor
Hi gurus,
I'm a newbie in ABAP programming.
Currently, I managed to write an ABAP coding for BW to load data from a source DSO to target DSO.
We are using BW 3.5.
In the source, we have YTD amount as Key Figures.
In the start routine, we use ABAP coding to calculate the Monthly value and Last 12 Months value.
Monthly value is defined as: current month YTD - last month YTD (except when current month = January, then monthly value for January = YTD value for January)
Last 12 months value is calculated for example as follow:
for March 08, then Last 12 months value is April 07-March08
Thus the formula for last 12 Months value is:
YTD current month current year + YTD month12 last year - YTD current month last year
I used internal table to read and store all of the information
However, I need to read 3 times from internal table to get all of the necessary value to calculate the monthly value and last 12 months value.
The performance is very low. The system runs for 40 minutes to read and calculate 15500 data.
Therefore if you can perhaps give some hint/tip/tricks how to improve the performance of the code, it will be highly appreciated.
Thank you very much in advance.
Best regards,
Fen
My code is as follow:
Define internal table to hold last year & current year data:
DATA: LCYEARDATA type sorted table of /bic/aZABC3_O00
with unique key /BIC/ZABC_ENTI /BIC/ZABC_ACC
/BIC/ZABC_SUBA /BIC/ZABC_VERS CALMONTH
with header line.
Create variables needed to hold last month/year values.
DATA: CALMONTHLOW TYPE /BI0/OICALMONTH.
DATA: CALMONTHHIGH TYPE /BI0/OICALMONTH.
DATA: CALYEARTHISYEAR TYPE /BI0/OICALYEAR.
DATA: CALYEARLASTYEAR TYPE /BI0/OICALYEAR.
DATA: CURRENTMONTH TYPE /BI0/OICALMONTH2.
DATA: CURRENTMONTHLASTYEAR TYPE /BI0/OICALMONTH.
DATA: LASTMONTH TYPE /BI0/OICALMONTH.
DATA: CALMONTH12LASTYEAR TYPE /BI0/OICALMONTH.
DATA: LASTMOYTD type /BI0/OIAMOUNT.
DATA: LAST12MONTH TYPE /BI0/OIAMOUNT.
DATA: YTDLASTYEAR type /BI0/OIAMOUNT.
DATA: FIRSTRUN type N.
DATA: MONTHLYVALUE type /BI0/OIAMOUNT.
DATA: YTDMONTHLASTYEAR type /BI0/OIAMOUNT.
DATA: AMOUNT type /BI0/OIAMOUNT.
Set initial value of all variables to 0.
CALMONTHLOW = 0.
CALMONTHHIGH = 0.
CALYEARTHISYEAR = 0.
CALYEARLASTYEAR = 0.
CURRENTMONTH = 0.
CURRENTMONTHLASTYEAR = 0.
LASTMONTH = 0.
LASTMOYTD = 0.
LAST12MONTH = 0.
YTDLASTYEAR = 0.
YTDMONTHLASTYEAR = 0.
FIRSTRUN = 0.
MONTHLYVALUE = 0.
CALMONTH12LASTYEAR = 0.
Loop through data package.
LOOP AT DATA_PACKAGE.
IF DATA_PACKAGE IS NOT INITIAL.
First run:
IF FIRSTRUN = 0.
Get current year from any line in the data package.
CALYEARTHISYEAR = DATA_PACKAGE-CALMONTH(4).
FIRSTRUN = 1.
ENDIF.
Calculate last year (i.e. data package year - 1).
CALYEARLASTYEAR = CALYEARTHISYEAR - 1.
Calculate current month
CURRENTMONTH = DATA_PACKAGE-CALMONTH+4(2).
*Set CALMONTHLOW and CALMONTHHIGH as time period to fill the internal
*table:
CONCATENATE CALYEARLASTYEAR CURRENTMONTH INTO CALMONTHLOW.
CONCATENATE CALYEARTHISYEAR CURRENTMONTH INTO CALMONTHHIGH.
Fill internal table with Last Years data and Current Year data:
select *
from /bic/aABC2_O00
into table LCYEARDATA
WHERE CALMONTH >= CALMONTHLOW
AND CALMONTH <= CALMONTHHIGH
AND /BIC/ZABC_ENTI = DATA_PACKAGE-/BIC/ZABC_ENTI
AND /BIC/ZABC_ACC = DATA_PACKAGE-/BIC/ZABC_ACC
AND /BIC/ZABC_SUBA = DATA_PACKAGE-/BIC/ZABC_SUBA
AND /BIC/ZABC_VERS = DATA_PACKAGE-/BIC/ZABC_VERS.
Continue with the looping
Get last month from current month.
LASTMONTH = DATA_PACKAGE-CALMONTH - 1.
*CHECK IF CURRENTMONTH = JAN then LastmonthYTD amount = 0, else read
*from the internal table.
*CURRENTMONTH = DATA_PACKAGE-CALMONTH+4(2). (this variable has been set
*above)
IF CURRENTMONTH = '01'.
LASTMOYTD = 0.
ELSE.
READ TABLE LCYEARDATA
WITH KEY
/BIC/ZABC_ENTI = DATA_PACKAGE-/BIC/ZABC_ENTI
/BIC/ZABC_ACC = DATA_PACKAGE-/BIC/ZABC_ACC
/BIC/ZABC_SUBA = DATA_PACKAGE-/BIC/ZABC_SUBA
/BIC/ZABC_VERS = DATA_PACKAGE-/BIC/ZABC_VERS
CALMONTH = LASTMONTH.
IF sy-subrc IS INITIAL.
LASTMOYTD = LCYEARDATA-AMOUNT.
ENDIF.
ENDIF.
*Calculate Monhtly value for this month (to later be stored in data
*package)
MONTHLYVALUE = DATA_PACKAGE-AMOUNT - LASTMOYTD.
Count value for Last 12 Months:
1: Get the YTD Month12 Last Year & YTD CurrentMonth Last Year.
CONCATENATE CALYEARLASTYEAR CURRENTMONTH INTO
CURRENTMONTHLASTYEAR.
CONCATENATE CALYEARLASTYEAR '12' INTO CALMONTH12LASTYEAR.
READ TABLE LCYEARDATA
WITH KEY
/BIC/ZABC_ENTI = DATA_PACKAGE-/BIC/ZABC_ENTI
/BIC/ZABC_ACC = DATA_PACKAGE-/BIC/ZABC_ACC
/BIC/ZABC_SUBA = DATA_PACKAGE-/BIC/ZABC_SUBA
/BIC/ZABC_VERS = DATA_PACKAGE-/BIC/ZABC_VERS
CALMONTH = CALMONTH12LASTYEAR.
IF sy-subrc IS INITIAL.
YTDLASTYEAR = LCYEARDATA-AMOUNT.
ENDIF.
READ TABLE LCYEARDATA
WITH KEY
/BIC/ZABC_ENTI = DATA_PACKAGE-/BIC/ZABC_ENTI
/BIC/ZABC_ACC = DATA_PACKAGE-/BIC/ZABC_ACC
/BIC/ZABC_SUBA = DATA_PACKAGE-/BIC/ZABC_SUBA
/BIC/ZABC_VERS = DATA_PACKAGE-/BIC/ZABC_VERS
CALMONTH = CURRENTMONTHLASTYEAR.
IF sy-subrc IS INITIAL.
YTDMONTHLASTYEAR = LCYEARDATA-AMOUNT.
ENDIF.
2. Specify YTD This month.
AMOUNT = DATA_PACKAGE-AMOUNT.
*3: Last 12 Months = (YTD Last Year - YTD Month Last Year) + YTD This
*Month
LAST12MONTH = YTDLASTYEAR - YTDMONTHLASTYEAR + YTDTHISMONTH.
LAST12MONTH = YTDLASTYEAR - YTDMONTHLASTYEAR + AMOUNT.
Save MONTHLYVALUE and LAST12MONTH to the DATA_PACKAGE.
DATA_PACKAGE-/BIC/ZAMTMO = MONTHLYVALUE.
DATA_PACKAGE-/BIC/ZAMTLTM = LAST12MONTH.
modify DATA_PACKAGE.
ENDIF.
ENDLOOP.
ABORT = 0.Hi,
Just check these blogs to improve performance...
The SQL Trace (ST05) u2013 Quick and Easy
The SQL Trace (ST05) Quick and Easy
The ABAP Runtime Trace (SE30) - Quick and Easy
The ABAP Runtime Trace (SE30) - Quick and Easy
Regards,
Sachin -
ABAP coding in defining start condition for action.
Hi Everybody,
Can anyone tell me if ABAP coding is possible for giving condition for action? If yes, where? Is it in condition editor? I have 3 validations to be done:- 1) Filter service contract (transaction type USC), 2) Filter the active contracts, 3) Filter contracts which doesn't have billing cycle in current month.
So, do you think these validations can be done in start condition of action? First two validations are static in nature and thus can be done. But, how about the last condition?
Please help.
Regards,
Sanj.Hi Sanj
I would do this.
1. The transaction type cannot be changed, therfore I will set this up in the scheduling condition.
2. Active contracts. Depends on teh definiton of active. If it is based on some status then I will use scheduling condition.
3. use one of the dates in the date profile to determine if the billing date is in the current month or not.
See if this helps.
Thanks -
Coding for ABAP Proxy and mapping
Hi XI Ds
which one need coding neither ABAP Proxy nor ABAP Mapping
ThanksHi Kushee ,
We need coding for both ABAP Proxy and mapping. We need to know some OO(Object Oreinted) ABAP concepts.
We can also import JAVA CODE for certain functionality.
Check the following websites for clarity:
how to create a flat file out of an IDoc-XML by means of an ABAP mapping program and the J2EE File Adapter.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
cheers!
gyanaraj -
Please tell me if coding for ITS is done in ABAP.
Hi all,
Please tell me if coding for ITS based on ABAP.
Thanks.Hello Sanjiv,
I'm not sure I understand the question...
ITS uses BusinessHTML and HTML and other Internet standards (css, js, etc). However, you can develop in ABAP and then use SE80 to generate a template for you or use the WEBGUI service to call your ABAP developed transaction directly. You can find more information by using the links at the top of the ITS forum to go to the Wiki or FAQ or Product page for the ITS.
Edgar -
What is LUW? How do we use it in SAP ABAP coding?
Hi Friends,
Kindly explain me what is LUW with examples and how do we use it in our ABAP coding with scenarios why and when we use it?
Regards,
PradeepHi,
SAP LUW
Die Verbuchungsverwaltung
The Open SQL statements INSERT, UPDATE, MODIFY, and DELETE allow you to program database changes that extend over several dialog steps. Even if you have not explicitly programmed a database commit, the implicit database commit that occurs after a screen has been processed concludes the database LUW. The following diagram shows the individual database LUWs in a typical screen sequence:
Under this procedure, you cannot roll back the database changes from previous dialog steps. It is therefore only suitable for programs in which there is no logical relationship between the individual dialog steps.
However, the database changes in individual dialog steps normally depend on those in other dialog steps, and must therefore all be executed or rolled back together. These dependent database changes form logical units, and can be grouped into a single database LUW using the bundling techniques listed below.
A logical unit consisting of dialog steps, whose changes are written to the database in a single database LUW is called an SAP LUW. Unlike a database LUW, an SAP LUW can span several dialog steps, and be executed using a series of different work processes. If an SAP LUW contains database changes, you should either write all of them or none at all to the database. To ensure that this happens, you must include a database commit when your transaction has ended successfully, and a database rollback in case the program detects an error. However, since database changes from a database LUW cannot be reversed in a subsequent database LUW, you must make all of the database changes for the SAP LUW in a single database LUW. To maintain data integrity, you must bundle all of you database changes in the final database LUW of the SAP LUW. The following diagram illustrates this principle:
Database Logical Unit of Work (LUW)
From the point of view of database programming, a database LUW is an inseparable sequence of database operations that ends with a database commit. The database LUW is either fully executed by the database system or not at all. Once a database LUW has been successfully executed, the database will be in a consistent state. If an error occurs within a database LUW, all of the database changes since the beginning of the database LUW are reversed. This leaves the database in the state it was in before the transaction started.
The database changes that occur within a database LUW are not actually written to the database until after the database commit. Until this happens, you can use a database rollback to reverse the changes. In the R/3 System, database commits and rollbacks can be triggered either implicitly or using explicit commands.
Implicit Database Commits in the R/3 System
A work process can only execute a single database LUW. The consequence of this is that a work process must always end a database LUW when it finishes its work for a user or an external call. Work processes trigger an implicit database commit in the following situations:
When a dialog step is completed
Control changes from the work process back to the SAP GUI.
When a function module is called in another work process (RFC).
Control passes to the other work process.
When the called function module (RFC) in the other work process ends.
Control returns to the calling work process.
When a WAIT statement interrupts the work process.
Control passes to another work process.
Error dialogs (information, warning, or error messages) in dialog steps.
Control passes from the work process to the SAP GUI.
Explicit Database Commits in the R/3 System
There are two ways to trigger an explicit database commit in your application programs:
Call the function module DB_COMMIT
The sole task of this function module is to start a database commit.
Use the ABAP statement COMMIT WORK
This statement starts a database commit, but also performs other tasks (refer to the keyword documentation for COMMIT WORK).
Implicit Database Rollbacks in the R/3 System
The following cases lead to an implicit database rollback:
Runtime error in an application program
This occurs whenever an application program has to terminate because of an unforeseen situation (for example, trying to divide by zero).
Termination message
Termination messages are generated using the ABAP statement MESSAGE with the message type A or X. In certain cases (updates), they are also generated with message types I, W, and E. These messages end the current application program.
Explicit Database Rollbacks in the R/3 System
You can trigger a database rollback explicitly using the ABAP statement ROLLBACK WORK. This statement starts a database rollback, but also performs other tasks (refer to the keyword documentation for COMMIT WORK).
From the above, we can draw up the following list of points at which database LUWs begin and end.
A Database LUW Begins
Each time a dialog step starts (when the dialog step is sent to the work process).
Whenever the previous database LUW ends in a database commit.
Whenever the previous database LUW ends in a database rollback.
A Database LUW Ends
Each time a database commit occurs. This writes all of the changes to the database.
Each time a database rollback occurs. This reverses all of the changes made during the LUW.
Database LUWs and Database Locks
As well as the database changes made within it, a database LUW also consists of database locks. The database system uses locks to ensure that two or more users cannot change the same data simultaneously, since this could lead to inconsistent data being written to the database. A database lock can only be active for the duration of a database LUW. They are automatically released when the database LUW ends. In order to program SAP LUWs, we need a lock mechanism within the R/3 System that allows us to create locks with a longer lifetime (refer to The R/3 Locking Concept).
The bundling technique for database changes within an SAP LUW ensures that you can still reverse them. It also means that you can distribute a transaction across more than one work process, and even across more than one R/3 System. The possibilities for bundling database changes within an SAP LUW are listed below:
The simplest form of bundling would be to process a whole application within a single dialog step. Here, the system checks the users input and updates the database without a database commit occurring within the dialog step itself. Of course, this is not suitable for complex business processes. Instead, the R/3 Basis system contains the following bundling techniques.
Bundling using Function Modules for Updates
If you call a function module using the CALL FUNCTION... IN UPDATE TASK statement, the function module is flagged for execution using a special update work process. This means that you can write the Open SQL statements for the database changes in the function module instead of in your program, and call the function module at the point in the program where you would otherwise have included the statements. When you call a function module using the IN UPDATE TASK addition, it and its interface parameters are stored as a log entry in a special database table called VBLOG.
The function module is executed using an update work process when the program reaches the COMMIT WORK statement. After the COMMIT WORK statement, the dialog work process is free to receive further user input. The dialog part of the transaction finishes with the COMMIT WORK statement. The update part of the SAP LUW then begins, and this is the responsibility of the update work process. The SAP LUW is complete once the update process has committed or rolled back all of the database changes.
For further information about how to create function modules for use in update, refer to Creating Function Modules for Database Updates
During the update, errors only occur in exceptional cases, since the system checks for all logical errors, such as incorrect entries, in the dialog phase of the SAP LUW. If a logical error occurs, the program can terminate the update using the ROLLBACK WORK statement. Then, the function modules are not called, and the log entry is deleted from table VBLOG. Errors during the update itself are usually technical, for example, memory shortage. If a technical error occurs, the update work process triggers a database rollback, and places the log entry back into VBLOG. It then sends a mail to the user whose dialog originally generated the VBLOG entry with details of the termination. These errors must be corrected by the system administrator. After this, the returned VBLOG entries can be processed again.
For further information about update administration, see Update Administration
This technique of bundling database changes in the last database LUW of the SAP LUW allows you to update the database asynchronously, reducing the response times in the dialog work process. You can, for example, decouple the update entirely from the dialog work process and use a central update work process on a remote database server.
Bundling Using Subroutines
The statement PERFORM ON COMMIT calls a subroutine in the dialog work process. However, it is not executed until the system reaches the next COMMIT WORK statement. Here, as well, the ABAP statement COMMIT WORK defines the end of the SAP LUW, since all statements in a subroutine called with PERFORM ON COMMIT that make database changes are executed in the database LUW of the corresponding dialog step.
The advantage of this bundling technique against CALL FUNCTION... IN UPDATE TASK is better performance, since the update data does not have to be written into an extra table. The disadvantage, however, is that you cannot pass parameters in a PERFORM... ON COMMIT statement. Data is passed using global variables and ABAP memory. There is a considerable danger of data inconsistency when you use this method to pass data.
Bundling Using Function Modules in Other R/3 Systems
Function modules that you call using CALL FUNCTION... IN BACKGROUND TASK DESTINATION... are registered for background execution in another R/3 System when the program reaches the next COMMIT WORK statement (using Remote Function Call). After the COMMIT WORK, the dialog process does not wait for these function modules to be executed (asynchronous update). All of the function modules that you register in this way are executed together in a single database LUW. These updates are useful, for example, when you need to maintain identical data in more than one database.
For further details, refer to the keyword documentation.
For more details of RFC processing, refer to the Remote Communications section of the Basis Services documentation.
Pls. reward if useful.... -
Abap mapping for content conditions routing in a flat-flat scenario
Dear Experts.
I have a flat-flat file scenario. Based on the content of the input file, I need to route data to the receiver.The source flat file will have several IDOC details.
Assume two fields FIELD1 and FIELD2 in different segments of the IDOC. My requirement is if FIELD1 of an IDOC = "XYZ" and FIELD2 of the same IDOC = "PQR", then this IDOC's details has to be passed to the receiver.
I have tried to implement the above condition at interface determination in graphical mapping.
In the graphical mapping, the problem is:
Assuming there are 3 idocs in the input file.
FIELD1 of IDOC[1] = 'XYZ' and FIELD2 of IDOC[1] = 'PQR'
FIELD1 of IDOC[2] = 'LMN' and FIELD2 of IDOC[2] = 'RST'
FIELD1 of IDOC[3] = 'ABC' and FIELD2 of IDOC[3] = 'DEF' .
Now, if none of the IDOCs in the input file satisfy my requirement,the message mapping should not be called at all. But in my case its failing because FIELD1 of IDOC[1] and FIELD2 of IDOC[3] together are satisfying the condition and hence the message mapping is getting called.
And I need to check this condition IDOC wise. Both the conditions has to be satisfied in the same IDOC.
The question is very similar to the one posted by SHOBHA HB. (Topic:Receiver determination(or Interface determination) and conditional routing )
but, due to complexities in the graphical mapping, we have decided to go for the ABAP mapping instead.
Kindly help, by mentioning the steps I should follow for this interface, the logic basically. I already have paths to some basic ABAP mapping documents from SDN, so, kindly refrain from posting general URLS for definition or history of ABAP mapping.
IF you could guide me on this interface, It would be really helpful.
regards,
giri rajHi,
/people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
This document will help you to create ABAP Mapping .
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how%20to%20use%20abap-mapping%20in%20xi%203.0.pdf
How to Use ABAP Mapping in Exchange Infrastructure 3.0 (NW2004)
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
SAP Network Blog: How to call XI ABAP Mapping via RFC
/people/ricardoandres.maienza/blog/2007/04/06/how-to-call-xi-abap-mapping-via-rfc
SAP Network Blog: Testing ABAP Mapping
/people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
/people/udo.martens/blog/2006/08/23/comparing-performance-of-mapping-programs
An ad-on
/people/michal.krawczyk2/blog/2006/09/20/xi-abap-mapping-logs--more-standard-better-visibility
Regards -
Hi All,
A)Is it possible to write ABAP coding in LSMW, if yes where can we do this. and
B)During the First Step of LSMW we come across 1. Standard/Batch Direct Input
2.Batch input recording
3.Business Object Method (BAPI)
4.IDOC(intermediate document)
which one to use and when to use?
C) what are the advantages/disadvantages of LSMW compared to other data transfer methods like BDC.
please let me know the answers for above.
useful answers will be rewarded for the same.
Regards,
Yellappa.hi
for q posed to ashvinder, its used only for validation of the input records and their corresponding processing, i will explain a simple scenario,
1. if u want to transfer data a part of which has already been created in the system. You
want to decide at runtime whether the data is created or changed.
u can write this coding in corresponding field
2. You want to "skip" a record depending on a certain condition, i.e. this record shall not be converted and transferred to the output file.
3. Duplicate a Record
If want complex pricing procedures u cant do that in LSMW, u need to go for BDC's
for ur question about what to use, BAPI or IDOC, check this link
http://www.sap-img.com/abap/ale-bapi.htm
http://searchsap.techtarget.com/generic/0,295582,sid21_gci1089362,00.html?bucket=ETA&topic=299357
award points if found helpful
Message was edited by:
Rahul Kavuri -
Coding for maintain the multip[le sessions
i have 1,00,000 records in a flat file how to maintain the multiple sessions
each session having 10000 records i want coding for how these multiple sessionssee the example program and the selection screen you can maintain how many records per session.
Report : ZMPPC015
Type : Data upload
Author : Seshu Maramreddy
Date : 05/26/2005
Transport : DV3K920025
Transaction: ??
Description: This ABAP/4 Program to Create Planned Independent
Requirement for SMI plants using MD61 Transaction.
It accepts tab-delimited spreadsheet input and
creates BDC sessions.
report zmppc015 no standard page heading
line-size 120
line-count 55
message-id zz.
Constants
constants : c_x type c value 'X'," Dynbegin
c_tcode type tstc-tcode value 'MD61'." Transaction Code
Variables
data : v_lines_in_xcel like sy-tabix,
l_tabix like sy-tabix,
v_trans_in_ssn type i,
v_ssnnr(4) type n," Counter
v_ssnname like apqi-groupid,
v_matnr(18) type c. " Material Number
Internal Tables
Internal table for file
data : begin of t_file occurs 0,
matnr(18) type c, " Material Number
berid(10) type c, " MRP Area
PLNMG01(17) type n, " Forecast Month -01
PLNMG02(17) type n, " Forecast Month -02
PLNMG03(17) type n, " Forecast Month -03
PLNMG04(17) type n, " Forecast Month -04
PLNMG05(17) type n, " Forecast Month -05
PLNMG06(17) type n, " Forecast Month -06
PLNMG07(17) type n, " Forecast Month -07
PLNMG08(17) type n, " Forecast Month -08
PLNMG09(17) type n, " Forecast Month -09
PLNMG10(17) type n, " Forecast Month -10
PLNMG11(17) type n, " Forecast Month -11
PLNMG12(17) type n, " Forecast Month -12
WERKS(4) TYPE C, " Plant
end of t_file.
Internal table for BDCDATA Structure
data : begin of itab_bdc_tab occurs 0.
include structure bdcdata.
data : end of itab_bdc_tab.
Selection-screen
selection-screen: skip 3.
selection-screen: begin of block id1 with frame.
parameters: p_name like rlgrap-filename
default 'C:\My Documents\InputFile.txt'
obligatory,
bdc session name prefix
p_bdcpfx(6) default 'ZPIRCT'
obligatory,
number for transction per BDC session
p_trnssn type i
default 2000 obligatory,
retain the BDC session after successfull execution
p_keep like apqi-qerase
default c_x,
user who will be executing BDC session
p_uname like apqi-userid
default sy-uname
obligatory.
selection-screen : skip 1.
Requirement type
parameters : p_bedae like t459u-bedae,
From Date
p_date like sy-datum default sy-datum obligatory.
selection-screen: end of block id1.
at selection-screen on value-request for p_name.
F4 value for Input file
perform filename_get.
main processing
start-of-selection.
To get the data from file to Internal table
perform getdata_fromfile.
loop at t_file.
hang on to xcel line num
l_tabix = sy-tabix.
if num-of-trnas-in-session = 0, create new BDC session
if v_trans_in_ssn is initial.
perform bdc_session_open.
endif.
begin new bdc script for rtg create trans
fill in bdc-data for prod.version maintenance screens
perform bdc_build_script.
insert the bdc script as a BDC transaction
perform bdc_submit_transaction.
keep track of how many BDC transactions were inserted in the BDC
session
add 1 to v_trans_in_ssn.
if the user-specified num of trans in BDC session is reached OR
if end of input file is reached, close the BDC session
if v_trans_in_ssn = p_trnssn or
l_tabix = v_lines_in_xcel.
perform bdc_session_close.
clear v_trans_in_ssn.
endif.
clear t_file.
endloop.
top-of-page.
call function 'Z_HEADER'
EXPORTING
FLEX_TEXT1 =
FLEX_TEXT2 =
FLEX_TEXT3 =
*& Form filename_get
F4 Value for input file
FORM filename_get.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_PATH = 'C:\Temp\ '
MASK = ',.,..'
MODE = 'O'
TITLE = 'Select File '(007)
IMPORTING
FILENAME = p_name
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " filename_get
*& Form getdata_fromfile
Upload the data from file to Internal table
FORM getdata_fromfile.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = p_name
FILETYPE = 'DAT'
TABLES
DATA_TAB = t_file
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
if sy-subrc eq 0.
sort t_file by matnr .
delete t_file where matnr = ''.
clear v_lines_in_xcel.
describe table t_file lines v_lines_in_xcel.
if v_lines_in_xcel is initial.
write: / 'No data in input file'.
stop.
endif.
else.
write:/ 'Error reading input file'.
stop.
endif.
ENDFORM. " getdata_fromfile
*& Form bdc_session_open
BDC_OPEN_GROUP
FORM bdc_session_open.
create bdc session name = prefix-from-selectn-screen + nnnn
add 1 to v_ssnnr.
concatenate p_bdcpfx v_ssnnr into v_ssnname.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = v_ssnname
KEEP = p_keep
USER = p_uname
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " bdc_session_open
*& Form bdc_build_script
BDC Script
FORM bdc_build_script.
Local Variables
DATA : l_frdat(8) type c, " From Date
l_todat(8) type c, " To Date
l_frdat1(4) type c, " Year
l_frdat2(2) type c, " Month
l_frdat3(2) type c, " Day
l_tdate like sy-datum, " Subtract date(1)
l_todat1(4) type c, " Year
l_todat2(2) type c, " Month
l_todat3(3) type c. " Day
Get the material number from tables ZMSMI_FERR_RAW,
ZMSMI_SNAP_RAW and ZMSMI_SIMP_RAW
perform get_matnr.
Screen 0100.
perform bdc_screen using 'SAPMM60X' '0100'.
perform bdc_field using 'BDC_OKCODE' '/EBDPT'.
perform bdc_field using 'AM60X-MATAW' 'X'.
perform bdc_field using 'AM60X-MATNR' T_FILE-MATNR.
perform bdc_field using 'AM60X-PRGRP' SPACE.
perform bdc_field using 'AM60X-PBDNR' SPACE.
perform bdc_field using 'RM60X-BERID' T_FILE-BERID.
perform bdc_field using 'AM60X-WERKS' SPACE.
perform bdc_field using 'RM60X-VERSB' '00'.
Converted the date as per MD61 Transaction.
From date
l_frdat1 = p_date+0(4).
l_frdat2 = p_date+4(2).
l_frdat3 = p_date+6(2).
concatenate l_frdat2 l_frdat3 l_frdat1 into l_frdat.
To Date
l_tdate = p_date - 1.
l_todat1 = l_tdate+0(4) + 1.
l_todat2 = l_tdate+4(2).
l_todat3 = l_tdate+6(2).
concatenate l_todat2 l_todat3 l_todat1 into l_todat.
perform bdc_field using 'RM60X-DATVE' l_frdat.
perform bdc_field using 'RM60X-DATBE' l_todat.
perform bdc_field using 'RM60X-ENTLU' 'M'.
Screen 0127
perform bdc_screen using 'SAPMM60X' '0127'.
perform bdc_field using 'BDC_OKCODE' '=WEIT'.
if p_bedae is initial.
perform bdc_field using 'T459U-BEDAE' space.
else.
perform bdc_field using 'T459U-BEDAE' P_BEDAE.
endif.
Screen 0100.
perform bdc_screen using 'SAPMM60X' '0100'.
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_field using 'AM60X-MATAW' 'X'.
perform bdc_field using 'AM60X-MATNR' T_FILE-MATNR.
perform bdc_field using 'AM60X-PRGRP' SPACE.
perform bdc_field using 'AM60X-PBDNR' SPACE.
perform bdc_field using 'RM60X-BERID' T_FILE-BERID.
perform bdc_field using 'AM60X-WERKS' SPACE.
perform bdc_field using 'RM60X-VERSB' '00'.
perform bdc_field using 'RM60X-DATVE' l_frdat.
perform bdc_field using 'RM60X-DATBE' l_todat.
perform bdc_field using 'RM60X-ENTLU' 'M'.
Screen 0200
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG01.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG02.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG03.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG04.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG05.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG06.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG07.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG08.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG09.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG10.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=S+'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG11.
perform bdc_screen using 'SAPLM60E' '0200'.
perform bdc_field using 'BDC_OKCODE' '=SICH'.
perform bdc_field using 'RM60X-PLN01(01)' T_FILE-PLNMG12.
ENDFORM. " bdc_build_script
*& Form get_matnr
Get the material number from tables ZMSMI_FERR_RAW,
ZMSMI_SNAP_RAW and ZMSMI_SIMP_RAW
FORM get_matnr.
clear v_matnr.
case t_file-werks.
when '0101'.
select single cmatnr from zmsmi_simp_raw
into v_matnr where matnr = t_file-matnr.
if sy-subrc eq 0.
clear t_file-matnr.
t_file-matnr = v_matnr.
endif.
when '0103'.
select single cmatnr from zmsmi_ferr_raw
into v_matnr where matnr = t_file-matnr.
if sy-subrc eq 0.
clear t_file-matnr.
t_file-matnr = v_matnr.
endif.
when '0102' or '0110' or '0111' or '0112' or '0113'
or '0114' or '0115' or '0116' or '0117'.
select single cmatnr from zmsmi_snap_raw
into v_matnr where matnr = t_file-matnr.
if sy-subrc eq 0.
clear t_file-matnr.
t_file-matnr = v_matnr.
endif.
endcase.
ENDFORM. " get_matnr
*& Form bdc_screen
BDC Script for Screen fields
-->P_PROG Program name
-->P_SCRN Screen Number
FORM bdc_screen USING p_prog
p_scrn.
clear itab_bdc_tab.
itab_bdc_tab-program = p_prog.
itab_bdc_tab-dynpro = p_scrn.
itab_bdc_tab-dynbegin = c_x.
append itab_bdc_tab.
ENDFORM. " bdc_screen
*& Form bdc_field
BDC Script for Screen fileds
-->P_NAM Field name
-->P_VAL Field value
FORM bdc_field USING p_nam
p_val.
clear itab_bdc_tab.
itab_bdc_tab-fnam = p_nam.
itab_bdc_tab-fval = p_val.
append itab_bdc_tab.
ENDFORM. " bdc_screen
*& Form bdc_submit_transaction
BDC_INSERT Function Module
FORM bdc_submit_transaction.
Load BDC script as a trqansction in BDC session
call function 'BDC_INSERT'
EXPORTING
tcode = c_tcode
TABLES
dynprotab = itab_bdc_tab
EXCEPTIONS
internal_error = 01
not_open = 02
queue_error = 03
tcode_invalid = 04.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
refresh itab_bdc_tab.
ENDFORM. " bdc_submit_transaction
*& Form bdc_session_close
text
FORM bdc_session_close.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3
skip 2.
if sy-subrc ne 0.
write: / 'Error Closing BDC Session ' , 'RETURN CODE: ', sy-subrc.
else.
write : / 'Session created:', v_ssnname,
50 '# of transactions:', v_trans_in_ssn.
endif.
ENDFORM. " bdc_session_close
Reward Points if it is helpful
Thanks
Seshu -
How to use API to trigger JAM group invitation in ABAP coding?
Hi,
We want to trigger a JAM group invitation URL to be sent out in ABAP coding to enable a auto. process at backend. Currently I only know the manual way: clicking invite button in jam group and input user name to find target user and then click send button to send out invitation email.
But question is how to do in ABAP coding to call any API to realize the same action?
Many thanks and Best regards,
LongAs an ABAP developer you can make use of the SAIL Library to integrate with SAP Jam. With SAIL integrating with SAP Jam is as easy as calling a ABAP OO method. SAIL takes care of the communication with SAP Jam and handles user authentication for you.
The lower part of http://scn.sap.com/docs/DOC-55050 contains information for ABAP developers like the SAIL developer guide and the SAIL config guide.
Maybe you are looking for
-
How do you create multiple execution windows for a custom opterator interface
I am starting to create a custom operator interface for TestStand 3.5 using Labview 8.0. This is my first exposure to custom operator interfaces (and ActiveX). The example operator interfaces have only one execution window that changes based on the
-
I can't find my serial number for ARA, here is my order info
can't find my serial number, is there someplace to go and get it back? INVOICE RECEIPT Dear Apple Customer, Thank you for shopping at the Apple Store! If you have already paid for your purchase, please retain th
-
I have tried to down load the upgrade but it come back saying I need maverick 10.9 and that is what I am trying to download.
-
How to diable file path prompt?
Everytime I hit the run button the file path prompt opens up, how can I disable it? I want to manual click the folder icon to open up browse window. Here is my code. Attachments: path.jpg 15 KB
-
HTC Android I have latest version