VBAK and VBAP
When a sales order is created the entered data is mainly stored in VBAP and VBAK. Is it true?
Hi,
What you have said is correct. Also, for you to understand the tables which are used in SD, you can download the list of SD tables in the following path.
http://www.erpgenie.com/abap/tables_sd.htm
Hope this helps.
Reward if thsi helsp.
Similar Messages
-
Performance problems selecting form vbak and vbap
Hello,
I am try to select data from the vbak and vbap databasetables. The tables have more than a million of entries. I tried my best with two related selectstatements and the 'FOR All ENTRIES' syntax. The query takes more than 30 minutes. Is there a more efficient way than the following query, for example an inner join?. Tanks.
Regards, Lars.
FORM firstselect.
SELECT kvkorg kvtweg kspart kauart k~kunnr
kvsbed kaugru kvbeln kmandt
FROM VBAK AS k
INTO CORRESPONDING FIELDS OF TABLE t_outtab1
WHERE k~vkorg IN s_vkorg AND
k~vtweg IN s_vtweg AND
k~spart IN s_spart AND
k~auart IN s_auart AND
k~kunnr IN s_kunnr AND
k~vsbed IN s_vsbed AND
k~augru IN s_augru AND
k~vbeln IN s_vbeln.
ENDFORM.
FORM secondselect.
SELECT pposnr pvstel p~werks
pabgru pmatnr p~kwmeng
pzzurmeng pvrkme pmandt pvbeln
FROM VBAP AS p
INTO CORRESPONDING FIELDS OF TABLE t_outtab2
FOR ALL ENTRIES IN t_outtab1
WHERE
p~vstel IN s_vstel AND
p~werks IN s_werks AND
p~matnr IN s_matnr AND
p~abgru IN s_abgru AND
t_outtab1-mandt = p~mandt AND
p~vbeln = t_outtab1-vbeln.
ENDFORM.FORM firstselect.
SELECT vkorg
vtweg
spart
auart
kunnr
vsbed
augru
vbeln
mandt
FROM VBAK
INTO TABLE t_outtab1
WHERE vkorg IN s_vkorg AND
vtweg IN s_vtweg AND
spart IN s_spart AND
auart IN s_auart AND
kunnr IN s_kunnr AND
vsbed IN s_vsbed AND
augru IN s_augru AND
vbeln IN s_vbeln.
ENDFORM.
FORM secondselect.
SELECT posnr
vstel
werks
abgru
matnr
kwmeng
zzurmeng
vrkme
mandt
vbeln
FROM VBAP TABLE t_outtab2
FOR ALL ENTRIES IN t_outtab1
WHERE vbeln = t_outtab1-vbeln
AND vstel IN s_vstel AND
werks IN s_werks AND
matnr IN s_matnr AND
abgru IN s_abgru .
ENDFORM.
Hope this helps u.
I will get u back with more answers.
One more important thing see that the order which u r using in the select query is the same as that in the table this will affect the performs a lot.
<i><b>The first field should be the vbeln and then see the order and change that first and the same order should be in the internal table taht u r defining also.
If u do these things surely u can improve performance.</b></i>
Message was edited by: Judith Jessie Selvi -
Contract Sign Date from VBAK and VBAP and VEDA.
Hi ,
I need to fetch the Sales Document from VBAK and VBAP and VEDA with the contract sign date for sales document line item .
Contract sign date is in selection screen as select options.
Please let me know how to fetch the sales Document per line item from these 3 tables considering that A sales document could have many line items and each can have a different sign date.
Thanks
SachinHi,
The link between all the tables VBAK, VBAP and VEDA is VBELN i.e sales document number.
However, while fetching from VBAP and VEDA you would need to consider POSNR as well.
As your ABAPer to code the logic using 'for all entries' method.
Regards,
Amit
Edited by: Amit Iyer on Jun 23, 2011 12:28 PM -
OBJNR is blank at VBAK and VBAP tables
Dear collegues,
There´s a strange situation on customer´s system. When end-user create a new quotation, the OBJNR field at VBAK and VBAP tables doesn´t fill itself, it remains blank. I believed that the field was filled when the document was saved. What´s wrong?
Regards, Otávio.Hi,
This might be due to many reasons.Please check if there any dumps related to it in ST22/SM21.
Also check if there any enough dialog/bckg work process to process the job.
filling up takes more time depending on the no of records in the application tables.
regards
Nagaraju -
Hi there!
When i want to extract data ,partly related to header and partly related to item , what i do is, i give the conditions(header conditions like sales org.) for which i need data in VBAK and when i get the sales order numbers i exceute VBAP for these sales order to get item data....is this the correct way or is there a way to get the header as well as item data from the same table....Please suggest....Dear Swetha,
If you want to pull data from a single table use T-code: SE16N.
If you want to join multiple Tables then create a Query thrrough SQ00. You can select the required feild in this Query & generate a report based on required selection criteria..
Hope this Helps..
Thanks,
Jignesh Mehta -
Hi Guys,
Can you pls check the query and suggest best approch to improve the performance as its going for dump.
VBAP as 2,22,34,404
VBAK as 25,54,345
and
r_matnr as 96,000 records.
SELECT vbapmatnr SUM( vbapkwmeng )
FROM vbak INNER JOIN vbap ON vbakvbeln = vbapvbeln
INTO TABLE t_xx
WHERE audat BETWEEN w_pstdat AND w_inidat
AND vkorg IN r_vkorg
AND auart IN r_auart
AND vbap~matnr IN r_matnr
AND vbap~werks EQ p_werks
AND vbap~pstyv IN s_pstyv
GROUP BY vbap~matnr.
Regards,
Srinivas M> Check for the View on VBAP AND VBAK that will help to increase the preformence
> instead of inner join
oh, a new option is recommended frequently in recent positing, after FAE is supported so much anymore.
BUT the View is only a dictionary defintion of a join, they are 100% identical on the database
There is not clear limit for the size of the ranges, usually in the order of 1000 or 2000. It will dump when whole resultings statement is above a limit, which is hard tto specify.
WHERE audat BETWEEN w_pstdat AND w_inidat
AND vkorg IN r_vkorg
AND auart IN r_auart
AND vbap~matnr IN r_matnr
AND vbap~werks EQ p_werks
AND vbap~pstyv IN s_pstyv
GROUP BY vbap~matnr.
This are actually several statements, which can be completely different. It depends which IN-Lists/Ranges are filled.
The join can react on that, it uses different accesses, if there are more conditions on vbak or
more vbap.
For the FAE you must programm two versions, one startung with vbak and one with vbak. And
you must determine which one will use. I doubt that you will better than the optimzer in the database.
Siegfried -
Help needed for report on tables vbak and vbap
Hello,
I needed help in one of my work issues, this is my first project and Iam still learning. kindly help.
I was asked to take erdat,vbeln,posnr from selection screen and compare it with the data already in tables vbap,vbak. If the data
already exists and exception needs to be raised saying that the 'data exists',but if the data is not present in the tables the
tables have to be updated. This has to be done using function module only.
Then I have to write a REPORT calling the above function module and finally displaying the number of records updated and the
list of them.
I have started writing a function module:
FUNCTION z_tableupdate.
""Local Interface:
*" IMPORTING
*" VALUE(DATE) LIKE VBAK-ERDAT DEFAULT SY-DATUM
*" VALUE(SALESORDERNO) LIKE VBAK-VBELN
*" VALUE(ITEMNO) LIKE VBAP-POSNR
*" EXPORTING
*" VALUE(EX_VBAP) LIKE VBAP STRUCTURE VBAP
*" VALUE(SYS) LIKE SY-SYSID
*" VALUE(EX_VBAK) LIKE VBAK STRUCTURE VBAK
*" EXCEPTIONS
*" DATA_UPDATED
*" DATA_EXISTS
SELECT * FROM vbak INTO vbak_wa WHERE erdat = date
AND vbeln = salesorderno.
ENDSELECT.
SELECT * FROM vbap INTO vbap_wa WHERE posnr = itemno.
ENDSELECT.
IF sy-subrc EQ 0.
ex_vbap = vbap_wa.
ex_vbak = vbak_wa.
ELSE.
RAISE data_exists.
ENDIF.
sys = sy-sysid.
ENDFUNCTION.
How is the above code for function module, will this work??
Now can I write a report to call the above function module and update the record?? if so, how to update ??? please help...Lots of thanks in advance.Hi
Welcome to SDN forum
Whay can't you write a simple report in SE38.
why you are using Fun module
Nothing wrong in it.
But first become perfetc in reports in SE38 and then do using the fun modules
write a simple select statement like
SELECT AVBELN AERDAT BPOSNR BMATNR
INTO TABLE ITAB
FROM VBAK AS A JOIN VBAP ON
AVBELN = BVBELN
WHERE A~VBELN IN S_VBELN AND
A~ERDAT IN S_ERDAT AND
B~POSNR IN S_POSNR.
IF SY-SUBRC <> O.
WRITE: / 'No data found'.
ENDIF.
First write this in SE38 by defining a proper selection screen and internal tables
then do as fun module
see the doc for fun module
Function Modules;
Check this matter.
Function Modules are Global ABAP programs created by SAP for reusable purpose.they have IMPORT,EXPORT and TABLE parameters, and EXCEPTIONS to through when error occurs.
You can create them from TCode SE37.
Go through the following doc:
Function modules are cross-program, reusable procedures that are organized into function groups, and whose functions are implemented between the statements FUNCTION and ENDFUNCTION. Function modules and their interfaces are created in the Function Builder.
Function Module Interfaces
The parameter interface of a function module is defined in the Function Builder. It includes the definition of interface parameters and the specification of exceptions that can be triggered by a function module. The Function Builder automatically generates comment lines below the FUNCTION statement in the source code of the function module, which represent the interface of the function module with the following syntax:
Syntax
... [IMPORTING parameters]
[EXPORTING parameters]
[CHANGING parameters]
[TABLES table_parameters]
[{RAISING|EXCEPTIONS} exc1 exc2 ...]
The syntax and semantics of IMPORTING, EXPORTING, CHANGING, RAISING, and EXCEPTIONS mainly correspond to the definition of method interfaces with [CLASS-]METHODS. The additional option of defining table parameters using TABLES is obsolete.
Interface parameters
The interface parameters are defined on the relevant tab pages in the Function Builder.
IMPORTING parameters are input parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input parameter. The content of the actual parameter is passed to the input parameter when the call is made. The content of an input parameter for which 'pass by reference' is defined cannot be changed in the function module.
EXPORTING parameters are output parameters. When the function module is called, a suitable actual parameter can be specified for every output parameter. The content of an output parameter that is defined for 'pass by value' is transferred to the actual parameter if the function module is completed without errors. An output parameter that is defined for pass by reference is not initialized when the function module is called.
CHANGING parameters are input and output parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input or output parameter. When the function module is called, the content of the actual parameter is passed to the input/output parameter, and when the function module is completed, the content of the input/output parameter is passed to the actual parameter.
TABLES parameters are table parameters. Table parameters are obsolete CHANGING parameters that are typed as standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to a formal parameter of this type, an empty local header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. Pass by value is not possible in formal parameters defined using TABLES. Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created for the internal table in the function module by using the addition LIKE LINE OF itab of the DATA statement.
Exceptions
The exception of a function module are defined on the Exceptions tab page in the Function Builder. Here you can select exception classes to define whether class-based exceptions are declared or non-class-based exception are defined. Class-based exceptions are represented in the above syntax by RAISING, and non-class-based exceptions are represented by EXCEPTIONS.
The addition RAISING is used to declare class-based exceptions that can be propagated from the function module to the caller. Exceptions in the categories CX_STATIC_CHECK and CX_DYNAMIC_CHECK must be explicitly declared, otherwise a propagation can lead to an interface violation. A violation of the interface leads to the treatable exception CX_SY_NO_HANDLER. Exceptions of the category CX_NO_CHECK are implicitly always declared. The declaration of exceptions of the category CX_STATIC_CHECK is statically checked in the syntax check. For exceptions of the category CX_DYNAMIC_CHECK, the check is not performed until runtime. In a function module in which class-based exceptions are declared with the RAISING addition, the statement CATCH SYSTEM-EXCEPTIONS cannot be used. Instead, the relevant treatable exceptions should be handled in a TRY control structure.
The addition EXCEPTIONS is used to define a list of non-class-based exceptions that can be triggered in the function module using the statements RAISE or MESSAGE RAISING. Exceptions defined in this way - as with formal parameters - are bound to the function module and cannot be propagated. If an exception of this type is triggered in a function module, and no return value has been assigned to it with the homonymous addition EXCEPTIONS of the CALL FUNCTION statement when the call was made, this leads to a runtime error.
Note
For new developments after release 6.10, SAP recommends that you work with class-based exceptions that are independent of the function module.
RFC is a technology which is used to access a functions (Modules) from
the remote systems.
If a function module is set as remote enabled which can be access from
the remote system via RFC.Eg: U can access the Remote enabled function modules in ur VB,Webdynpro,Java,Visual composer program.
A function module can be set as remote enabled by SE37->Go to ur FM->click the option Button "remote enabled".
But Normal function modules can not accessd from the remote system.
Good Example for RFC enabled function module is : BAPI(Business Application Programming Interface)
Note: All BAPIs are Remote enabled but not all remote enabled function modules are BAPI.
CALLING A FUNCTION MODULE:
1)In U ABAP Editor --> Click "Patter" ---> Selection Option Button "Call Function"
--> Write the Corresponding FM name --> Hit Enter
2)The appropriate import ,export Parameters will be displayed in ur editor
3)Pass the Values Here.
Also check these links.
http://www.geocities.com/victorav15/sapr3/abapfun.html
Check this link:
http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
Check this link:
http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
See the following links:
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm
Regards
Anji -
Hey SD experts,
I would like to link those three SAP tables :
VBAP, VBAK and KNA1 in order to create a query.
VBAP is the principal table, VBAK and KNA1 are additional ones.
What intermediate table should I use to make it possible ?
Thank you,
Bahia.I'll explain to you in details:
I'm trying to create an infoset.
I choose "direct read of table" : VBAP
Than, I add VBAK : VBAP-VBELN = VBAK-VBELN
Than, KNA1: KNA1-KUNNR = VBAK-KUNNR
When I try to generate the infoset, I get this warning message:
Access error in code for table KNA1, KNA1 has sequence number 01
Fields from VBAK are not assigned to a field group
Fields from KNA1 are not assigned to a field group
Thank you -
Realtionship between J_1IEXCHDR and VBAP or VBAK
Hi All Expert,
Hw ru.
Please help me regarding relation ship between J_1IEXCHDR and VBAK or VBAP table.
currently i am using rdoc in J_1IEXCHDR table but cant fetch data.
PLease guide me which field i can use for relation ship.
*SELECT *
* FROM J_1IEXCHDR
* INTO TABLE it_J_1IEXCHDR
* FOR ALL ENTRIES in IT_VBRK
* where rdoc = it_vbrk-VBELN.
OR
select single exnum from J_1IEXCHDR into itab-exnum
where rdoc = it_vbak-vbeln.
itab-exnum = J_1IEXCHDR-exnum.
Thanking U,
Bhavesh Panchal.Hi,
Excise invoice is posted with reference to Billing document and not sales order. Hence, you would find billing doc no in J_1IEXCHDR-RDOC. To trace back to sales order no use VBFA(Sales document flow) table.
Check FM SD_DOCUMENT_FLOW_GET
Regards,
Amit
Edited by: Amit Iyer on Aug 28, 2009 12:09 PM -
Performance issue with joins on table VBAK, VBEP, VBKD and VBAP
hi all,
i have a report where there is a join on all 4 tables VBAK, VBEP, VBKD and VBAP.
the report is giving performance issues because of this join.
all the key fields are used for the joining of tables. but some of the non-key fields like vbap-vstel, vbap-abgru and vbep-wadat are also part of select query and are getting filled.
because of these there is a performance issue.
is there any way i can improve the performance of the join select query?
i am trying "for all entries" clause...
kindly provide any alternative if possible.
thanks.Hi,
Pls perform some of the below steps as applicable for the performance improvement:
a) Remove join on all the tables and put joins only on header and item (VBAK & VBAP).
b) code should have separate select for VBEP and VBKD.
c) remove the non key fields from the where clause. Once you retrieve data from the database into the internal table, sort the table and delete the entries which are not part of the non-key fields like vstel, abgru and wadat.
d) last option is you can create index in the VBAP & VBEP table with respect to the fields vstel, abgru & wadat ( not advisable)
e) buffering option on database tables also possible.
f) select only the fields into the internal table that are applicable for the processing logic and also the select query should contaian the field names in the same order as mentioned in the database table.
Hope this helps.
Regards
JLN -
Joining the Tables VBAK and CDHDR
Hi All,
I am a novice to SAP, and probably have the most basic question. I need to join the two tables VBAK and CDHDR and I dont see any common fields between them.
I would need to do this for as generating a custom report that lists all the valid contracts created or changed within the period of selection. I also need to show the old value and the new value, the user ID of who made the change/creation and the date of the change.
Anyhelp in this regard is highly appreciated and will be rewarded appropriately.
Many thanks in anticipation.CDHDR is used for each and every table of SAP, so don't look for common key with your table.
Look for records in CDHDR with OBJECTCLAS = 'VERKBELEG' and OBJECTID = VBAK-VBELN, and then in CDPOS with keys of CDHDR and tabname = 'VBAK' and tabkey = VBAK-VBELN. (You also get VBAP and other tables under the same Id)
Take a look at report RVSCD100
Regards -
Hi Experts,
IS there any link between VBAK and LIPS (VBELN AND VGBEL). Data is flow from header level VBAK to Item level LIPS is correct or Item level to item level.
Regards
RahulDear Rahul1234 ,
You can use the VBAK- VBELN or VBAP-VBELN
Put the same in VBFA as preceding document and fetch subsequent document where subsequent document category is J(delivery)
Now input that list in LIPS to get the required field.
This will work. If your ABAPer is telling that the logic is not correct, then you may demonstrate the same using a query (table join VBAK-VBFA-LIPS)
Thanks & Regards,
Hegal K Charles -
How to use Innerjoin b/w these 2 tables VBAK and CDHDR ?
Hi,
How to use Innerjoin b/w these 2 tables VBAK and CDHDR for retrieving of changed sales order data ?I nned the A select stmt with INNER JOIN for changed sales data.
Thanks & Regards,
gopi.Hi Gopi,
You can use the code similar to below to read the changes to Sales order from CDHDR AND CDPOS
FORM GET_CHANGES .
* Get all the changes to Sales Order as well as Deliveries. Suppress
* Non relevant change
DATA : BEGIN OF SO_VBELN OCCURS 0 ,
VBELN LIKE CDHDR-OBJECTID,
END OF SO_VBELN.
DATA : BEGIN OF DL_VBELN OCCURS 0 ,
VBELN LIKE CDHDR-OBJECTID,
END OF DL_VBELN.
DATA TEMP_SO_VBELN LIKE SO_VBELN OCCURS 0 WITH HEADER LINE.
DATA DATE_UNTIL LIKE SY-DATUM.
DATA TIME_UNTIL LIKE SY-UZEIT .
DATA DATE_FROM LIKE SY-DATUM.
READ TABLE S_CHADT INDEX 1.
LOOP AT IT_VBAP.
AT NEW VBELN.
MOVE IT_VBAP-VBELN TO TEMP_SO_VBELN.
COLLECT TEMP_SO_VBELN.
ENDAT.
ENDLOOP.
IF TEMP_SO_VBELN[] IS NOT INITIAL.
SELECT OBJECTID AS VBELN FROM CDHDR
INTO TABLE SO_VBELN
FOR ALL ENTRIES IN TEMP_SO_VBELN
WHERE OBJECTCLAS EQ 'VERKBELEG'
AND OBJECTID EQ TEMP_SO_VBELN-VBELN
AND USERNAME IN S_CHABY
AND UDATE IN S_CHADT.
ENDIF.
LOOP AT IT_LIPS INTO WA_LIPS.
AT NEW VBELN.
MOVE WA_LIPS-VBELN TO DL_VBELN.
COLLECT DL_VBELN.
ENDAT.
ENDLOOP.
* Changes in Sales Order.
IF NOT SO_VBELN[] IS INITIAL.
* Get partner functions
SELECT * INTO TABLE IT_TPART
FROM TPART WHERE SPRAS EQ SY-LANGU.
SELECT A~TABNAME A~FIELDNAME A~DATATYPE B~DDTEXT
INTO CORRESPONDING FIELDS OF TABLE IT_FIELD
FROM DD03L AS A INNER JOIN
DD04T AS B
ON A~ROLLNAME EQ B~ROLLNAME
AND A~AS4LOCAL EQ B~AS4LOCAL
WHERE ( A~TABNAME EQ 'VBAK'
OR A~TABNAME EQ 'VBAP'
OR A~TABNAME EQ 'VBEP'
OR A~TABNAME EQ 'VBPA'
OR A~TABNAME EQ 'VBUK'
OR A~TABNAME EQ 'VBKD' )
AND A~AS4LOCAL EQ 'A'
AND A~AS4VERS EQ '0000'
AND A~ROLLNAME NE SPACE
AND B~DDLANGUAGE EQ SY-LANGU.
* Preapare the exclusion table
R_EXCL_FIELDS-OPTION = 'EQ'.
R_EXCL_FIELDS-SIGN = 'I'.
LOOP AT IT_FIELD WHERE DATATYPE EQ 'CURR'.
R_EXCL_FIELDS-LOW = IT_FIELD-FIELDNAME.
APPEND R_EXCL_FIELDS.
ENDLOOP.
R_EXCL_FIELDS-LOW = 'ARKTX'.
APPEND R_EXCL_FIELDS.
R_EXCL_FIELDS-LOW = 'LGORT'.
APPEND R_EXCL_FIELDS.
R_EXCL_FIELDS-LOW = 'TDDAT'.
APPEND R_EXCL_FIELDS.
R_EXCL_FIELDS-LOW = 'LDDAT'.
APPEND R_EXCL_FIELDS.
R_EXCL_FIELDS-LOW = 'MBDAT'.
APPEND R_EXCL_FIELDS.
R_EXCL_TABL-OPTION = 'EQ'.
R_EXCL_TABL-SIGN = 'I'.
R_EXCL_TABL-LOW = 'KONVC'.
APPEND R_EXCL_TABL.
R_EXCL_TABL-LOW = 'VBKD'.
APPEND R_EXCL_TABL.
LOOP AT SO_VBELN.
REFRESH ITAB_CDHDR.
DATE_FROM = S_CHADT-LOW.
DATE_UNTIL = S_CHADT-HIGH.
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
EXPORTING
DATE_OF_CHANGE = DATE_FROM
OBJECTCLASS = 'VERKBELEG'
OBJECTID = SO_VBELN-VBELN
TIME_OF_CHANGE = TIME_UNTIL
DATE_UNTIL = DATE_UNTIL
USERNAME = ' '
TABLES
I_CDHDR = ITAB_CDHDR
EXCEPTIONS
NO_POSITION_FOUND = 1
WRONG_ACCESS_TO_ARCHIVE = 2
TIME_ZONE_CONVERSION_ERROR = 3
OTHERS = 4.
IF SY-SUBRC NE 0.
CONTINUE.
ENDIF.
LOOP AT ITAB_CDHDR WHERE USERNAME IN S_CHABY.
REFRESH IT_CDSHW.
CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
EXPORTING
CHANGENUMBER = ITAB_CDHDR-CHANGENR
TABLES
EDITPOS = IT_CDSHW
EXCEPTIONS
NO_POSITION_FOUND = 1
WRONG_ACCESS_TO_ARCHIVE = 2
OTHERS = 3.
IF SY-SUBRC EQ 0.
PERFORM GET_ACTION .
ENDIF.
ENDLOOP.
ENDLOOP.
ENDIF.
* Changes in Delivery
IF NOT DL_VBELN[] IS INITIAL.
REFRESH : IT_CDHDR , IT_CDPOS.
SELECT OBJECTCLAS OBJECTID CHANGENR USERNAME UDATE
FROM CDHDR INTO CORRESPONDING FIELDS OF TABLE IT_CDHDR
FOR ALL ENTRIES IN DL_VBELN
WHERE OBJECTCLAS EQ 'LIEFERUNG'
AND OBJECTID EQ DL_VBELN-VBELN
AND USERNAME IN S_CHABY
AND UDATE IN S_CHADT
AND CHANGE_IND EQ 'U'.
LOOP AT IT_CDHDR.
CONCATENATE SY-MANDT IT_CDHDR-OBJECTID
INTO IT_CDHDR-TABKEY .
CONDENSE IT_CDHDR-TABKEY.
MODIFY IT_CDHDR.
ENDLOOP.
IF NOT IT_CDHDR[] IS INITIAL.
SELECT * INTO TABLE IT_CDPOS FROM CDPOS
FOR ALL ENTRIES IN IT_CDHDR
WHERE OBJECTCLAS EQ IT_CDHDR-OBJECTCLAS
AND OBJECTID EQ IT_CDHDR-OBJECTID
AND CHANGENR EQ IT_CDHDR-CHANGENR
AND TABNAME EQ 'LIKP'
AND TABKEY EQ IT_CDHDR-TABKEY
AND FNAME IN ('WADAT','LFDAT','ROUTE','VSBED')
AND CHNGIND EQ 'U' .
LOOP AT IT_CDPOS .
CLEAR IT_DL_CHG-FLAG_RED.
CASE IT_CDPOS-FNAME.
WHEN 'WADAT'.
MOVE 'Goods issue date changed' TO IT_DL_CHG-ACTION.
WHEN 'LFDAT'.
MOVE 'Delivery date changed' TO IT_DL_CHG-ACTION.
MOVE 'X' TO IT_DL_CHG-FLAG_RED.
WHEN 'ROUTE'.
MOVE 'Route Changed' TO IT_DL_CHG-ACTION.
WHEN 'VSBED'.
MOVE 'Shipping Condition Changed' TO IT_DL_CHG-ACTION.
WHEN OTHERS.
ENDCASE.
AT NEW CHANGENR .
READ TABLE IT_CDHDR WITH KEY OBJECTCLAS = IT_CDPOS-OBJECTCLAS
OBJECTID = IT_CDPOS-OBJECTID
CHANGENR = IT_CDPOS-CHANGENR
BINARY SEARCH.
MOVE IT_CDHDR-USERNAME TO IT_DL_CHG-ERNAM.
WRITE IT_CDHDR-UDATE TO IT_DL_CHG-ERDAT.
ENDAT.
IT_DL_CHG-COUNTER = IT_DL_CHG-COUNTER + 1.
MOVE IT_CDPOS-OBJECTID TO IT_DL_CHG-VBELN.
MOVE IT_CDPOS-VALUE_OLD TO IT_DL_CHG-OLD_VAL.
MOVE IT_CDPOS-VALUE_NEW TO IT_DL_CHG-NEW_VAL.
INSERT TABLE IT_DL_CHG.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM. " GET_CHANGES
Cheers
VJ -
SAP Query error for VBAK and KONV tables
Dear Experts,
Want to create SAP Query for below requirement but faced some error
Step1) Extract the data from VBAK table w.r.t. order type , Sale org and date range
and collected the Sales order numbers and doc. condition record (KNUMV)
Step 2)In table KONV (Transactional condition record data) in this table provided input as doc. condition record (KNUMV) with respect to condition type ABCD
Manually i extracted data, there is no problem .
But customer want to generate SAP Query for above requirement
I tried to create but in t.code SQ02 when i tried to join the table VBAK and KONV i faced the below error
Table KONV cannot be used in a join.
How can I create SAP query for above requirement ???
if its not possible then create Z report is the only solution ??????
Thanks in advanceHello
You can not create Query report with joining KONV. But there is one solution for your problem. You can create Query report by using Database VAV. In this logical database you will find all SD tables and also KONV. Use only those tables and fields which you want in your query report. I have checked this and its working
Please try this and update the forum accordingly.
Edited by: moazzamjii on Jun 30, 2011 12:13 PM -
Link between Prps and Vbap table
Hi all,
How can i link PRPS and VBAP table .
Please suggest.
Thanks and regrads
Neha Kapoorhi,
neha try this.
PRPS-PSPNR = VBAP-PS_PSP_PNR
rgds
anver
Maybe you are looking for
-
How to use same jsp for edit and add form
Hi, I would like to use the same .jsp file for edit and add. I just want to change a few controls based on edit/add mode. How do I configure this in the jsp?
-
When trying to create a PDF from a website the font doesn't convert properly to a readable format
Hello, As the title states when I find something on a website that I want to create a PDF with, the font that's readable from the website converts once the PDF is created to an unknown format that isn't readable in any language. I'm using Adobe Acrob
-
How to restrict a characteristic in hierarchy
Hello, I have created a heirarchy of 0PROJECT characteristic (that has 0GL_ACCOUNT as external characteristic), and it is not gettin filtered in my report. The hierarchy is defined like this: NODE1 (text) --> 0GL_ACCOUNT (account number) --> 0PROJECT
-
Hi All Please could someone briefly explain how I manage Fiscal Year Variants in a BI system? I ran trans OB29 to see what has been set-up in the ECC. I ran the option 'Transfer Global Settings' to transfer the Fiscal Year Variants to the BI system,
-
System Crash during ERP 2005 (ECC 6.0) SR2 ABAP+JAVA installation
Hi all, I am fairly new to this fascinating world of SAP BASIS and recently got hit by an issue which I faced during an ERP 2005 SR2 (ECC 6.0) ABAP+JAVA installation. My Installation Particulars: 1. OS: Windows Server 2003 R2 (32-bit) 2. DB: Oracle 1