Skip to Content
author's profile photo Former Member
Former Member

indent no for a sales order

hi,

i want to select indent no. for a sales order no.

i m selecting vbeln from vbap table and joining it with eban-bednr vbap-vbeln = eban-benr

but by doing so no data is selected only vbap-vbeln is coming.

whether the join condition is wrong?

i have to show indent no for a sales order and its item.

here is the code.

&----


*& Report ZBOMTEST2 *

*& *

&----


*& *

*& *

&----


REPORT zbomtest2 NO STANDARD PAGE HEADING

LINE-SIZE 255. .

TABLES: vbak, vbap, vbkd , vbbe , kna1 , mara.

DATA: BEGIN OF ivbak OCCURS 0,

vbeln TYPE vbak-vbeln,

END OF ivbak.

DATA: BEGIN OF ivbap OCCURS 0,

vbeln TYPE vbap-vbeln,

posnr TYPE vbap-posnr,

kwmeng LIKE stko-bmeng ,

kosch TYPE vbap-kosch,

END OF ivbap.

DATA: BEGIN OF ieban OCCURS 0,

banfn TYPE eban-banfn,

bnfpo TYPE eban-bnfpo,

bednr TYPE eban-bednr,

matnr TYPE eban-matnr,

END OF ieban.

DATA: BEGIN OF itab OCCURS 0,

vbeln TYPE vbap-vbeln,

banfn TYPE eban-banfn,

bnfpo TYPE eban-bnfpo,

bednr TYPE eban-bednr,

matnr TYPE eban-matnr,

END OF itab.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

SELECT-OPTIONS: s_vbeln FOR vbap-vbeln.

SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

SELECT vbeln posnr kwmeng kosch FROM vbap INTO CORRESPONDING FIELDS OF TABLE ivbap

WHERE vbeln IN s_vbeln.

IF NOT ivbap[] IS INITIAL.

SELECT banfn bnfpo bednr matnr FROM eban INTO TABLE ieban

FOR ALL ENTRIES IN ivbap WHERE bednr = ivbap-vbeln.

ENDIF.

LOOP AT ivbap.

READ TABLE ieban WITH KEY bednr = ivbap-vbeln.

IF sy-subrc = 0.

itab-banfn = ieban-banfn.

itab-bnfpo = ieban-bnfpo.

itab-bednr = ieban-bednr.

itab-matnr = ieban-matnr.

ENDIF.

itab-vbeln = ivbap-vbeln.

APPEND itab.

CLEAR itab.

ENDLOOP.

LOOP AT itab .

WRITE:/5 itab-vbeln , 16 itab-banfn , 30 itab-matnr.

ENDLOOP.

pls help....

regards

pankaj

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jul 25, 2008 at 12:03 PM

    Hi,

    I think VBAK is relate dto Sales and EBAN is relaetd to Purchase requistion. they are not related to each other.

    Based on your post, im considering the that VBELN(VBAP or VBAP) refers to BEDNR(EBAN).

    I think for that VBELN there is no traacking number.

    Do this way -

    Frist get all entires in the Inertanal table (IT_EBAN) from EBAN with the tracking number.(BEDNR)

    if IT_EBAN[] is not intital.

    select the entries from VBAP dor all entires in IT_EBAN

    where VEBLN = IT_EBAN-BEDNR.

    endif.

    This is reverse way of getting the things done.

    If you still didnt get the values, then check wether this tracking number refers the sales document number or not.

    If you still dont get the results, we can go with material number and other fields.

    Thanks & Regards,

    Chandralekha.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.