VBRK and KONA tables data (Agreements)
hi experts,
i have created view based on VBRK and KONA tables, but why some of the agreements are missing in VBRK??
i not able to find the solutions, as i am ABAP developer.
please tell me the reason why some of the agreements missed in VBRK?
regards
venuscm
Hi
Normally the rebate agreement is updated in KONA table. The rebate is created for a specific combination of customer and material or customer and rebate group etc. The rebate agreement appears in VBRK only if the combination in the invoice is same as that maintained in the rebate. This means that for the invoice the rebate is accrued or provision is kept aside if the conditions of the invoice are similar to that of the rebate. To describe it through an example. Lets say customer has a rebate agreement for material Cadbury Dairy Milk and the rebate agreement is based on that. So if customer buys Cadbury 5-star and the rebate is not on that the acrrual would not be possible and hence VBRK would have no entry as it did not satisfy the condition of the rebate. If VBRK had customer and the material as Cadbury Dairy milk.
Hope this explains.
Thanks
Indranil Ain
Similar Messages
-
How to update the VBFA table without entries in VBRK and VBRP tables
Hello,
I have a requirement , where the sales order , delivery happens in one SAP system say X system and billing document wil happens in other sap system say Y.
Now in this particular case , if the user want to know the billing document number in X system. what would be the solution.
Is there any possibility to update the VBFA table with invoice number of Y system (without updating the VBRK and VBRP tables).
User want to see the billing doc number from sales order in the form of document flow in X system
Thanks in advance
PradeepHii
Without updating VBRK/VBRP table and updating VBFA is not possible, So you have to play with work arround to create one Z TABLE, so whenever system Y will create billing document with the reference of System X data you have to update Ztable with Invoice number created in System Y, The primary key will be in Z TABLE is Delivery document number to track one to one with billing doc.
Thanks and Regards
Shambhu Sarkar -
Export and import table data with Java
I need a library for simple exporting and importing table data.
The data should be exported to a SQL file with insert statements.
I just want to tell the library the table name, the connection and where to store the file. The usage should be very simple.
Are there any small libraries for this? Finished calsses and methods which I can just call?I need a library for simple exporting and importing
table data.
The data should be exported to a SQL file with insert
statements.Every database has utilities to export/import data from tables. Take a look at your database manual. -
Cmd to export and inport table data of a paticular schema
hi,
can anyone tell me the cmd to export and inport table data of a paticular schemaExp userid=system/pass owner=SCOTT rows=Y triggers=Y
Imp userid=system/pass file=expdat.dmp fromuser=SCOTT touser=NEW commit=yes log=log.txt -
How can we delete SID table data and Text table data
Hi,
How can we delete SID table data and Text table data of any
InfoObject.Hi,
Go to transaction SE14, give the technical name if the table:
/BIC/T<InfoObject Name> for Text Table
/BIC/S<InfoObject Name> for SID Table
Select "Table" in the given 4 options below & hit Edit button.
in the next screen select "Direct"
& also select "detele data" radio button.
& hit "Activate & adjust database".
this will delete the complete data from the tables.
Note: before deleting the SID's make sure of the consequences & after effects.
Also the SID gets generated the next time you load master data/transaction data only for those records which were loaded..
Regards,
Iliyas -
Vbrk and Vbrp tables performance problem
Hi all,
The below query is taking lot of time in QAS i need to decrease the time without affecting the logic.....
SELECT vbrk~kunag
vbkd~bstkd
vbkd~bstdk
INTO TABLE c_tab_po FROM vbrp
INNER JOIN vbrk ON vbrkmandt = vbrpmandt AND vbrk~vbeln =
vbrp~vbeln
INNER JOIN vbkd ON vbkdmandt = vbrpmandt AND vbkd~vbeln =
vbrp~aubel
AND vbkd~posnr = con_zposnr
WHERE vbrp~vbeln EQ nast-objky.
DELETE ADJACENT DUPLICATES FROM c_tab_po COMPARING ALL FIELDS.
*Getting the other Invoices based on the customer PO number
IF c_tab_po[] IS NOT INITIAL.
SELECT
vbrk~kunag
vbkd~bstkd
vbkd~bstdk
vbkdposex_e vbrkvkorg
vbrpvbeln vbrpposnr vbrp~erdat
vbpakunnr vbrpaubel vbrpaupos vbakerdat
vbrpmatnr vbrkmwsbk vbrp~netwr
vbrkvaldt vbrkzterm vbrk~vbtyp
INTO TABLE g_tab_invoice FROM vbrp
INNER JOIN vbrk ON vbrkmandt = vbrpmandt AND vbrk~vbeln =
vbrp~vbeln
INNER JOIN vbkd ON vbkdmandt = vbrpmandt AND vbkd~vbeln =
vbrp~aubel
AND vbkd~posnr = con_zposnr
INNER JOIN vbpa ON vbpamandt = vbrpmandt AND vbpa~vbeln =
vbrp~aubel
AND vbpaposnr = con_zposnr AND vbpaparvw =
con_parvw
INNER JOIN vbak ON vbakmandt = vbakmandt AND vbak~vbeln =
vbrp~aubel
FOR ALL entries IN c_tab_po
WHERE vbrk~kunag EQ c_tab_po-kunag AND
vbkd~bstkd EQ c_tab_po-bstkd AND
vbkd~bstdk EQ c_tab_po-bstdk.
ENDIF.Hi Younus,
First join seems to be oku2026
But you are querying Db tables multiple times to avoid this.
Fetch the fields
vbkdposex_e vbrkvkorg
vbrpvbeln vbrpposnr vbrp~erdat
vbrpaubel vbrpaupos
vbrpmatnr vbrkmwsbk vbrp~netwr
vbrkvaldt vbrkzterm vbrk~vbtyp
in the first join itself.
SELECT vbrk~kunag
vbkd~bstkd
vbkd~bstdk
vbkd~posex_e vbrk~vkorg
vbrp~vbeln vbrp~posnr vbrp~erdat
vbrp~aubel vbrp~aupos
vbrp~matnr vbrk~mwsbk vbrp~netwr
vbrk~valdt vbrk~zterm vbrk~vbtyp
INTO TABLE c_tab_po FROM vbrp
INNER JOIN vbrk ON vbrk~mandt = vbrp~mandt AND vbrk~vbeln =
vbrp~vbeln
INNER JOIN vbkd ON vbkd~mandt = vbrp~mandt AND vbkd~vbeln =
vbrp~aubel
AND vbkd~posnr = con_zposnr
WHERE vbrp~vbeln EQ nast-objky.
then Just join VBPA & VBAK and get required data.
Thanks,
Sudha -
How to filter parent and child tables data in impdp?
Hi Friends,
i hope everyone doing good..
I have two tables in my schema like below.
STUDENT_DTLS:-
SID Sname CID
1 venkat 001
2 uppy 002
3 deepu 003
4 trinath 003
5 naveen 004
6 ramesh 005
COURSE_DTLS:-
CID CNAME Fee
001 Oracle 2000
002 java 6000
003 sieble 4000
004 informatica 3000
005 obiee 4000
if I load only few Student details say sid=1,2,3 into another environment using impdp,corresponding to those students course details from COURSE_DTLS table only need to be loaded.Not all course details.
Iam Expecting Result in new schema as below:-
SID Sname CID
1 venkat 001
2 uppy 002
3 deepu 003
CID CNAME Fee
001 Oracle 2000
002 java 6000
003 sieble 4000
But when i am using the below import scrit,The COURSE_DTLS is loading first and its query option(select cid from STUDENT_DTLS) is returning no rows.Because at that time no data is insertred into STUDENT_DTLS yet.
secondly it is importing data into STUDENT_DTLS with query option where sid=in (1,2,3) which is loaded propelry.
Thirdly it is trying to enable primary key and Foreign key constraints which is also failing because of no data in COURSE_DTLS table.
i have changed the order of tables in TABLES clause like tables=COURSE_DTLS ,STUDENT_DTLS.But still COURSE_DTLS table is loading first.
impdp pa_data_sub/******* NETWORK_LINK=qdssih30 tables=STUDENT_DTLS,COURSE_DTLS query='STUDENT_DTLS:"where SID IN(1,2,3)"','COURSE_DTLS:"where cid in(select cid from STUDENT_DTLS)"', CONTENT=all table_exists_action=replace directory=DATA_PUMP_DIR logfile=exp_join.log
output:
Total estimation using BLOCKS method: 128 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . imported "PA_DATA_SUB"."COURSE_DTLS" 0 rows
. . imported "PA_DATA_SUB"."STUDENT_DTLS" 3 rows
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
ORA-39083: Object type REF_CONSTRAINT failed to create with error:
ORA-02298: cannot validate (PA_DATA_SUB.SYS_C0040905) - parent keys not found
Failing sql is:
ALTER TABLE "PA_DATA_SUB"."STUDENT_DTLS" ADD FOREIGN KEY ("CID") REFERENCES "PA_DATA_SUB"."COURSE_DTLS" ("CID") ENABLE
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "PA_DATA_SUB"."SYS_IMPORT_TABLE_01" completed with 1 error(s) at 17:28:13
Please suggest me how to achieve this task in a single import command?
Is there any option in impdp to prioritize the table to be loaded first?
Thanks,
Venkat VadlamudiYou can't be guaranteed which order the data will be loaded in, so using a query that examines a table that is being imported is not going to always work the way you want it. The failing constraints makes sense because there is no data.
So, in your case, course_dtls gets imported first and the table student-dtls exists, but it not populated yet, so the select cid from student_dtls comes back with 0 rows. The second query works fine.
You might be able to change the query to be:
'COURSE_DTLS:"where cid in(select cid from STUDENT_DTLS@qdssih30 where SID IN(1,2,3)"'
This way, you query the source table pointed to by the network link and you use the same subquery from the first table.
This should work for you... I think anyway.
Dean -
Query Question: Sum of master and monthly table data
Hi All,
I have two tables that store financial data about programs. The PROGRAM table has the following columns (for purposes of this discussion):
ID, INITIAL_BUDGET, COST_CENTER
The PROGRAM_MONTHLY table has the following (abbreviated list of) columns:
ID, PROGRAM_ID (FK to PROGRAM.ID), CURRENT_FORECAST, RECORD_DATE
Every month, a copy of the program_monthly records for last month is made to new records in the PROGRAM_MONTHLY table and we use RECORD_DATE for our filters and comparisons. This way we have historical data, plus current month data that can be updated by our financial systems and program managers.
I am using Application Express and would like to create a dashboard chart that shows the summary of the INITIAL_BUDGET and the CURRENT_FORECAST for a selected month. Obviously, the INITAL_BUDGET doesn't change, but the CURRENT_FORECAST (and similar columns such as the amount committed to purchase orders, which were omitted to simplify the discussion) change monthly.
My goal is to create a chart that can display the initial budget, current forecast, amount committed on purchase orders, etc. for all cost centers, or just one at a time as the user requires, that is filtered by the month of the PROJECT_MONTHLY record. If I can come up with the statement for a view or query, then I can manage the rest.
The required syntax for the chart is "SELECT link, label, value FROM...", where "link" can be NULL, since is it an optional link to another URL. The "label" and "value" portion are the important parts.
For example, I have another chart that shows the project status (which is a Varchar 2 constrained to values such as, Active, On-Hold, Completed, etc.) with the status as the label and the count of the rows as the value. It starts:
select null link, pjm.PROJECT_STATUS label, COUNT(pjm.ID) value FROM ... However, I have been unable to come up with a query that generates the desired results for these PROGRAM and PROGRAM_MONTHLY tables. I have played with various types of joins and sub-queries, but my SQL just isn't up to the challenge yet. I realize that I might have to re-work the table structure to accomodate this requirement.
I would greatly appreciate any guidance in approaching this problem.
Many thanks for your time and help,
PetieCertainly, Warren, thanks so much for your willingness to look at my problem.
To keep things simple, I will put the fundamentals of the tables with sample data. Please let me know if you would like more and I would be happy to provide it.
Table: PROGRAM
ID PROGRAM_NUMBER INITIAL_BUDGET COST_CENTER
1 10001 100000 500-001
2 10002 125000 500-001
3 10003 150000 500-002
4 10004 175000 500-002
5 10005 10000 500-003
6 10006 200000 500-004Table: PROGRAM_MONTHLY
ID PROGRAM_ID CURRENT_FORECAST RECORD_DATE
1 1 95000 02-FEB-06
2 2 125000 02-FEB-06
3 3 145000 02-FEB-06
4 4 180000 02-FEB-06
5 5 9000 02-FEB-06
6 6 225000 02-FEB-06
7 1 97500 02-MAR-06
8 2 120000 02-MAR-06
9 3 145000 02-MAR-06
10 4 185000 02-MAR-06
11 5 10000 02-MAR-06
12 6 215000 02-MAR-06
Report Example 1
When a user would like to see the current summary data for all cost centers, they would see a chart with the following data:
INIT_BUDGET CURRENT_FORECAST
760000 772500
Report Example 2
When a user would like to see the summary data for all cost centers for last month, they would see a chart with the following data:
INIT_BUDGET CURRENT_FORECAST
760000 779000
Report Example 3
When a user would like to see the current summary data for cost center 500-001, they would see a chart with this following data:
INIT_BUDGET CURRENT_FORECAST
225000 220000I hope this better illustrates the solution I seek.
Thank you again for your time and assistance
Petie -
Master and Details Tables Data
Hi all
I have two tables one is Master table and other one is Details table.
How to write a query to get Master as well as Details table data.
Detail table contain more than one record for particular Master Record.
Pls Help me.My version is Oracle 9i
My Tables structures are :
SQL> desc TFMS_CONTRACT_PRICES
Name Null? Type
ITEMNUMBER NOT NULL VARCHAR2(30)
ITEMDESCR VARCHAR2(2000)
PRICE NOT NULL NUMBER
UOM VARCHAR2(30)
UNITSAWARDED NUMBER
DELIVERYPERIOD NUMBER
COMMENTSREASON VARCHAR2(15)
TOTALPOINTSSCORED NUMBER
FREEDELIVERY VARCHAR2(250)
YEAR VARCHAR2(15)
UPDATEDBY NOT NULL NUMBER
UPDATEDON NOT NULL TIMESTAMP(6)
BRANDID NOT NULL NUMBER
CONTRACTORID NOT NULL NUMBER
ISPRICEESCALATED NOT NULL CHAR(3)
SQL> desc TFMS_ACCESSORIES_MASTER
Name Null? Type
ACCESSORYID NOT NULL NUMBER
ACCESSORYNAME NOT NULL VARCHAR2(150)
DESCR VARCHAR2(250)
ISDELETED NOT NULL CHAR(1)
UPDATEDBY NOT NULL NUMBER
UPDATEDON TIMESTAMP(6)
CONTRACTORID NOT NULL NUMBER
Sample Out put:
ITEMNUMBER ACCESSORYNAME
RT57-01-13-01 Truck ToolBoxes,Riding Sun Glass
RT57-01-13-02 Door Guard,Maruthis
For one item number there may be one accessory name or more than one accessory name.i need to display accessory names with delimeter(,).
Pls help me.
Thanks in Advance. -
VBAK,VBRK AND KONA LINK????
HI EXPERTS,
How to create a report based on agreements from KONA and assigned to Sales documents from VBAK and billing documents from VBRK?
how to create link between these tables? is that based on KNUMA only or do we need to consider any other links to create the report, because one agreement can create to several sales documents or several billing documents.
plz suggest me the logic to create a report.
here is the example.
Agreement Sales Doc Net value Billing Doc Net Value Billing Date
1 10000 100 60000 100 10.12.2010
20000 150 70000 150 11.12.2010
2 30000 100 80000 100 12.12.2010
90000 150 13.12.2010
regards
venuscmHi Venugopal
You can try this logic.
The KONA-KNUMA rebate number can be passed through KONP-KNUMA_BO to fetch the Condition record number and the Condition type. The application is always V for rebates. So from KONP table you can fetch out Condition number (KONP-KNUMH) and the condition type (KONP-KSCHL). Once we have this the condition number is the link to fetch the invoice numbers. As in every invoice that references the rebate the condition number would be copied.
You can pass the condition number, condition type and application through KONV. That is KONP-KNUMH as KONV-KNUMH and some more parameters such as condition type and application to make the query faster. You can get KONV-KNUMV from here. Pass the KONV-KNUMV as the VBRK-KNUMV to get the VBRK-VBELN. Since you will get multiple entries for KONV-KNUMV (multiple invoices referenced by one single rebate) you will have to loop to find VBRK-VBELN multiple times.
Now passing VBRK-VBELN through VBFA-VBELN you can get VBFA-VBELV which will be the VBAK-VBELN.
I hope this helps.
Thanks
Indranil -
"How to sum FKIMG in VBRK and VBRP Table with sample output
Sir\Mam\Gurus ;
I hardly found it difficult in resolving my program in getting the sum of FKIMG inside the VBRP and VBRK tables
The scenario is that i have one Sales Order with multiple invoices . What i need to do is to sum up the fkimg or the quanitity of specific material regardless of how many invoices the material have in a particular SO
Example I have Sales Order number 35678952 with
3 invoices
Invoice # 123 with material number mat1=12, mat2=5 , mat3=7
345 with material number mat1=7, mat2=7
678 with material number mat1=5, mat3=10
Output shoud be
salesorder# 35678952
mat1 = 24
mat2 = 12
mat3 = 17
Below is my Sample Codes:
DATA : it_vbrp_details TYPE STANDARD TABLE OF wa_vbrp_details,
ls_vbrp_details TYPE wa_vbrp_details,
ls_vbrp_details1 TYPE wa_vbrp_details,
lsfinal_vbrp_details TYPE wa_vbrp_details,
it2_vbrp_details TYPE STANDARD TABLE OF wa2_vbrp_details,
ls2_vbrp_details TYPE wa2_vbrp_details,
it3_vbrp_details TYPE STANDARD TABLE OF wa_vbrp_details,
itfinal1_vbrp_details TYPE STANDARD TABLE OF wa_vbrp_details,
itfinal2_vbrp_details TYPE STANDARD TABLE OF wa_vbrp_details,
itfinal3_vbrp_details TYPE STANDARD TABLE OF wa_vbrp_details,
ls3_vbrp_details TYPE wa_vbrp_details,
rtime1 TYPE i,
rtime2 TYPE i,
rtime3 TYPE i,
s_erdate type d,
scr_erdat type d,
s_erdate = scr_erdat.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = 1 " Negative to subtract from old date, positive to add
olddate = s_erdate
IMPORTING
newdate = new_date.
""" This is another way manual adding by days
CALL FUNCTION 'CALCULATE_DATE'
EXPORTING
days = +30
start_date = s_erdate
IMPORTING
result_date = new_date.
result_date = ddate.
REFRESH: it_vbrp_details.
SELECT
vbrp~matnr
vbrp~aubel
vbrp~aupos
vbrp~vbeln
vbrp~kzwi1
vbrp~kzwi2
vbrp~kzwi3
vbrp~kzwi4
vbrp~kzwi5
vbrp~kzwi6
vbrp~mvgr1
vbrp~mvgr2
vbrp~mvgr3
vbrp~mvgr4
vbrp~mvgr5
vbrp~knuma_pi
vbrp~knuma_ag
vbrp~mwsbp
vbrp~vkaus
vbrp~fkimg
vbrk~vbeln
vbrk~fkart
vbrk~belnr
vbrk~xblnr
vbrk~vbtyp
vbrk~kunag
vbrk~fksto
vbap~posnr
INTO TABLE it_vbrp_details
FROM vbrp INNER JOIN vbrk ON vbrkvbeln EQ vbrpvbeln
where vbeln eq gt_data-vbeln
where vbrpaubel eq vbapvbeln
WHERE vbrp~posnr GE ''
AND vbrk~vbtyp EQ 'M'
AND vbrk~fksto NE 'X'
AND ( vbrperdat GE s_erdate OR vbrperdat LE new_date OR vbrp~erdat IN s_erdat ) " + JP 09 19 2011 Additional Optimization
ORDER BY aubel aupos .
ORDER BY aubel aupos matnr.
"""" This where i need your help Sir\Mam\Gurus
it3_vbrp_details = it_vbrp_details.
SORT it3_vbrp_details BY aubel matnr fkimg kzwi1 kzwi2 kzwi3 kzwi4 kzwi5 kzwi6 aupos vbeln
mvgr1 mvgr2 mvgr3 mvgr4 mvgr5 knuma_pi knuma_ag mwsbp vkaus fkart belnr vbtyp kunag fksto.
LOOP AT it3_vbrp_details INTO ls_vbrp_details.
COLLECT ls_vbrp_details INTO itfinal1_vbrp_details.
APPEND ls_vbrp_details TO it_vbrp_details.
ENDLOOP.
kzwi1,kzwi2,kzwi3 is also been sum up
Sir the output is something like this
Sales Ord# Material Qty KWIZ1 KWIZ2 KWIZ3 MGVR1 VBELN
1234 Mat1 24 23.2 22 12 LastInvoice#
1234 Mat2 12 20.0 21 15 LastInvoice#
1234 Mat3 37 22.0 22 16 LastInvoice#
5432 Mat1 30 25.0 23 15 LastInvoice#
5432 Mat2 24 22.0 24 23 LastInvoice#
5432 Mat3 20 18.0 20 12 LastInvoice#
Hope you can help me as i cant hardy sleep thinking of this ...
I will really appreciate your great help..
Thanks !
I will really appreciate your great help..
Thanks !
Moderator message: duplicate post locked.
Edited by: Thomas Zloch on Sep 20, 2011 3:05 PMHi,
How you want to display the output?..
If you want to display the output as mentioned below, then you have to use nested loop & dynamic field assignments to get result.
Output column
sales order Mat1 Mat2 Mat3 ......
1234 24 12 37
Kindly let me know, if you have any questions
Regards,
S.Senthilkumar -
Download the KTOPL field data and GLT0 table data into one Internal table
Hi,
I have downloaded GLT0 table fields data to PC file . But i need to download KTOPL(Chart Of Accounts) data also. in GLT0 table there is no KTOPL field.
But in SKA1 table have KTOPL field. Then what is the issue is GLT0 data & KTOPL field data needs to download into one Internal Table.
anybody could you please solve this problem. immediately need to solve this.
Below is the code.
REPORT ZFXXEABL_1 NO STANDARD PAGE HEADING
LINE-SIZE 200.
Tables Declaration
TABLES : GLT0.
Data Declaration
DATA : FP(8) TYPE C,
YEAR LIKE GLT0-RYEAR,
PERIOD(3) TYPE C,
DBALANCE LIKE VBAP-NETWR VALUE 0 ,
CBALANCE LIKE VBAP-NETWR VALUE 0.
*Internal table for for final data..
DATA : BEGIN OF REC1 OCCURS 0,
BAL LIKE GLT0-TSLVT value 0,
COAREA LIKE GLT0-RBUSA,
CA(4) TYPE C,
KTOPL LIKE ska1-ktopl,
CCODE LIKE GLT0-BUKRS,
CREDIT LIKE VBAP-NETWR,
CURRENCY LIKE GLT0-RTCUR,
CURTYPE(2) TYPE N,
DEBIT LIKE VBAP-NETWR,
YEAR(8) TYPE C,
FY(2) TYPE C,
ACCOUNT LIKE GLT0-RACCT,
VER LIKE GLT0-RVERS,
VTYPE(2) TYPE N,
CLNT LIKE SY-MANDT,
S_SYS(3) TYPE C,
INDICATOR LIKE GLT0-DRCRK,
END OF REC1.
DATA : C(2) TYPE N,
D(2) TYPE N.
DATA REC1_H LIKE REC1.
Variable declarations
DATA :
W_FILES(4) TYPE N,
W_DEBIT LIKE GLT0-TSLVT,
W_CREDIT LIKE GLT0-TSLVT,
W_PCFILE LIKE RLGRAP-FILENAME ,
W_UNIXFILE LIKE RLGRAP-FILENAME,
W_PCFILE1 LIKE RLGRAP-FILENAME,
W_UNIXFIL1 LIKE RLGRAP-FILENAME,
W_EXT(3) TYPE C,
W_UEXT(3) TYPE C,
W_PATH LIKE RLGRAP-FILENAME,
W_UPATH LIKE RLGRAP-FILENAME,
W_FIRST(1) TYPE C VALUE 'Y',
W_CFIRST(1) TYPE C VALUE 'Y',
W_PCFIL LIKE RLGRAP-FILENAME.
DATA: "REC LIKE GLT0 OCCURS 0 WITH HEADER LINE,
T_TEMP LIKE GLT0 OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF REC3 OCCURS 0.
INCLUDE STRUCTURE GLT0.
DATA: KTOPL LIKE SKA1-KTOPL,
END OF REC3.
DATA: BEGIN OF T_KTOPL OCCURS 0,
KTOPL LIKE SKA1-KTOPL,
SAKNR LIKE SKA1-SAKNR,
END OF T_KTOPL.
Download data.
DATA: BEGIN OF I_REC2 OCCURS 0,
BAL(17), " like GLT0-TSLVT value 0,
COAREA(4), " like glt0-rbusa,
CA(4), " chart of accounts
CCODE(4), " like glt0-bukrs,
CREDIT(17), " like vbap-netwr,
CURRENCY(5), " like glt0-rtcur,
CURTYPE(2), " type n,
DEBIT(17), " like vbap-netwr,
YEAR(8), " type c,
FY(2), " type c, fiscal yr variant
ACCOUNT(10), " like glt0-racct,
VER(3), " like glt0-rvers,
VTYPE(3), " type n,
CLNT(3), "like sy-mandt,
S_SYS(3), "like sy-sysid,
INDICATOR(1), " like glt0-drcrk,
END OF I_REC2.
Selection screen. *
SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1.
SELECT-OPTIONS : COMPCODE FOR GLT0-BUKRS,
GLACC FOR GLT0-RACCT,
FISYEAR FOR GLT0-RYEAR,
no intervals no-extension, "- BG6661-070212
FISCPER FOR GLT0-RPMAX,
busarea for glt0-rbusa,
CURRENCY FOR GLT0-RTCUR.
SELECTION-SCREEN END OF BLOCK BL1.
SELECTION-SCREEN BEGIN OF BLOCK BL2 WITH FRAME TITLE TEXT-BL2.
PARAMETERS:
P_UNIX AS CHECKBOX, "Check box for Unix Option
P_UNFIL LIKE RLGRAP-FILENAME, " Unix file Dnload file name
default '/var/opt/arch/extract/GLT0.ASC', "- BG6661-070212
P_PCFILE AS CHECKBOX, "Check box for Local PC download.
P_PCFIL LIKE RLGRAP-FILENAME " PC file Dnload file name
default 'C:\GLT0.ASC'. "- BG6661-070212
DEFAULT 'C:\glt0_gl_balance_all.asc'. "+ BG6661-070212
SELECTION-SCREEN END OF BLOCK BL2.
*eject
Initialization. *
INITIALIZATION.
Try to default download filename
p_pcfil = c_pcfile.
p_unfil = c_unixfile.
if sy-sysid eq c_n01.
p_unfil = c_unixfile.
endif.
if sy-sysid eq c_g21.
p_unfil = c_g21_unixfile.
endif.
if sy-sysid eq c_g9d.
p_unfil = c_g9d_unixfile.
endif.
Default for download filename
*{ Begin of BG6661-070212
CONCATENATE C_UNIXFILE
SY-SYSID C_FSLASH C_CHRON C_FILENAME INTO P_UNFIL.
*} End of BG6661-070212
AT SELECTION-SCREEN OUTPUT.
loop at screen.
if screen-name = 'P_PCFIL'. "PC FILE
screen-input = '0'.
modify screen.
endif.
if screen-name = 'P_UNFIL'. "UN FILE
screen-input = '0'.
modify screen.
endif.
endloop.
if w_first = 'Y'.
perform path_file.
w_first = 'N'.
endif.
if w_cfirst = 'Y'.
perform cpath_file.
w_cfirst = 'N'.
endif.
Start-of-Selection. *
START-OF-SELECTION.
*COLLECT DATA
PERFORM COLLECT_DATA.
*BUILD FILENAMES
PERFORM BUILD_FILES.
*LOCAL
IF P_PCFILE = C_YES.
PERFORM LOCAL_DOWNLOAD.
ENDIF.
*UNIX
IF P_UNIX = C_YES.
PERFORM UNIX_DOWNLOAD.
ENDIF.
IF P_PCFILE IS INITIAL AND P_UNIX IS INITIAL.
MESSAGE I000(ZL) WITH 'Down load flags both are unchecked'.
ENDIF.
END-OF-SELECTION.
IF P_PCFILE = C_YES.
WRITE :/ 'PC File' , C_UNDER, P_PCFIL.
ENDIF.
*& Form DOWNLOAD
Download *
FORM DOWNLOAD.
P_PCFIL = W_PATH.
DATA LIN TYPE I.
DESCRIBE TABLE I_REC2 LINES LIN.
WRITE:/ 'No of Records downloaded = ',LIN.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = P_PCFIL
FILETYPE = C_ASC "c_dat "dat
TABLES
DATA_TAB = I_REC2 " t_str
fieldnames = t_strhd
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
IF SY-SUBRC EQ 0.
ENDIF.
ENDFORM.
*& Form WRITE_TO_SERVER
text *
--> p1 text
<-- p2 text
FORM WRITE_TO_SERVER.
DATA : L_MSG(100) TYPE C,
L_LINE(5000) TYPE C.
P_UNFIL = W_UPATH.
DATA LIN TYPE I.
DESCRIBE TABLE I_REC2 LINES LIN.
WRITE:/ 'No of Records downloaded = ',LIN.
OPEN DATASET P_UNFIL FOR OUTPUT IN TEXT MODE. " message l_msg.
IF SY-SUBRC <> 0.
WRITE: / L_MSG.
ENDIF.
perform header_text1.
LOOP AT I_REC2.
TRANSFER I_REC2 TO P_UNFIL.
ENDLOOP.
CLOSE DATASET P_UNFIL.
WRITE : / C_TEXT , W_UPATH.
SPLIT W_UNIXFILE AT C_DOT INTO W_UNIXFIL1 W_UEXT.
CLEAR W_UPATH.
IF NOT W_UEXT IS INITIAL.
CONCATENATE W_UNIXFIL1 C_DOT W_UEXT INTO W_UPATH.
ELSE.
W_UEXT = C_ASC. " c_csv.
CONCATENATE W_UNIXFIL1 C_DOT W_UEXT INTO W_UPATH.
ENDIF.
ENDFORM. " WRITE_TO_SERVER
*& Form BUILD_FILES
FORM BUILD_FILES.
IF P_PCFILE = C_YES.
W_PCFILE = P_PCFIL.
***Split path at dot**
SPLIT W_PCFILE AT C_DOT INTO W_PCFILE1 W_EXT.
IF NOT W_EXT IS INITIAL.
CONCATENATE W_PCFILE1 C_DOT W_EXT INTO W_PATH.
ELSE.
W_PATH = W_PCFILE1.
ENDIF.
ENDIF.
IF P_UNIX = C_YES.
W_UNIXFILE = P_UNFIL.
SPLIT W_UNIXFILE AT C_DOT INTO W_UNIXFIL1 W_UEXT.
IF NOT W_UEXT IS INITIAL.
CONCATENATE W_UNIXFIL1 C_DOT W_UEXT INTO W_UPATH.
ELSE.
W_UPATH = W_UNIXFIL1.
ENDIF.
ENDIF.
ENDFORM.
FORM CPATH_FILE.
CLEAR P_PCFIL.
CONCATENATE C_PCFILE
C_COMFILE SY-SYSID C_UNDER SY-DATUM SY-UZEIT
C_DOT C_ASC INTO P_PCFIL.
ENDFORM. " CPATH_FILE
FORM PATH_FILE.
CLEAR P_UNFIL.
if sy-sysid eq c_n01.
CONCATENATE C_UNIXFILE
C_COMFILE SY-SYSID C_UNDER SY-DATUM SY-UZEIT
C_DOT C_ASC INTO P_UNFIL.
endif.
if sy-sysid eq c_g21.
concatenate c_g21_unixfile
c_comfile sy-sysid c_under sy-datum sy-uzeit
c_dot c_asc into p_unfil.
endif.
if sy-sysid eq c_g9d.
concatenate c_g9d_unixfile
c_comfile sy-sysid c_under sy-datum sy-uzeit
c_dot c_asc into p_unfil.
endif.
ENDFORM. " PATH_FILE
Local_Download *
Local *
FORM LOCAL_DOWNLOAD.
perform header_text.
LOOP AT REC1.
REC1-CLNT = SY-MANDT.
REC1-S_SYS = SY-SYSID.
MOVE: REC1-BAL TO I_REC2-BAL,
REC1-COAREA TO I_REC2-COAREA,
REC1-CA TO I_REC2-CA,
REC1-KTOPL TO I_REC2-CA,
REC1-CCODE TO I_REC2-CCODE,
REC1-CREDIT TO I_REC2-CREDIT,
REC1-CURRENCY TO I_REC2-CURRENCY,
REC1-CURTYPE TO I_REC2-CURTYPE,
REC1-DEBIT TO I_REC2-DEBIT,
REC1-YEAR TO I_REC2-YEAR,
REC1-FY TO I_REC2-FY,
REC1-ACCOUNT TO I_REC2-ACCOUNT,
REC1-VER TO I_REC2-VER,
REC1-VTYPE TO I_REC2-VTYPE,
REC1-CLNT TO I_REC2-CLNT,
REC1-S_SYS TO I_REC2-S_SYS,
REC1-INDICATOR TO I_REC2-INDICATOR.
APPEND I_REC2.
CLEAR I_REC2.
ENDLOOP.
IF NOT I_REC2[] IS INITIAL.
PERFORM DOWNLOAD .
CLEAR I_REC2.
REFRESH I_REC2.
ELSE.
WRITE : / ' no record exist due to unavailability of data'.
ENDIF.
ENDFORM. " LOCAL_DOWNLOAD
*& Form UNIX_DOWNLOAD
FORM UNIX_DOWNLOAD.
LOOP AT REC1.
REC1-CLNT = SY-MANDT.
REC1-S_SYS = SY-SYSID.
MOVE: REC1-BAL TO I_REC2-BAL,
REC1-COAREA TO I_REC2-COAREA,
REC1-CA TO I_REC2-CA,
REC1-KTOPL TO I_REC2-CA,
REC1-CCODE TO I_REC2-CCODE,
REC1-CREDIT TO I_REC2-CREDIT,
REC1-CURRENCY TO I_REC2-CURRENCY,
REC1-CURTYPE TO I_REC2-CURTYPE,
REC1-DEBIT TO I_REC2-DEBIT,
REC1-YEAR TO I_REC2-YEAR,
REC1-FY TO I_REC2-FY,
REC1-ACCOUNT TO I_REC2-ACCOUNT,
REC1-VER TO I_REC2-VER,
REC1-VTYPE TO I_REC2-VTYPE,
SY-MANDT TO I_REC2-CLNT,
SY-SYSID TO I_REC2-S_SYS,
REC1-INDICATOR TO I_REC2-INDICATOR.
APPEND I_REC2.
CLEAR I_REC2.
ENDLOOP.
IF NOT I_REC2[] IS INITIAL.
PERFORM WRITE_TO_SERVER.
CLEAR I_REC2.
REFRESH I_REC2.
ELSE.
WRITE : / ' no record exist due to unavailability of data'.
ENDIF.
ENDFORM. " UNIX_DOWNLOAD
*& Form HEADER_TEXT
text *
--> p1 text
<-- p2 text
*form header_text.
concatenate c_bal c_ba c_ca c_cc c_credit c_currency c_curtype
c_debit c_fisyear c_fisvar c_acct c_ver c_vtype c_indicator
into t_strhd
separated by c_comma.
append t_strhd.
*endform. " HEADER_TEXT
*& Form HEADER_TEXT1
text *
*form header_text1.
concatenate c_bal c_ba c_ca c_cc c_credit c_currency c_curtype
c_debit c_fisyear c_fisvar c_acct c_ver c_vtype c_indicator
into t_strhd1
separated by c_comma.
append t_strhd1.
transfer t_strhd1 to p_unfil.
*endform. " HEADER_TEXT1
*& Form COLLECT_DATA
Collect Data *
FORM COLLECT_DATA.
SELECT * FROM GLT0 INTO TABLE REC3
WHERE BUKRS IN COMPCODE
AND RYEAR IN FISYEAR
AND RPMAX IN FISCPER
AND RACCT IN GLACC
AND RTCUR IN CURRENCY.
SELECT KTOPL FROM SKA1
INTO TABLE T_KTOPL
FOR ALL ENTRIES IN REC3
WHERE SAKNR = REC3-RACCT.
LOOP AT REC3 .
select *
from glt0
into table t_temp
where rldnr = rec-rldnr
and rrcty = rec-rrcty
and rvers = rec-rvers
and bukrs = rec-bukrs
and ryear = rec-ryear
and racct = rec-racct
and rbusa = rec-rbusa
and rtcur <> 'ZAR'
and rpmax = rec-rpmax.
if sy-subrc = 0.
rec1-bal = '0.00'.
else.
rec1-bal = rec-hslvt.
endif.
*READ TABLE T_KTOPL WITH KEY SAKNR = REC-RACCT BINARY SEARCH.
MOVE T_KTOPL-KTOPL TO REC3-KTOPL.
CLEAR: CBALANCE, DBALANCE.
REC1-BAL = REC3-HSLVT.
IF REC3-DRCRK = 'S'.
IF REC3-HSLVT NE C_ZERO.
YEAR = REC-RYEAR.
PERIOD = '000'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC-DRCRK.
REC1-DEBIT = C_ZERO.
REC1-CREDIT = C_ZERO.
REC1-CCODE = REC-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC-RTCUR.
REC1-ACCOUNT = REC-RACCT.
rec1-bal = rec-hslvt.
dbalance = rec1-bal.
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC-RBUSA.
REC1-VER = REC-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART.
APPEND REC1.
C = 0.
PERFORM D.
ENDIF.
IF REC3-HSL01 NE C_ZERO.
YEAR = REC3-RYEAR.
PERIOD = '001'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC3-DRCRK.
REC1-DEBIT = REC3-HSL01 .
REC1-CCODE = REC3-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC3-RTCUR.
REC1-ACCOUNT = REC3-RACCT.
rec1-bal = REC3-hsl01 + dbalance.
dbalance = rec1-bal.
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC3-RBUSA.
REC1-VER = REC3-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART.
REC1-KTOPL = REC3-KTOPL.
APPEND REC1.
C = 1.
PERFORM D.
ENDIF.
IF REC3-HSL02 NE C_ZERO.
REC1-DEBIT = REC3-HSL02.
YEAR = REC3-RYEAR.
PERIOD = '002'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC3-DRCRK.
REC1-DEBIT = REC3-HSL02.
REC1-CCODE = REC3-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC3-RTCUR.
REC1-ACCOUNT = REC3-RACCT.
rec1-bal = REC3-hsl02 + dbalance.
dbalance = rec1-bal.
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC3-RBUSA.
REC1-VER = REC3-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART. "-BF7957-070503
REC1-KTOPL = REC3-KTOPL. "+BF7957-070503
APPEND REC1.
C = 2.
PERFORM D.
ENDIF.
IF REC3-HSL03 NE C_ZERO.
YEAR = REC3-RYEAR.
PERIOD = '003'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC3-DRCRK.
REC1-DEBIT = REC3-HSL03.
REC1-CCODE = REC3-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC3-RTCUR.
REC1-ACCOUNT = REC3-RACCT.
rec1-bal = REC3-hsl03 + dbalance .
dbalance = rec1-bal.
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC3-RBUSA.
REC1-VER = REC3-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART. "-BF7957-070503
REC1-KTOPL = REC3-KTOPL. "+BF7957-070503
APPEND REC1.
C = 3.
PERFORM D.
ENDIF.
IF REC3-HSL04 NE C_ZERO.
REC1-DEBIT = REC3-HSL04.
YEAR = REC3-RYEAR.
PERIOD = '004'.
CONCATENATE PERIOD C_DOT YEAR INTO FP.
REC1-INDICATOR = REC3-DRCRK.
REC1-DEBIT = REC3-HSL04.
REC1-CCODE = REC3-BUKRS.
REC1-YEAR = FP.
REC1-CURRENCY = REC3-RTCUR.
REC1-ACCOUNT = REC3-RACCT.
rec1-bal = REC3-hsl04 + dbalance .
REC1-CURTYPE = C_CTYPE.
REC1-FY = C_FY.
REC1-COAREA = REC3-RBUSA.
REC1-VER = REC3-RVERS.
REC1-VTYPE = C_CTYPE.
REC1-CA = C_CHART. "-BF7957-070503
REC1-KTOPL = REC3-KTOPL. "+BF7957-070503
APPEND REC1.
dbalance = rec1-bal.
C = 4.
PERFORM D.
ENDIF.
Thanks and Regards,
Ramuse logical database SDF, nodes ska1 and skc1c
A. -
Download and Upload Table Data
Hello,
I would like to download the content of ma specific table and to upload it to the same table in another R/3 system. How can i do this?
Thanks!Hi
No!
The easier solution is create a request with the data of that table:
- Create an empty request by SE09;
- Insert the hit R3TR/TABU/<TABLE NAME> as object of the request
- Release the request
- Copy the file (datafile and cofile) generated after releasing the request
- Past that file in the new system
- Import the request in DEV queque
Max -
Business Partner Datasources and ARFCSSTATE table data increase
Hi Experts,
I´ve been facing a performance decrease in SAP ECC data loading throughout the days, since we´ve started productive system (about 10 days).
During data loading, we have noticed an considerable amount of time spent by WP on reading table ARFCSSTATE. We checked note 375566, but there´s nothing that could be done to revert the situation.
Our ARFCSSTATE table has now 3.5M records, whereas our Business Partner master data datasources represent 99% of this data volume as can be checked in transaction SMQS (qRFC).
We also have noticed that 2.8M records of this table has status = "RECORDED", but I don´t if this data should remain in this table (ARFCSSTATE).
Anyway, as we are not advised to delete all these records manually, I´m wandering what we could do to prevent this table to increase considerably.
Any help will be appreciated.
Thanks in advance.
FábioHi,
If delta loads go through fine, the records should get deleted from the table you mentioned.
Please check the following notes:
516251 - Support guide: Problems with ARFCSTATE = RECORDED
500316 - Delta request: Deletion from delta queue no longer executed
380078 - FAQ: BW delta queue (RSA7): Questions and answers
Also it would be good to check if any of your logistics extractors are using the 'direct delta' method. this also considerably affects the load performance when there are more number of delta records. There would be many LUWs getting written to delta queue this way.
Edited by: Murali Krishna K on Jan 15, 2011 1:26 AM -
How to read and display table data entries from ERP in CRM
Hello experts,
I am new to CRM. I need to read data base entries from ERP in CRM system. What would be the best way to do . The table is a standard SAP table with a custom include (several customer fields). Calling a web service would be the best way..? or is there any other way that I can do it too.
Also, to display these entries what would be the best tool? Should I built my own transaction/report to do it?
Any advise or guidance would be a great kick start to learn the CRM development environment.
Regards,
jafferyHi,
Check the below wiki link if it helps.
http://wiki.sdn.sap.com/wiki/display/CRM/Howtodisplayaz-tableinanassignmentblock
Also, you can try an option of transaction launcher.
Hope this helps.
Regards,
Chandrakant
Maybe you are looking for
-
Pls could someone help me configure my AEBS to connect to the router via ethernet as I'm getting poor performance using wifi and would like to try something different. Thanks v much in advance! Matt : )
-
How to Export Snapshots and Materlized View in Oracle 9i
Hi, How to Export Snapshots and Materlized View in Oracle 9i . I require to Migrate from 9i to 10g with either Export or Script. Please help
-
Error on installation: printer keeps searching for updates.
I get an error on installation: printer keeps "searching for updates" Installation is OK, printer works, but because of the continued messaging on the printer, the screen on printer is unusable. Any ideas?
-
Sun FastEthernet PCI with MII and x86 Hardware
Hello I have two Sun FastEthernet PCI cards, each with one RJ45 port and a port labeled "MII". Would I be able to use these cards in a PC (Dell Precision 7xx) or x86 hardware in general? Thanks Matt
-
How do I get in touch with a live person?
How do I get in touch with a live person?