Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Get Material Doc based on Acc Doc

Former Member
0 Likes
862

Hi All,

Please guide me how to get the Mat Doc (MSEG-MBLNR) based on the Acc Doc (BSIK-BELNR).

I already tried --> MSEG-BELNR = BSIK-BELNR, but can't.

Kindly advise.

Best Regards,

Victor.

Hi All,

Please guide me how to get the Mat Doc (MSEG-MBLNR) based on the Acc Doc (BSIK-BELNR).

I already tried --> MSEG-BELNR = BSIK-BELNR, but can't.

Kindly advise.

Best Regards,

Victor.

5 REPLIES 5
Read only

Former Member
0 Likes
798

Hi

Take the EBELN field from BSIK by passing BELNR to it (if EBELN is not there take XBLNR) and pass it to MSEG to get the required data from MSEG.

reward if useful

regards,

Anji

Read only

Former Member
0 Likes
798

Hi Anji,

In my server is many records EBELN was empty, and

XBLNR value is like this: 06000124/INV, INV5690.

So seems can't used both.

Other suggestion ?

Best Regards,

Victor.

Read only

h_senden2
Active Contributor
0 Likes
798

MSEG-BELNR is the material document number

BSIK-BELNR (or BKPF-BELNR) is the accounting document number, so comparing those 2 values will not work. Their completelety different

From the MKPF,MSEG you have to find the related transaction document (For instance a GR, or PO) and from that you have to look for the related accounting document.

regards,

Hans

Please reward all helpful answers !!!!!

Read only

Former Member
0 Likes
798

Hi Hans,

The problem now, i just know the acc documents (BSIK-BELNR) or (BKPF-BELNR).

How to know the mat doc number.

From the MKPF,MSEG you have to find the related transaction document (For instance a GR, or PO) --> how can i found the related transaction for this?

Best Regards,

Victor.

Read only

0 Likes
798

Hi Vic ,

just see the logic of this FM , if u give MBLNR it will get A/c Document, so see how tthis FM is getting thatA/c ,thereafter u can bulid the same logic.

1.first u have to get MBLNR.
2.Next u have to call FM 
AC_DOCUMENT_RECORD

I_AWTYP                         MKPF--->Constant
I_AWREF                         4900003215--->MBLNR
I_AWORG                         2004--->Year 
I_AWSYS
I_AWTYP_INCL
I_AWTYP_EXCL
I_BUKRS
I_VALUTYP                       0
X_DIALOG                           X

then u will get the Accounting Documents.

Regards

Prabhu