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

Problem converting MATNR in < Script - to Program - bak to Script >

Former Member
0 Likes
1,180

Hi,

I am currently working on a SAP Scritp for creating Transfer Orders (PS/WM modules).

In my scirpt, I have a Perform statement as follows u2013

PERFORM GET_WEMPFABLAD IN PROGRAM ZGETFORM

USING &LTAP-MATNR&

CHANGING &BGRP& .

In the Program ZGETFORM, the subroutine GET_WEMPFABLAD

> imports my LTAP-MATNR from the script,

> uses it for performing some Select queries,

> fetches another MATNR and sends it back to the script.

Iu2019m not sure in what format the MATNR is received in my program. I assume it comes with the u201Cdot-dashu201D format as u2013 000.0000.0000-00 (as in MARA table).

So Iu2019m doing an internal conversion using CONVERSION_EXIT_MATN1_INPUT and I get a 18 digit Material No. This MATNR Iu2019m using in certain Select queries and fetching another MATNR (which happens to be my Assembly no. for a Network). This Assembly no is also a MATNR and I need to send it back to my scipt.

So Iu2019m doing an external conversion using - CONVERSION_EXIT_MATN1_OUTPUT. The output also needs to be in the format u2013 000.0000.0000-00.

But the material no is not displayed on my script. Is there something else I need to take care of? Am I on the right track?

[ Note: ZGETFORM is not my driver program... ]

Thanks in advance,

Lakshmi

6 REPLIES 6
Read only

Former Member
0 Likes
1,003

Hi;

Remove CONVERSION_EXIT_MATN1_OUTPUT, and try.

Regards

Shashi

Read only

Former Member
0 Likes
1,003

First of all put break poiint in include and check if your code is working fine, then put break point in Sap script and debug after the Perform are you getting the value back to Script from include. Check the type BGRP.

Read only

Former Member
0 Likes
1,003

Hi Lakshmi

Debug and see if the value of the assembly number is coming correct after CONVERSION_EXIT_MATN1_OUTPUT is called.

Pushpraj

Read only

Former Member
0 Likes
1,003

Hi Lakshmi,

As far as I see you are passing the MATNR as an Importing (USING) parameter.

In order to reflect the new value of matnr you should pass MATNR as CHANGING parameter to the subroutine.

{PERFORM GET_WEMPFABLAD IN PROGRAM ZGETFORM}

{USING &LTAP-MATNR&}

{CHANGING &BGRP& .}

In which field are you returning the MATNR value back to Script?

Regards,

Prakash Pandey

Edited by: Prakash Pandey on Feb 24, 2009 6:55 AM

Read only

0 Likes
1,003

Hi,

While using Subroutines in Scripts the using and changing parameters of stucture ITCSY.

In your Subroutine Pool Program read the values of field name and value.

sample code as follows.

FORM sub_dtls TABLES in_par STRUCTURE itcsy

out_par STRUCTURE itcsy.

*Reading input material from layout.

READ TABLE in_par WITH KEY 'EKPO-EMATN'.

IF sy-subrc = 0.

wc_matr = in_par-value.

ENDIF.

Endform.

Write the logic as above .

Your problem will be solved.

Best Regards,

Surendar Reddy.

Read only

Former Member
0 Likes
1,003

Hi,

I have tried out all the following tricks -

1) P_matnr = in_tab-value.

out_tab-value = P_matnr.

Just to determine if my script can display the LTAP_MATNR atleast...& also to check in wat format the MATNR is obtained from the Script to Prog. It is in "dot-dash" format only.

2) P_matnr = in_tab-value.

PERFORM Internal conversion on P_MATNR.

Use in queries. Get new MATNR --> V_MATNR.

PERFORM External conversion on new V_MATNR. Pass bak to script.

3) P_matnr = in_tab-value.

PERFORM Internal conversion on P_MATNR.

Use in queries. Get new MATNR --> V_MATNR. Pass bak to script.

{ Donot PERFORM External conversion on new V_MATNR. }

None of the above has worked so far...

I cannot debug the script or the Zprog coz its internally getting called by a chain of programs, I'm only allowed to ched the print output in Spool.

Execution details:

When I run a Z transaction, i get a list of materials(ALV) for which i can create a TO. When i click on a particular record, the Transfer Order (TO) is created in background and in SPOOL i can see my script. That's it

Rgds,

Lakshmi