05-02-2008 10:53 AM
Hi,
Is the belnr in bsik same with the belnr in rseg?
Or is it the augbl of bsik same with the belnr in rseg?
Thanks.
05-02-2008 11:02 AM
Hi
No! I don't believe:
BSIK-BELNR is the accounting document number
RSEG-BELNR is the incoming invoice number
The link beetween the two document is in BKPF-AWTYP and BKPF-AWKEY
It should be:
BKPF-AWTYP = 'RMRP'
BKPF-AWKEY = RBKP-BELNR + RBKP-GJAHR.
SELECT * FROM BSIK WHERE .......
SELECT SINGLE * FROM BKPF WHERE BUKRS = BSIK-BUKRS
AND BELNR = BSIK-BELNR
AND GJAHR = BSIK-GJAHR
SELECT * FROM RSEG WHERE BELNR = BKPF-AWKEY(10)
AND GJAHR = BKPF-AWKEY+10(4)
Anyway perhaps the incoming invoice is written on XBLNR or ZUONR field, but that depends on your customizing.
Max
Max
05-02-2008 10:57 AM
Hi Navi,
BELNR of BSIK is same as that of BELNR of RSEG.
Both refer to same DAta Element BELNR_D i.e. of TYPE CHAR and LENGTH 10 and both are Accounting Document Number.
Reward if Helpful.
Regards,
Sunil.
05-02-2008 11:02 AM
Hi
No! I don't believe:
BSIK-BELNR is the accounting document number
RSEG-BELNR is the incoming invoice number
The link beetween the two document is in BKPF-AWTYP and BKPF-AWKEY
It should be:
BKPF-AWTYP = 'RMRP'
BKPF-AWKEY = RBKP-BELNR + RBKP-GJAHR.
SELECT * FROM BSIK WHERE .......
SELECT SINGLE * FROM BKPF WHERE BUKRS = BSIK-BUKRS
AND BELNR = BSIK-BELNR
AND GJAHR = BSIK-GJAHR
SELECT * FROM RSEG WHERE BELNR = BKPF-AWKEY(10)
AND GJAHR = BKPF-AWKEY+10(4)
Anyway perhaps the incoming invoice is written on XBLNR or ZUONR field, but that depends on your customizing.
Max
Max
05-02-2008 11:09 AM
hi max!
so i can actually connect the two tables using bkpf-awkey??
how about bsik-belnr to bseg-belnr?
thanks!
05-02-2008 11:14 AM
Hi
BSEG or RSEG?
Anway the only sure way is to use the field AWKEY
U can link BSIK to BSEG with BELNR field:
SELECT * FROM BSIK
SELECT SINGLE * FROM BSEG WHERE BUKRS = BSIK-BUKRS
AND BELNR = BSIK-BELNR
AND BUZEI = BSIK-BUZEI
Remember BSIK is the index table for the open vendor item, here you can find the information from BKPF and BSEG table.
Max
Edited by: max bianchi on May 2, 2008 12:15 PM
05-02-2008 11:18 AM
Hi,
Basically, my requirement is to have 3 buttons:
-open items (which will be taken from BSIK)
-cleared items(which will be taken from BSAK)
-all items (both open and cleared)
Now, i'm going to map BSIK and/or BSAK to RSEG and RBKP because RSEG and RBKP are my main tables.
Thanks.
05-02-2008 11:19 AM
Hi,
Go through the Document
[http://www.abap.es/Descargas/TAB%20-%20Relacion%20de%20las%20tablas%20por%20modulos.PDF]
In page 6 you will get the relation ship.
Regards
Sandipan
05-02-2008 11:28 AM
Hi Sandipan,
But what is mapped there is BSIK-BSEG and not BSIK-RSEG.
Did u mean that i should instead map BSIK-BSEG and not to RSEG??
Thanks.
05-02-2008 11:34 AM
Hi,
U use RSEG-BELNR and RSEG-BUKRS = BSIK-BELNR and BSIK-BUKRS
Regards
Sandipan
05-02-2008 11:42 AM
Sandipan,
But when i try to see the field values in IDES, there's no document # that has the same value for BSIK-belnr and RSEG-belnr.
I'll wait for your reply.
Thanks.
05-02-2008 11:44 AM
Hi
So the flow of your program should be like the following:
TABLES: BKPF, BSIK, RBKP, RSEG, BSEG.
PARAMETERS: P_BUKRS TYPE BSIK-BUKRS.
SELECT-OPTIONS: SO_LIFNR FOR BSIK-LIFNR.
PARAMETER: P_OPEN RADIOBUTTON GROUP R1,
P_CLEAR RADIOBUTTON GROUP R1,
P_ALL RADIOBUTTON GROUP R1.
DATA: T_ITEMS TYPE STANDARD TABLE OF BSIK,
T_RSEG TYPE STANDARD TABLE OF RSEG.
DATA: _OPEN,
_CLEARED.
START-OF-SELECTION.
CASE 'X'.
WHEN P_OPEN.
_OPEN = 'X'.
WHEN P_CLEAR.
_CLEARED = 'X'.
WHEN P_ALL.
_OPEN = _CLEARED = 'X'.
ENDCASE.
IF _CLEARED = 'X'.
SELECT * FROM BSAK INTO TABLE T_ITEMS WHERE BELNR = P_BUKRS
AND LIFNR IN SO_LIFNR.
ENDIF.
IF _OPEN = 'X'.
SELECT * FROM BSIK APPENDING TABLE T_ITEMS WHERE BELNR = P_BUKRS
AND LIFNR IN SO_LIFNR.
ENDIF.
SORT T_ITEMS BY LIFNR BUKRS GJAHR BELNR BUZEI.
LOOP AT T_ITEMS INTO BSIK.
* Get header data
IF BKPF-BELNR <> BSIK-BELNR OR
BKPF-GJAHR <> BSIK-GJAHR.
SELECT SINGLE * FROM BKPF WHERE BUKRS = BSIK-BUKRS
AND BELNR = BSIK-BELNR
AND GJAHR = BSIK-GJAHR.
* Get incoming invoice data
IF BKPF-AWTYP = 'RMRP'.
SELECT SINGLE * FROM RBKP WHERE BELNR = BKPF-AWKEY(10)
AND GJAHR = BKPF-AWKEY+10(4).
IF SY-SUBRC = 0.
SELECT * FROM RSEG INTO TABLE T_RSEG WHERE BELNR = RBKP-BELNR
AND GJAHR = RBKP-GJAHR.
ENDIF.
ELSE.
CLEAR RBKP.
REFRESH T_RSEG.
ENDIF.
ENDIF.
* Get item data
SELECT SINGLE * FROM BSEG WHERE BUKRS = BSIK-BUKRS
AND BELNR = BSIK-BELNR
AND GJAHR = BSIK-GJAHR
AND BUZEI = BSIK-BUZEI.
ENDLOOP.
05-02-2008 11:48 AM
hI,
i have also checked the two tables and what i found that they have only matching that is BUKRS.
So ithink u need BSEG also.
Regards
Sandipan
05-02-2008 12:12 PM
05-02-2008 11:07 AM
hi navi
it is same dear in both the tabel and also it is a part of primary key in both the table so if u want to stablish any relation between this two u can go ahead
reward if helpfull
snehi chouhan
05-02-2008 11:08 AM