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

Function Module not displaying Data

ramco1917
Participant
0 Likes
1,056

Hi

I have below Program but it does not display any data . Function Module display record.

In Parameter i am entering 000000000000000038

REPORT  ZABAP_GETMATERIALDETAILS.

data : wa_mara type mara.
PARAMETERS : p_matnr type mara-matnr.
CALL FUNCTION 'ZABAP_GETMATERIALDETAILS'
  EXPORTING
    IM_MATNR       = p_matnr
* IMPORTING
*   EX_MARA        = wa_mara
.

Write : SY-SUBRC.
IF SY-SUBRC = 0.
* Implement suitable error handling here
 WRITE : WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MEINS, WA_MARA-MBRSH .
ENDIF.
FUNCTION ZABAP_GETMATERIALDETAILS.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(IM_MATNR) TYPE  MARA-MATNR
*"  EXPORTING
*"     REFERENCE(EX_MARA) TYPE  MARA
*"----------------------------------------------------------------------

SELECT SINGLE * FROM MARA
       INTO EX_MARA
       WHERE MATNR = IM_MATNR.

ENDFUNCTION.

Thanks

1 ACCEPTED SOLUTION
Read only

MateuszAdamus
Active Contributor
902

Hello ramco_1917

You're not receiving any data back, because the IMPORTING part is commented out.

It is responsible for receiving data from the function.

Kind regards,
Mateusz
2 REPLIES 2
Read only

abo
Active Contributor
902

It works better if you import the values

Read only

MateuszAdamus
Active Contributor
903

Hello ramco_1917

You're not receiving any data back, because the IMPORTING part is commented out.

It is responsible for receiving data from the function.

Kind regards,
Mateusz