Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP QUERY

Former Member
0 Likes
2,017

HI ,

I have created a  SAP query in sq02 and created  2 extra fields.

first extra field

Materialnumber (coding as below )

Move PRPS-USR01 to MaterialNumber .

and second field I have  below coding

CLEAR :EXTERNALMATERIALGROUP.

SELECT single EXTWG

into EXTERNALMATERIALGROUP

from MARA

where ISMREFMDPRFAM = PRPS-USR00

AND MATNR = MATERIALNUMBER.( my first extra field )

now when I create sq01 query .my first field is populated with material number but second field is BLANK .

any idea WHY

Its quite URGENT . PLEASE help us .

Many Thanks

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,881

Hi Preeti,

Is the data present in MARA against the selection criteria?

What's the data type of MATERIALNUMBER? It should be same as of MATNR.

Can you try to debug the code and check?

Thanks

Amit

11 REPLIES 11
Read only

Former Member
0 Likes
1,881

The most obvious reason is that the select was empty.  Put a break point in the code and find out what it returned.

Neal

Read only

Former Member
0 Likes
1,882

Hi Preeti,

Is the data present in MARA against the selection criteria?

What's the data type of MATERIALNUMBER? It should be same as of MATNR.

Can you try to debug the code and check?

Thanks

Amit

Read only

0 Likes
1,881

Hi amit .

There is lots of data in MARA table .I am getting at materialnumber but externalmaterial not getting .

screen shot .

can you please tell me how to debug this code .

Read only

0 Likes
1,881

Hi Preeti,

As said Neal you can put a break point in the code after  your "select".

SELECT single EXTWG

.........................

AND MATNR = MATERIALNUMBER.

BREAK-POINT.

Regards

Read only

0 Likes
1,881

Break-point does not work in all systems.

Last i checked,

Break <user name>.

Still did.

If that doesn't work, the query generates ABAP code.  Your select will be literally in that code. You can find it that way and put it in via debugger / se38 methods.

Neal

Read only

0 Likes
1,881

hi

i did put break point and got the below screen shot .

there i can see 2 values are coming for variables but Material group is blank.

now what should I do . I am new in ABAP .

Read only

0 Likes
1,881

There looks to be an issue with your 'where' clause.  Table 'MARA' does not have a field ISMREFMDPRFAM.

Read only

0 Likes
1,881

The sy-subrc = 4 means that your select could not find a match.  The most likely cause of this is that your material number must be 18 characters long with leading zeros for your select to work.  Use the same conversion exit the it's domain uses before calling the select.

Neal

Read only

0 Likes
1,881

Could you please explain in detail how it can be that  " Break-point does not work "

but the macro " Break <user name> " which based on statement " Break-point "

still do.

Boris

Read only

0 Likes
1,881

I will give your example of code.

DATA: materialnumber           TYPE char18,
             externalmaterialgroup TYPE mara-extwg.

CLEAR :externalmaterialgroup.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
    EXPORTING
      input        = materialnumber
    IMPORTING
      output       = materialnumber
    EXCEPTIONS
      length_error = 1
      OTHERS       = 2.


SELECT single EXTWG

.........................

Regards

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,881

First execute SE11 and look for domain of

  • PRPS-USR01 : no conversion exit
  • MARA-MATNR : a conversion-exit, e.g. MATN1 (or ALPHA, depends on actual SAP solution/version implemented)

So before moving value from first to second field you must convert from external to internal format with CONVERSION_EXIT_MATN1_INPUT.

Nb: If there were no exit a simple MOVE would have been enough, with  two different exits two conversions would have been required. field1 internal.->external , field 2 external->internal. with same exit and different length a conversion may also be required; e.g. more leading zeroes required if target field is longer with ALPHA conv. exit.

Regards,

Raymond