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

Former Member
0 Likes
405

hi all,

function module needed.

Based on material,plant & sales organization inputs i want ouput to be displayed as P.O text and vendor number.

thanks & regards

warun

4 REPLIES 4
Read only

Former Member
0 Likes
376

there is no FM as such...U need to write a program in SE38 where u can select required data using where conditions....

Read only

Former Member
0 Likes
376

You need to write custom code for this need.

Read only

Former Member
0 Likes
376

Hi Try with this code,

REPORT zmm_temp1 No standard page heading.

DATA: v_matnr TYPE matnr VALUE '10000023',

v_plant TYPE werks VALUE '131C',

v_vkorg TYPE vkorg VALUE '1000'.

DATA: it_lifnr TYPE TABLE OF lifnr,

it_text TYPE TABLE OF tline,

x_text TYPE tline,

x_lifnr TYPE lifnr.

DATA: v_name TYPE thead-tdid,

v_mat TYPE thead-tdname VALUE 'BEST',

v_obj TYPE thead-tdobject VALUE 'MATERIAL'.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

input = v_matnr

IMPORTING

output = v_matnr.

FORMAT COLOR 6.

SELECT lifnr FROM lfa1 INTO TABLE it_lifnr WHERE werks = v_plant.

IF sy-subrc <> 0.

WRITE /: 'No Vendor Found'.

ENDIF.

SELECT SINGLE matnr FROM marc INTO v_matnr WHERE matnr = v_matnr AND

werks = v_plant.

IF sy-subrc <> 0.

WRITE : /'No Such Plant ', v_plant, ' Exist for the Material', v_matnr.

ENDIF.

SELECT SINGLE vkorg FROM mvke INTO v_vkorg WHERE matnr = v_matnr AND

vkorg = v_vkorg.

IF sy-subrc <> 0.

WRITE : /'No Such Sales Org ', v_vkorg, ' Exist for the Material', v_matnr.

ENDIF.

FORMAT COLOR OFF.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

input = v_matnr

IMPORTING

output = v_matnr.

v_mat = v_matnr.

IF v_matnr IS NOT INITIAL.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = v_name

language = sy-langu

name = v_mat

object = v_obj

TABLES

lines = it_text

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

IF sy-subrc <> 0.

  • MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

  • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDIF.

SKIP 3.

WRITE : /'Material ', v_matnr,

/'Sales ORG ', v_vkorg,

/'Plant ', v_plant.

Skip 2.

WRITE /: 'PO Text'.

IF it_text[] IS NOT INITIAL.

LOOP AT it_text INTO x_text.

WRITE /: x_text.

ENDLOOP.

ELSE.

WRITE /: 'No P.O. text is found'.

ENDIF.

Skip 2.

WRITE /: 'Vendor List'.

IF it_lifnr[] IS NOT INITIAL.

LOOP AT it_lifnr INTO x_lifnr.

WRITE /: x_lifnr.

ENDLOOP.

ELSE.

WRITE /: 'No Vendor is found'.

ENDIF.

Regards,

Aman

Read only

amit_khare
Active Contributor
0 Likes
376

Hi,

Check this BAPI.

BAPI_PO_GETITEMS

Regards,

Amit