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

Comparing fileds of different type and length

Hi abapers,

I ahve an requiremnet to fetch data from table LTAK for the entries fetched from VBFA.the thing is i need to pass VBFA-VBELN to LTAK-TANUM to fetch the records.

Both are of different types and different length .so is it possible to compare these fields.the following is the piece of code for your reference.

SELECT vbelv vbeln vbtyp_n lgnum  FROM vbfa
                                    INTO TABLE i_vbfa
                                    WHERE vbelv   EQ p_del
                                    AND   vbtyp_n EQ 'Q'.
  IF sy-subrc EQ 0.
    SORT i_vbfa BY vbelv.
    DELETE ADJACENT DUPLICATES FROM i_vbfa COMPARING vbelv.

    SELECT lgnum tanum kquit FROM ltak
                             INTO TABLE i_ltak
                             FOR ALL ENTRIES IN i_vbfa
                             WHERE lgnum EQ i_vbfa-lgnum
                             AND      *tanum EQ i_vbfa-vbeln *

So please help me in solving this issue.

Thanks in Advance.

Balaji

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 01, 2008 at 09:09 AM

    HI friend,

    Please Check is there any Conversion Exit is Available or not.

    Other Concern ur FC.

    Thanks,

    Kumar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 01, 2008 at 09:10 AM

    Hi,

    try this:

    
    SELECT vbelv vbeln vbtyp_n lgnum  FROM vbfa
                                        INTO TABLE i_vbfa
                                        WHERE vbelv   EQ p_del
                                        AND   vbtyp_n EQ 'Q'.
      IF sy-subrc EQ 0.
        SORT i_vbfa BY vbelv.
        DELETE ADJACENT DUPLICATES FROM i_vbfa COMPARING vbelv.
     
    call function 'CONVERSIO_EXIT_ALPHA_INPUT'
    exporting 
    input = i_vbfa-vbeln 
    importing
    output = lv_tanum
    
        SELECT lgnum tanum kquit FROM ltak
                                 INTO TABLE i_ltak
                                 FOR ALL ENTRIES IN i_vbfa
                                 WHERE lgnum EQ i_vbfa-lgnum
                                 AND      tanum EQ lv_tanum
    

    with lv_tanum of type tanum

    grtz,

    Koen

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 01, 2008 at 09:10 AM

    Hi,

    Please use the code,

    data : tanum like ltak-tanum.

    SELECT vbelv vbeln vbtyp_n lgnum FROM vbfa

    INTO TABLE i_vbfa

    WHERE vbelv EQ p_del

    AND vbtyp_n EQ 'Q'.

    IF sy-subrc EQ 0.

    SORT i_vbfa BY vbelv.

    DELETE ADJACENT DUPLICATES FROM i_vbfa COMPARING vbelv.

    clear tanum.

    tanum = i_vbfa-vbeln.

    SELECT lgnum tanum kquit FROM ltak

    INTO TABLE i_ltak

    FOR ALL ENTRIES IN i_vbfa

    WHERE lgnum EQ i_vbfa-lgnum

    AND *tanum EQ tanum*

    Regards,

    Sankar.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 01, 2008 at 09:17 AM

    For all entries will not allow to compare fields of different types ..

    create your internal table 'i_vbfa' as

    data : begin of i_vbfa occurs 0,

    vbelv like vbfa-vbelv

    vbeln like ltak-tanum,

    vbtyp_n like vbfa-vbtyp_n

    lgnum like vbfa-lgnum

    end of i_vbfa.

    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.