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

Error while extending MATMAS

Former Member
0 Likes
1,549

Hi,

im have extended MATMAS05 and transferring from logical system to another. From outbound side (sender) system im not getting any error however it is giving error (code 60: Invalid sysntax check) in inbound system (reciever). I have implementad the BADI BADI_MATMAS_ALE_IN with the following piece of code:

DATA:MARAM TYPE E1MARAM,

FS_MARA TYPE MARA,

WA_DATA TYPE EDIDD,

ZMAT1 TYPE ZEHS.

LOOP AT IDOC_DATA INTO WA_DATA.

CASE WA_DATA-SEGNAM.

WHEN 'E1MARA1M'.

MARAM = WA_DATA-SDATA.

WHEN 'ZMAT01'.

ZMAT1 = WA_DATA-SDATA.

SELECT SINGLE *

FROM MARA

INTO FS_MARA

WHERE MATNR = MARAM-MATNR.

IF SY-SUBRC EQ 0.

UPDATE MARA

SET ZEHS_COMPLIANT = ZMAT1-ZEHS_COMPLIANT

WHERE MATNR = MARAM-MATNR.

ENDIF.

ENDCASE.

ENDLOOP.

Please have a look and let me know if anything wrong from coding side. Also, please let me know how to debug inbound (posting) program.

Rgds

Sudhanshu

13 REPLIES 13
Read only

Former Member
0 Likes
1,424

Hi,

You can find out by debugging inbound function module for IDOC.

In WE20 Partner profiles get the logical system name from which your sending data and in receiving system click on message type inbound parameters.You can see a process code assigned to it.

Click on the process code and you will see FM assigned to it.Put a breakpoint in the FM and in your code.It will stop at that point.

Regards,

Subhashini

Read only

0 Likes
1,424

Hi,

That's fine anout inbound FM. My Q. is how to do we debug that? Im sending a material from client 800 to client 810 (via BD10). If everything goes fine material will be posted correctly in 810. In such case even if I put break point in inbound FM (IDOC_INPUT_MATMAS01) how would i debug that. Please clarify if im not correct in this.

Rgds

Sudhanshu

Read only

0 Likes
1,424

Hi,

Ok I got it.You can debug that using Transaction WE19.Give your IDOC Number and execute then click on button Inbound Function Module and check the checkbox call in debugging mode in foreground and check where the error is coming.

Regards,

Subhashini

Read only

0 Likes
1,424

Hi,

It was really helpful to me in this process. however im still stuckin with the BADI (mentioned above) that im using at inbound. WE02 of recieving system showing data in segments correctly however corresponding table (MARA) not being updated. While debugging i found that till this BADI data(new material) has not been inserted into the table and since im using UPDATE stmt. it is not finding any record in MARA. I actually need to add this extra segment once posting program been inserted the material in MARA (after that my BADI/EXIT can modify/update the table based on MATNR). Any suggestion for it.

Rgds

Sudhanshu

Read only

0 Likes
1,424

hI,

Instead of update use modify statement and see..

Regards,

Nagaraj

Read only

0 Likes
1,424

Hi,

Problem with MODIFY is that if no record found in table it will insert it and that i should not do by myself specially when standard FM has this functionality.

Rgds

Sudhanshu

Read only

0 Likes
1,424

hI,

I feel that you should modify the idoc data and remove the update statement. as the updation is taking care by standard SAP.. what ever the idoc data is there it will go to the corresponding tables...

i would suggest modfiy the idoc data with the data you want .

Regards,

Nagaraj

Read only

0 Likes
1,424

Hi,

Updation can not be taken care of standard SAP as i have extended the Idoc with additional fields and standard SAP posting pgm will work only for standard (or existing) fields. I must write either UPDATE or CALL TRANACTION for this but this would be done only after Idoc creation. please put any comment/

Rgds

Sudhanshu

Read only

0 Likes
1,424

Hi,

Do not use the update statement to update the database table as it will be taken care by standard SAP for even your new segments.

There will be some internal table which will directly update the database.Identify a user exit in debugging where you can directly write your code.You just fill your IDOC segment which you added and append that segment to the internal table which will directly update the dayabase.

Just try finding out if a user exit exists and see if your BADI is implemented in the correct place.

Regards,

Subhashini

Read only

0 Likes
1,424

Hi,

without using any FM or direct sql stmt. how can it insert/update the database. are you talking about persistent classes concept. please let me know.

rgds

sudhanshu

Read only

0 Likes
1,424

Hi Friend ,

Please see this SDN Link for the same they have solved the problem.

See Mr.ajay rao answer in the last .

Link :[;

Regards

Read only

0 Likes
1,424

Hi suda

DATA:
  maram   TYPE e1maram,
  fs_mara TYPE mara,
  wa_data TYPE edidd,
  zmat1   TYPE zehs.

LOOP AT idoc_data INTO wa_data.
  CASE wa_data-segnam.
    WHEN 'E1MARA1M'.
      maram = wa_data-sdata.

    WHEN 'ZMAT01'.
      zmat1 = wa_data-sdata.
      SELECT SINGLE *
      FROM mara
      INTO fs_mara
      WHERE matnr = maram-matnr.
      IF sy-subrc EQ 0.
        UPDATE mara
        SET zehs_compliant = zmat1-zehs_compliant
        WHERE matnr = maram-matnr.
      ENDIF.
  ENDCASE.
ENDLOOP.

Please learn first how to post code.

Then please do not expect any serious help on direct update of standard SAP tables. As already mentioned, changes of SAP standard tables can be done by standard SAP processes: It is just too much that has to be done, i.e. locking, follow-up-processes, change documents and so on.

IDOC processing should be handled by professionals. Professionals will never have the idea of a direct update of MARA - except they are quacksalvers in a quality check free environment.

Regards,

Clemens

Read only

0 Likes
1,424

Hi Cle,

im very well aware of senstivity of direct update on standard objects. I already got some useful comment by other blogger and moving towards a perfect solution. My concern was not around update or insert (INSERT would be more dangerous) but for the process that can be taken care by SAP itself (to avoid any insert/update). Since working on my Ides so don't want to make any further changes other than table.

rgds

sudhanshu