Skip to Content
avatar image
Former Member

How to EDIT Incoming Idoc Data in Processing Function Module

Hello Team,

We have an issue while editing Idoc data in SAP system.

We are getting materials from another system via MATMAS idoc and in SAP we have configured internal number range for material master creation for the particular material type.

When Idoc comes into the system we are calling FM BAPI_MATERIAL_GETINTNUMBER to get next available material number from number range and adding this number to Idoc MATNR field.

This logic processing the idocs successfully but when I check the data into idoc the field MATNR doesn't have any value.

Please let me know how we can overcome this issue?

I have taken reference from below thread:

https://archive.sap.com/discussions/thread/1954090

Thanks & Regards,

Piyush

Add comment
10|10000 characters needed characters exceeded

  • Is it really so much an issue of not having the new material number stored back into the IDoc segment? As a workaround, would it be sufficient to add a message to the IDoc, to indicate that the material number was replaced with the new number?

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 21, 2017 at 06:52 AM

    Sorry for replying very late to this thread, but I found the way to tackle this situation.

    There is FM BAPI_MATERIAL_GETINTNUMBER which fetches the next available number from number range.

    I just cross checked this logic by calling above FM in LSMW.

    LSMW Step: Maintain Field Mapping and Conversion Rules

    For MATNR field I have written a small piece of code which gets the next available number and insert this into idoc MATNR field.

    DATA :LS_MATNR TYPE BAPIMATINR.
    DATA: LT_MATNR TYPE TABLE OF BAPIMATINR.
    if ERSA_SOURCE-MATNR is initial.
    CALL FUNCTION 'BAPI_MATERIAL_GETINTNUMBER'
      EXPORTING
        MATERIAL_TYPE          = ERSA_SOURCE-MTART
       INDUSTRY_SECTOR        = 'C'
       REQUIRED_NUMBERS       = 1
      TABLES
    MATERIAL_NUMBER        = LT_MATNR.
    READ TABLE LT_MATNR INTO LS_MATNR INDEX 1.
    E1MARAM-MATNR = LS_MATNR.
    endif.
    

    Thanks!!!

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 31, 2017 at 12:31 PM

    i guess you are missing commit statement somewhere in the program

    Add comment
    10|10000 characters needed characters exceeded