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

BAPI

Former Member
0 Likes
603

hello gurus

i am creating a bapi with input as MATNR

and export paramater as

MATNR MATKL MTART BISMT MEINS

ZEINR GROES NORMT WRKST LVORM

MAKTX EKGRP KAUTB

THis is the code for the bapi i have created

FUNCTION zorg_eigen_medicatie_read.

*"----

-


""Local Interface:

*" IMPORTING

*" VALUE(MATNR) LIKE MARA-MATNR

*" EXPORTING

*" VALUE(MATNR) LIKE MARA-MATNR

*" VALUE(MATKL) LIKE MARA-MATKL

*" VALUE(MTART) LIKE MARA-MTART

*" VALUE(BISMT) LIKE MARA-BISMT

*" VALUE(MEINS) LIKE MARA-MEINS

*" VALUE(ZEINR) LIKE MARA-ZEINR

*" VALUE(GROES) LIKE MARA-GROES

*" VALUE(NORMT) LIKE MARA-NORMT

*" VALUE(WRKST) LIKE MARA-WRKST

*" VALUE(LVORM) LIKE MARA-LVORM

*" VALUE(MAKTX) LIKE MAKT-MAKTX

*" VALUE(EKGRP) LIKE MARC-EKGRP

*" VALUE(KAUTB) LIKE MARC-KAUTB

*" VALUE(WERKS) LIKE MARC-WERKS

*" VALUE(RETURN) LIKE BAPIRETURN1 STRUCTURE BAPIRETURN1

*"----

-


DATA: v_matnr LIKE mara-matnr,

v_maktx like makt-maktx,

v_ekgrp like marc-ekgrp,

v_kautb like marc-kautb,

v_werks like marc-werks.

select single matnr matkl mtart bismt meins zeinr groes normt wrkst lvorm

from mara into (matnr,matkl,mtart,bismt,meins,zeinr,groes,normt,wrkst,lvorm)

where matnr = matnr.

IF sy-subrc EQ '0'.

matnr = mara-matnr.

MATKL = mara-MATKL.

mtart = mara-mtart.

bismt = mara-bismt.

meins = mara-meins.

zeinr = mara-zeinr.

groes = mara-groes.

normt = mara-normt.

wrkst = mara-wrkst.

lvorm = mara-lvorm.

ELSE.

return-number = 0.

return-type = 'E'.

return-id = 'Z1'.

return-message = 'Material not found'.

return-message_v1 = ''.

return-message_v2 = ''.

return-message_v3 = ''.

return-message_v4 = sy-mandt.

ENDIF.

select single maktx from makt into v_maktx

where matnr = matnr.

if sy-subrc eq 0.

maktx = v_maktx.

endif.

select single ekgrp kautb  werks into (v_ekgrp v_kautb v_werks)

from marc

where matnr = matnr.

if sy-subrc eq 0

endif.

ENDFUNCTION.

it shows error

Unknown column name "KAUTB ". not determined until runtime, you cannot

specify a field list.

Please correct the code for me

thanx in advance

senthil

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
520

hi all

please correct the code for me i am new to ABAP

i know the code ihad made was not correct

Thnak n advance

senthil

5 REPLIES 5
Read only

Former Member
0 Likes
521

hi all

please correct the code for me i am new to ABAP

i know the code ihad made was not correct

Thnak n advance

senthil

Read only

0 Likes
520

Hi Senthil,

I tried this and it works for me:

SELECT SINGLE ekgrp kautb werks INTO (v_ekgrp,v_kautb,v_werks)

FROM marc

WHERE matnr = matnr.

change the select and see if this works.

reward points if helpful.

Read only

0 Likes
520

Hi,

In select statement remove the brackets and put the commas in between...

the strings parameters..

Regards,

Sachi

Read only

0 Likes
520

thanks for all your help

problem solved

senthil

Read only

Former Member
0 Likes
520

hi

in the select statement of MARC, you have missed the commas.

pls put commas in between the fields (v_ekgrp v_kautb v_werks) and then chk

i hope it works

thanks

pavan