SAP for Utilities Discussions
Connect with fellow SAP users to share best practices, troubleshoot challenges, and collaborate on building a sustainable energy future. Join the discussion.
cancel
Showing results for 
Search instead for 
Did you mean: 

Quick question on query.

Former Member
0 Kudos

Hello everyone,

Since I am currently working on utilities, well, I post here, since I don't know where else to post.

EDIT: I'm currently new to this website and new to the ABAP World.

My Current spec is:

Using the contract account from FKKMAKO-VKONT, search EDISCDOC-REFOBJKEY where the first 12 characters are from FKKMAKO-VKONT.

Is it possible to do it within the query statement:

 SELECT SINGLE STATUS
             FROM EDISCDOC
             INTO v_status
             WHERE REFOBJKEY(12) = I_FKKMAKO-VKONT. 

Now, I know this is not possible, but I tried it anyways.

Any tips on how I can do this, or should I just simply search the table, and then LOOP comparing the results?

Thanks in advance.

Edited by: jotorres1 on Nov 18, 2009 6:48 PM

1 REPLY 1

Former Member
0 Kudos

Fine, I'll answer my own question.

After thinking a bit, and asking around, I remembered that in SQL you can do searches with LIKE. I didn't know that worked here in ABAP, but apparently it does.

Here's how:


          DATA: v_status TYPE EDISCDOC-STATUS,
                v_temp_refobjkey TYPE EDISCDOC-REFOBJKEY,
                v_temp_refobjkey2 TYPE EDISCDOC-REFOBJKEY.
          DATA: BEGIN OF wa_status OCCURS 0,
            status TYPE EDISCDOC-STATUS,
            refobjkey TYPE EDISCDOC-REFOBJKEY,
            END OF wa_status.

          CONCATENATE I_FKKMAKO-VKONT '%' INTO v_temp_refobjkey2.

          SELECT STATUS REFOBJKEY
            FROM EDISCDOC
            INTO CORRESPONDING FIELDS OF TABLE wa_status
            WHERE EDISCDOC~REFOBJKEY LIKE   v_temp_refobjkey2 .

Question answered, thank you.