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

HI Friends i am trying to display two table contents i am getting one table fields but not the second, help me with this

TABLES: VBAK.

CONSTANTS: INF_MSG TYPE C VALUE 'I'.

TYPES: BEGIN OF ST_VBAK,

VBELN TYPE VBELN_VA,

VKORG TYPE VKORG,

KUNNR TYPE KUNNR,

END OF ST_VBAK,

BEGIN OF ST_VBAP,

VBELN TYPE VBELN_VA,

POSNR TYPE POSNR_VA,

MATNR TYPE MATNR,

END OF ST_VBAP,

BEGIN OF ST_KNA1,

KUNNR TYPE KUNNR,

NAME1 TYPE NAME1,

END OF ST_KNA1.

DATA:IT_VBAK TYPE STANDARD TABLE OF ST_VBAK INITIAL SIZE 1,

IT_VBAP TYPE STANDARD TABLE OF ST_VBAP INITIAL SIZE 1,

IT_KNA1 TYPE STANDARD TABLE OF ST_KNA1 INITIAL SIZE 1,

WA_VBAK TYPE ST_VBAK,

WA_VBAP TYPE ST_VBAP,

WA_KNA1 TYPE ST_KNA1.

*AT SELECTION-SCREEN.

SELECT-OPTIONS: SO_VBELN FOR VBAK-VBELN,

SO_KUNNR FOR VBAK-KUNNR.

START-OF-SELECTION.

SELECT VBELN VKORG KUNNR

FROM VBAK

INTO TABLE IT_VBAK

WHERE VBELN IN SO_VBELN AND

KUNNR IN SO_KUNNR.

IF SY-SUBRC <> 0.

MESSAGE TEXT-001 TYPE INF_MSG.

LEAVE LIST-PROCESSING.

ENDIF.

IF IT_VBAK IS NOT INITIAL.

SELECT VBELN POSNR MATNR

FROM VBAP

INTO TABLE IT_VBAP

FOR ALL ENTRIES IN IT_VBAK

WHERE VBELN = IT_VBAK-VBELN.

ENDIF.

as i debug, i am getting fields of one table as i go to the second table, i am going to this screen

Doc.jpg (57.7 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 03, 2014 at 03:29 PM

    Hi Ravi,

    You program is correct and its working fine to me. Please reactivate everything and try once again.

    Thanks

    C Balakrishna

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 04, 2014 at 03:29 AM

    Hello Ravi,

    Program working fine itself, But you are not displaying the output of IT_VBAP nor using anywhere.

    so for feeling yourself comfortable in coding, After the select statement of VBAP use the write statement

    IF IT_VBAK IS NOT INITIAL.

    SELECT VBELN POSNR MATNR

    FROM VBAP

    INTO TABLE IT_VBAP

    FOR ALL ENTRIES IN IT_VBAK

    WHERE VBELN = IT_VBAK-VBELN.

    ENDIF.

    Loop at it_vbap.

    write : it_vbap-vbeln, it_vbap-posnr,it_vbap-matnr.

    clear it_vbap.

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 04, 2014 at 04:47 AM

    Hi Ravi,

    I understand ur problem.

    After Second Select Statement just write any statement like

    IF IT_VBAK IS NOT INITIAL.

    SELECT VBELN POSNR MATNR

    FROM VBAP

    INTO TABLE IT_VBAP

    FOR ALL ENTRIES IN IT_VBAK

    WHERE VBELN = IT_VBAK-VBELN.

    IF IT_VBAP IS NOT INITIAL.

    SORT IT_VBAP.

    ENDIF.

    ENDIF.

    Then in Debugging mode u r cursor will goto if Statement then u'll check It_Vbap Data.

    Hope it'll work.

    Jack.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 04, 2014 at 05:51 AM

    Hi Ravi,

    Put the break-point at your 2nd select statement and check the filling of it_vbap in debugging mode. Any way there should be some common records in your it_vbap because if there is no common fields then the select statement will fetch all the mentioned fields records from the VBAP table.So the point is it_vbap should not be empty. OR

    Execute your report, fill all selection field and enter /h in your serach filed standard menu bar. You will be brought to the debug mode, here check the contents of the it_vbak and it_vbap.

    Your code is ok but not optimized because there is prerequisite for FOE.

    Your VBAP select statement is not optimized because you are just checking the initial of your driver table (it_vbak) but not duplicate entries in driver table(it_vbak).

    So before deleting duplicates entries from your driver table(it_vbak), first sort your it_vbak by key field i.e vbeln in ascending order.

    Then delete the duplicate entries from it_vbak comparing the key field by which the it_vbak is sorted i.e vbeln.

    Thanks & regards

    Syed Hussain

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 04, 2014 at 07:06 AM

    Hi Ravi,

    Your statements seems correct. Try to place a break-point on 2nd select statement and check if any data fetching from VBAP table. U have given the snapshot of FM of conversion routine, just check if anything is passed to it.

    -Regards,

    Ketan Badnore

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 04, 2014 at 08:31 PM

    Oh for crying out loud... Use SELECT vbak JOIN vbap and just one table (you could join KNA1 just as well). After the SELECT put IF SY-SUBRC check (just like you've already done for the first table) and then set the breakpoint on that IF statement. At this point you should be able to see the table content in debugger.

    And don't use LEAVE LIST-PROCESSING, just use RETURN. Also why do you add INITIAL SIZE 1? Doesn't seem to make any sense...

    As a side note - it's really sad that apparently ABAPers are still trained somewhere using material from the 80s.

    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.