01-07-2009 7:10 AM
Hi gurus,
We are extracting data of PO relating to me23n and sending that data to XI. Its working fine. But some fields value are getting wrong. I am getting problem with komv, komk, and komp structures, bcoz i dont know which tables i have to use. I am using konv right now.
Pls give some suggestions.
and also how we get netwr value in the header i.e. total amout of items and price element rate KOMV-KBETR in header.
ex: KOMV-KBETR
KOMK-WAERK
KOMP-NETWR
TDTEXT based on ID
ZTEXT (item level text, and header level text).
Thanks in advance...
01-07-2009 7:12 AM
01-07-2009 7:20 AM
Please explain in detail. i.e. for komk which table , komp which table , komv - which table i have to use either KONV or KONP.
regarding KOMV-KBETR (Price element rate) and KOMK-NETWR(Net value in document) in header. i am getting properly in item details for these fields, but how we can put the total amout (i.e KBETR and NETWR) in header.
Thanks frnd..
01-07-2009 7:34 AM
dont compare structures with tables.
for your requirement use KONV table.
get document condition number from ekko and use it in konv .
ekko-KNUMV = konv-KNUMV.
use konv-kbetr.
01-07-2009 7:55 AM
Pls see my code...
*This for Header.............*
i_zzep_pohdr_s-doc_date = i_ekko-bedat. "14
SELECT SINGLE * FROM t052 INTO i_t052 WHERE zterm = i_ekko-zterm.
IF sy-subrc = 0.
i_zzep_pohdr_s-pay_trms = i_t052-zterm. "15
ENDIF.
SELECT SINGLE * FROM tcurc INTO i_tcurc WHERE waers = i_ekko-waers.
IF sy-subrc = 0.
i_zzep_pohdr_s-curr = i_tcurc-waers. "16
ENDIF.
i_zzep_pohdr_s-ex_rate = i_ekko-wkurs. "17
i_zzep_pohdr_s-ex_rate_fxd = i_ekko-kufix. "18
i_zzep_pohdr_s-inco = i_ekko-inco1. "19
i_zzep_pohdr_s-add_inco = i_ekko-inco2. "20
SELECT SINGLE * FROM t685t INTO i_t685t
WHERE spras = i_ekko-spras.
IF sy-subrc = 0.
i_zzep_pohdr_s-pri_ele_cond_desc = i_t685t-vtext. "21
ENDIF.
SELECT SINGLE * FROM konv INTO i_konv WHERE knumv = i_ekko-knumv.
IF sy-subrc = 0.
IF i_konv-kschl = 'PBXX'.
* i_zzep_pohdr_s-Pri_ele_rate = i_konv-kbetr. "22
i_zzep_pohdr_s-pri_ele_curr_cond = i_konv-waers. "23
i_zzep_pohdr_s-pri_ele_cond_val_doc_curr = i_konv-kwert_k. "24
ENDIF.
ENDIF.
MOVE i_ekko-ebeln TO xname.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = 'F02'
language = sy-langu
name = xname
object = 'EKKO'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
lines = i_xtline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
CLEAR temp.
LOOP AT i_xtline INTO rline.
IF rline-tdline IS NOT INITIAL.
CONCATENATE temp rline-tdline INTO temp SEPARATED BY space.
ENDIF.
ENDLOOP.
MOVE temp TO i_zzep_pohdr_s-hdr_lvl_txt_cont . "28
ENDIF.
SELECT SINGLE * FROM t166k INTO i_t166k WHERE bsart = i_ekko-bsart.
IF sy-subrc = 0.
i_zzep_pohdr_s-hdr_lvl_txt_id = i_t166k-tdid. "26
ENDIF.
SELECT SINGLE * FROM t166k INTO i_t166k WHERE bsart = i_ekko-bsart.
IF sy-subrc = 0.
SELECT SINGLE * FROM ttxot INTO i_ttxot WHERE tdobject = i_t166k-tdobject
AND tdspras = i_ekko-spras.
IF sy-subrc = 0.
i_zzep_pohdr_s-hdr_lvl_txt_desc_id = i_ttxot-tdtext. " 27
ENDIF.
ENDIF.
APPEND i_zzep_pohdr_s TO t_zzep_pohdr_t.
ENDLOOP.
*This for Items.............*
SELECT * FROM t166p INTO TABLE i_t166p WHERE bstyp = i_ekpo-bstyp
AND pstyp = i_ekpo-pstyp.
IF sy-subrc = 0.
LOOP AT i_t166p INTO wa_t166p.
IF wa_t166p-tdid = 'F01'.
i_zzep_podet_s-itm_lvl_txt_id = wa_t166p-tdid. "29
ENDIF.
ENDLOOP.
SELECT SINGLE * FROM ttxot INTO i_ttxot WHERE tdobject = 'EKPO'
AND tdspras = sy-langu.
IF sy-subrc = 0.
i_zzep_podet_s-itm_lvl_txt_desc_id = i_ttxot-tdtext. " 27
ENDIF.
ENDIF.
*select single * from stxl into i_stxl where tdspras = i_ekko-spras.
*select single * from
APPEND i_zzep_podet_s TO t_zzep_podet_t.
sum = sum + i_zzep_podet_s-pri_ele_net_val_doc_curr.
CLEAR i_zzep_podet_s.
ENDLOOP.
CLEAR current_line.
LOOP AT t_ekko INTO i_ekko.
current_line = sy-tabix.
LOOP AT t_ekpo INTO i_ekpo WHERE ebeln = i_ekpo-ebeln.
IF sy-subrc = 0.
*MOVE sum TO i_zzep_pohdr_s-pri_ele_net_val_doc_curr.* (NETWR)
*MOVE sum TO i_zzep_pohdr_s-pri_ele_rate.* (KBETR)
ENDIF.
ENDLOOP.
MODIFY t_zzep_pohdr_t FROM i_zzep_pohdr_s INDEX current_line.
ENDLOOP.
ENDIF.
I already down althose wht u suggested previous...
just see this code and give suggestion where i have to change my code....
I am getting doubt when i am using ..
IF i_konv-kschl = 'PBXX'.
i_zzep_podet_s-pri_ele_rate = i_zzep_podet_s-ext_val_itm. "25
i_zzep_podet_s-pri_ele_curr_cond = i_konv-waers. "26
i_zzep_podet_s-pri_ele_cond_val_doc_curr = i_konv-kwert_k. "27
ENDIF.
and..
CLEAR current_line.
LOOP AT t_ekko INTO i_ekko.
current_line = sy-tabix.
LOOP AT t_ekpo INTO i_ekpo WHERE ebeln = i_ekpo-ebeln.
IF sy-subrc = 0.
MOVE sum TO i_zzep_pohdr_s-pri_ele_net_val_doc_curr.
MOVE sum TO i_zzep_pohdr_s-pri_ele_rate.
ENDIF.
ENDLOOP.
MODIFY t_zzep_pohdr_t FROM i_zzep_pohdr_s INDEX current_line.
ENDLOOP.
ENDIF.
pls suggest me...
thanks.
Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 12:49 PM
01-07-2009 8:02 AM
Hi Ram ,
you can get the details for each line item from konp table for that you are use A363 table ,
there you wil get the relation of plant vendor and material used in the Purchase Order .
get the no of condition record no , and match it with the KONP table , you will get what you want .
Regards
Digvijay Rai
01-07-2009 9:31 AM
Hi,
You please tell me which method you are using to extract data of PO. You try to note the table names In debugging mode.
Thanks & Regards
Nagamani
01-07-2009 9:42 AM
Hi.
For finding Tables, you just press the F1 -> Technical details.
if you gent structure name in F1 help, just double click in the structure it will take into that structure.
here you can select any field(Wat field you want in your Report) and double click on the Data element
and double click on the domain and select the value range tab, at the bottom of the tab you can see the
value table name. this is the actual table for that field. and also from the initial screen of the structure
you have tab called entry help in this you can get the Check table for that field.
(or)
if your not getting from here. before going into the Standard transaction, just active the SQL trace by using
the ST05. after working in transaction come back and switch off the Trace and see the SQL query, here you can get all the Tables used for that Transaction.
Regards.
Sreenu.