cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in SELECT statement

Former Member
0 Kudos

When I write:

SELECT GUID PROJECT_ID

into corresponding fields of table itab

from DPR_PROJECT.

It returns a 32-char GUID code instead of a 24-char GUID! The first 24 chars are the correct GUID. But the additional last 8 chars should not be there.

When I try to use a 24-char data-element instead of the std data element, it throws a dump saying that the source and target fields are incompatible.

Can anyone help?

Thanks

Prasad

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Since this is a rfc when you get the data in the front end you would get all the 32 characters.

Use CONVERSION_EXIT_ALPHA_OUTPUT to get 24 characters.

Regards,

Lalit Mohan Gupta.

Former Member
0 Kudos

Hi Lalit,

Thanks for the input.

Calling the exit in the FM throws a dump when the exit is called - Type conflict when calling a function module

The code i as under. Can you help to identify the problem?

  loop at itab.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
        INPUT  = itab-GUID
      IMPORTING
        OUTPUT = itab-GUID.

    modify itab.
  endloop.

Former Member
0 Kudos

hi,

The data type of GUID is RAW which stores the data in Hexa format. If the length of the GUID is 16 then if can store upto 32 char in GUID field which are Hexa format.

When i executed the code in my system t is working properly.

Former Member
0 Kudos

>

> When i executed the code in my system t is working properly.

Hi Avinash,

Can you tell me how you have declared itab?

-


I have created a structure (ZBAPI_PROJECTID_PROJECTNAME) which has 3 fields:

GUID (Component type: DPR_TV_ENTITY_GUID)

PROJECT_ID (type: DPR_TV_PROJECT_ID)

TEXT1 (type: CGPL_TEXT1)

The code is below:


*Declarations
  DATA itab TYPE ZBAPI_PROJECTID_PROJECTNAME occurs 0 with header line.

*Get all project ids
  SELECT GUID PROJECT_ID
    into corresponding fields of table itab
    from DPR_PROJECT.

*Convert GUID to 24-char
  loop at itab.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
        INPUT  = itab-GUID
      IMPORTING
        OUTPUT = itab-GUID.

    modify itab.
  endloop.

-


Hope this is right.

Former Member
0 Kudos

did u try using CONVERSION_EXIT_DPRCE_OUTPUT

Former Member
0 Kudos

>

> did u try using CONVERSION_EXIT_DPRCE_OUTPUT

Hi TT,

Yes, it returns the value of project_id when i pass the value of GUID.

It does not return the 24-char GUID.

Do you have any idea why CONVERSION_EXIT_ALPHA_OUTPUT is throwing a dump "Type conflict when calling a function module"

Details are in the previous post.

Thanks

Prasad

Former Member
0 Kudos

HI,

Check this code..

Declaration of ZBAPI_PROJECTID_PROJECTNAME structure 
GUID	Data element DPR_TV_ENTITY_GUID
PROJECT_ID	Data element TYPE DPR_TV_PROJECT_ID
TEXT1	Data element CGPL_TEXT1

*"----------------------------------------------------------------------
*"*"Local Interface:
*"  TABLES
*"      ZTAB STRUCTURE  ZBAPI_PROJECTID_PROJECTNAME
*"----------------------------------------------------------------------
  DATA itab TYPE zbapi_projectid_projectname OCCURS 0 WITH HEADER LINE.

  SELECT guid project_id
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM dpr_project.

*Get all project names
  LOOP AT itab.

    SELECT text1
      INTO itab-text1
      FROM cgpl_text WHERE guid EQ itab-guid.
    ENDSELECT.

    MODIFY itab.

  ENDLOOP.

  ztab[] = itab[].

Former Member
0 Kudos

Hi Avinash,

Yes, problem has been resolved now.

Surprisingly the code is the same which I had originally written!!! I wonder what went wrong back then.

I am getting the project id and project desc as reqd.

I am not getting the GUID as reqd. But I will open a new ticket for it later if the need arises for it.

Anyways, thanks for your help.

Regards

Prasad

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Prasad,

Be careful, GUID is in cProjects use a conversion exit. Please check your user settings, that could explain why you display a 24 character value instead of 32.

Remind that the value recorded in the system withtout any conversion routine is 32 character long.

Matthias

Former Member
0 Kudos

Hi...

what you are getting is the input format of GUID...to convert it to the external(24) format......

use FM CONVERSION_EXIT_DPRCE_OUTPUT

Former Member
0 Kudos

what is the type in the table from where you are fetching use the same data element.

check for the data in the table, is it 24 character or 32 character and then compare.

please post the complete code so that we can check .

Regards,

Lalit Mohan Gupta.

Former Member
0 Kudos

Hi Prasad ,

Guid type should be standard means "DPR_PROJECT-GUID" typed.

I have tryed your select query , but I am getting expected result means GUID values are coming with 24 length . The code is as follows -


DATA : itab LIKE TABLE OF dpr_project ,
       fs_tab LIKE dpr_project .
SELECT guid project_id
INTO CORRESPONDING FIELDS OF TABLE itab
FROM dpr_project.

LOOP AT itab INTO fs_tab.
  WRITE : / fs_tab-guid.
ENDLOOP.

Please check it again .If after that also your query is not working then please write the code Vividly.

Regards

Pinaki

Former Member
0 Kudos

Hi Avinash / Pinaki,

Thanks for your prompt response.

I am creating an RFC function module which returns all project_id and corr. project_name to the calling app.

Tables are: DPR_Project and CGPL_TEXT

GUID is the key field for both.

I have created a structure (ZBAPI_PROJECTID_PROJECTNAME) which has 3 fields:

GUID (Component type: DPR_TV_ENTITY_GUID)

PROJECT_ID (type: DPR_TV_PROJECT_ID)

TEXT1 (type: CGPL_TEXT1)

The code is as follows:

FUNCTION ZBAPI_LOAD_PROJECTS.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  TABLES
*"      ZTAB STRUCTURE  ZBAPI_PROJECTID_PROJECTNAME OPTIONAL
*"----------------------------------------------------------------------

*Declarations
  DATA itab TYPE ZBAPI_PROJECTID_PROJECTNAME occurs 0 with header line.

*Get all project ids
  SELECT GUID PROJECT_ID
    into corresponding fields of table itab
    from DPR_PROJECT.

*Get all project names
  loop at itab.

    select TEXT1
      into itab-TEXT1
      from CGPL_TEXT where GUID EQ itab-GUID.
    endselect.

    modify itab.

  endloop.

  ZTAB = itab.

ENDFUNCTION.

Please excuse if the code is basic as I am not into ABAP.

If you guys can helpout, it would be great.

@ Avinash

You can see that the data type has a conversion exit...I think thats the culprit.

Former Member
0 Kudos

HI,


Instead of this   ZTAB = itab.
Add this ZTAB[] = itab[].

Former Member
0 Kudos

Hi,

The GUID and PROJECT_ID fields in the internal table are declared with same as used in the DPR_PROJECT. IF not please change to the same type

GUID TYPE  DPR_PROJECT-GUID
PROJECT_ID TYPE  DPR_PROJECT-PROJECT_ID

The length of the GUID & PROJECT_ID is 16 and 24 in the table DPR_PROJECT. How come it is returning 32 ?