NF-e sem linha de material não é cancelada/não atualiza status no ERP

Bom dia!
Estou com o seguinte cenário.
O usuário criou uma NF-e manualmente via J1B1N e enviou para SEFAZ. Posteriormente o mesmo solicitou o cancelamento e a NF-e foi cancelada na SEFAZ e no GRC; porém não foi possível atualizar o status no ECC.
Detalhe, consultando a NF-e no ERP a mesma não contém nenhuma linha de material! Diferentemente do documento no GRC! Ou seja, o item da nota no ERP sumiu!
Obviamente que perguntamos aos usuários como fizeram essa façanha... e a reposta não poderia ser diferente... não fizeram nada além do normal! :-p
Verificando a função J_1B_NFE_CANCEL disparada ao solicitar uma inutilização/cancelamento a mesma contém o código abaixo onde o sistema verifica se a NF-e contém registro na J_1BNFLIN e se não, retorna erro.
D O C U M E N T    P R O C E S S I N G
  CLEAR: itab, e_cancel, lv_subrc.
  CLEAR: bdcdata[], itab[], wa_bdcdata, wa_itab.
  clear: lv_sernpcount.                             "1247602
  SELECT * FROM j_1bnflin INTO ls_nflin
  WHERE docnum = i_docnum.
    EXIT.
  ENDSELECT.
  IF sy-subrc IS NOT INITIAL.
    MESSAGE e045 WITH i_docnum RAISING no_nf.
  ENDIF.
Estamos usando ECC 604 0008
Temos vários documentos criados na produção com essa situação e tentamos de diversas maneiras recriar o cenário em qualidade mas não conseguimos.
Abraço
Eduardo Chagas

Bom dia Eduardo,
Esta seria a "melhor ideia" que imagino ter linhas de itens enviadas ao GRC que não estão no ERP. Veja os campos CALLRFC nas linhas da ACTIVE e HISTORY se tem o valor 3 (numerado e transmitido pelo job).
Outras duas opções para investigação:
- BAdI com "boa memória", verifique se a codificação permitiria pegar itens de outro docnum e enviar como sendo desta.
- Deleção dos registros
No mais um chamado para investigação, mas sem o "como reproduzir" nem sei ajudaria.
Atenciosamente, Fernando Da Ró

Similar Messages

  • NF-e 10.0 Inbound - Processo de Subcontratação sem Cod. Material de Produto

    Boa noite,
    Estou implantando o processo de Subcontratação com 1 NF (SUBCON1A), mas aqui no cliente a RC é gerada pela Ordem de Produção sem Código de Material para o Produto, apenas o Componente possui código de Material. No step de Atribuição do Pedido de Compra / Item eu consigo atribuir o Produto ao Item Principal do xml, mas o componente não aparece para ser atribuído ao Retorno simbólico do XML. Parece que o GRC não reconhece a atribuição do item do Ped.Compra sem código de material ao Item principal e não traz o componente do PC para ser atribuído.
    Saberiam me dizer se o código do material do produto no Ped.Compra é obrigatorio para o processo de subcontratação no GRC ?
    Vejam as imagens abaixo :
    Note que o Main Item não possui código de Material. E a mensagem na parte de Avaliable PO Items é para atribuir primeiro o Item Principal como se o GRC não reconhecesse oa atribuição ao item pricinpal ja realizada anterormente.
    O pior é que o GRC não exibe mensagem de erro quando gravo a atribuição, apenas não exibe o componente do Ped.Compra impedindo a atribuição e a continuidade do processo.
    Vcs ja passaram por essasituação ?
    ë possível realizar a subcontratação com esse cenário ?
    Obrigado

    Oi Ramon
    A solução funciona sim quando você não tem código de material do item pai. O que você precisa ter é o número e linha do pedido de compra na linha do item pai e dos componentes. Além do registro info de subcontratação dos componentes com o código de material do seu fornecedor.
    Abraço
    Eduardo Chagas

  • Material Not getting replicated inspite of Done status in SRM

    Hi
    I am facing issues with regards to the material replication. I have made the necessary middleware settings in both R/3 and SRM side. Also I have replicated the objects DNL_CUST_BASIS3, DNL_CUST_PROD0, DNL_CUST_PROD1 and DNL_CUST_SRVMAS (in that order) successfully. However when I try to replicate the materials (no filter settings maintained) none of the materials gets replicated. The queue in R/3 and SRM doesn't show a stuck entry anywhere. In R3AM1 also the status
    is green with Done status. Sometimes 0 block gets picked up and sometimes 3.
    However when I go and check the materials in COMMPR01, I do not see any materials been replicated. There are no other logs present anywhere.
    Can someone kindly help me out in understanding the problem.
    Thanks in advance.
    Manoj

    Hello Ashutosh
    I had already checked the status in SMW01 and it shows "Confirmed (fully processed)".
    Also no queues were stuck anywhere.
    I also followed the instrauctions as explained in the blog link given by you.
    Regards
    Manoj

  • Material Description is not getting updated in IC-WebClient ERP Sales Order

    Hi Experts,
    The issue is with ERP Sales Order  in IC web client. 
    Scenerio:1
    While creating the Sales order,  If we  enter a product  in Line Item 10 , which is  mapped (Product Type)  in both the systems(CRM&ERP) . It will take the description for that product correctly. If  we enter  another product  in Line Item 20 , which is   not mapped (Product Type)  in CRM system (only available in R/3)  the description of the previous line Item product (Item 10)  inherited to Item 20 instead of taking the description of Item 20.
    Scenerio:2
    If  we enter  a product  in Line Item 10(as a first Item) , which is  not mapped (Product Type)  in CRM system (only available in R/3)  It will take the correct description for that product . And there is no problem for Second line Item, even though the Second line Item is not mapped (Product Type)  in CRM system (only available in R/3)
    Technically  speaking :The Product which is mapped in both the systems is entered as first line item , this product description is copied for all the line items below (i.e 20,30,40) which are not mapped in both the systems. As and when we entered a  mapped  product in line Item 50 , It is taking the correct description of Item 50
    Kindly advise.
    Thanks in Advance,
    Raja
    Edited by: Raja Parasa on Feb 26, 2010 5:23 AM
    Edited by: Raja Parasa on Feb 26, 2010 5:24 AM

    Hi Raja,
    This looks like a bug.
    sorry for not answering ur question.
    However, since you are using ERP sales order, i request you to look at my issue in the below thread and answer if you had similar issue.
    let me know if i can speak to you in person.
    GATP (APO)  Check results in ERP Sales order.
    thanks
    shree

  • Can I create material reservations on setting of particular user status?

    I know that Reservation creation can be kept on hold by choosing Never/Create on release etc at operation level. My requirement is , At release of work order - reservation should not be created and on setting of certain user status reservation should be created!

    I think, its not possible in Standard.
    You can try with some development.
    You can create 2 user statuses i.e., one is for normal & another one is for reservation creation. Give the authorization to change from 1st status to 2nd status only to some authorized people through Authorization group concept.
    Keep "Never" as default option in PR / Reservation creation for your desired plant & order type combination.
    Once you change the user status, while saving the order, check the current user status & change it to "From Release" at order level for all operations & materials.

  • Configurable material cost estimate

    Hi All,
    We have lot of configurable materials and some are finished materials and some are semi-finished.
    If semi-finished configurable material used in Finished materials, Semi-finished configurable material costs is not roll up correctly for Finished material.
    Only labor costs are rolling up and material costs not rolling up
    Valuation variants material price is:valuation according to price control.
    any help is appreciated...
    Thanks,
    Anusha

    Hi,
    In OKTZ have you tick on Roll up cost component  against the Cost component of  material .
    This indicator determines whether the costing results of a cost component are rolled up into the next-highest
    Regards,
    Shayam
    Edited by: Shayam_210 on Sep 29, 2011 6:40 AM

  • Creating delivery notes for providing material to vendor (subcontracting)

    Hi,
    I am pretty new in the PP module of SAP, and have a general question regarding the subcontracting process for single operations in a production order.
    Assuming the raw material has id A and the final material has id B. My routing consists of several operations that have to be performed to transform A into B. One of the operations has to be done with subcontracting (key PP02), and the system creates the purchase requisition / purchase order for it. I have operations before and after it. 
    Now I need to send the parts to the vendor, and want to create some kind of delivery notes (paper), which helps controlling the shipping etc., how can I do this? All I have right now is the purchase order, which does not contain any information about the material, but only about the service to be performed by the vendor.
    I already thought about assigning a bom for providing material in the purchase order. But then I would need a material ID for the semi-final part which is somewhere between A and B and would need to have it on stock.
    What is the standard way of doing this?
    Thanks in advance!
    Kind regards!
    Daniel

    Hi Nandha!
    Thanks for your quick response.
    If I check the "Subcontracting" button on the tab Ext. processing in the production order, I need to assign components in the purchase order which will be provided to the vendor. These components either have to be on stock, or would be processed by MRP and planned orders would be created. That is not what I need.
    I have only one single part which consists of a raw material and only gets modified by the operations. No other component will be added at the vendor. So which material ID should I assign to the purchase order in order to just send the semi-finished pieces to the vendor? I cannot assign the raw-material again, because it would create another demand in the MRP again! I also cannot put the semi-finished parts on stock, because I don't have a material id for the part in this status.
    Thanks & regards!
    Daniel

  • Problem in material selection in bom

    Hi,
    we have finish material A,semi finish B, raw material C1,C2,C3.
    we have created material BOM for semi finish B.
    material      usage      alternative BOM          component.
    B                  1                    1                             C1, C2.
    B                  1                    2                                C3.
    I created bom for finish material A using semi finish B mentioning alternative bom 2. it is not picking the component which is there in alternative BOM 2  i.e. C3.
    in cs11, it is showing only C1, C2.
    Can you solve this. it's very urgent.
    thanks/regards
    vish

    Dear Vishwanath,
    For Product B ,while checking in CS11,in the input parameters,after entering the material ,plant , enter alternative BOM value as 02
    and then application - PP01 and check the output that you are getting.You can see C3 been displayed.
    For Product B maintain 2 production version's with different Lot size say production version 1 with BOM alternative 1 with C1 & C2 for
    Lot size range 1 to 100. and let the production version 2 be with BOM alternative 2 with C3 for lot size range 101 to 500.and the BOM
    Selection method in MRP4 view should be 2 for product B,now create a planned order for B for LA type first for a quantity of 10 and
    then for a quantity of 200,check which BOM the system is picking.
    Doing the configuration settings in OPPQ - at plant level for BOM selection ID and routing selection id affectes all the materials.
    So check with the solution which I have given and revert back in case of any more help.
    Regards
    Mangalraj.S

  • Std cost esimating for semi finshed meterials

    hi co experts
    i am facing this problem at the time of estimating std cost for semi finshed meterial
    pls see this problem and tell me the solutions
    No price could be determined for material/batch 7000118/ plant PPP1
    Message no. CK465
    Diagnosis
    The system could not calculate a price for material/batch 7000118/ in plant PPP1 for valuation view 0, because none of the valuation strategies in valuation variant Z02 was successful.
    System Response
    User-defined error management enables you to specify whether the message is an error message, a warning message or an information message.
    If you have defined the message as a warning message or an information message, the costing item will be entered in the cost estimate with a value of zero.
    If you have defined the message as an error message, the cost estimate contains an error or errors.
    In the case of a material cost estimate, the system sets the status KF.
    If it is a cost estimate without quantity structure, or base object cost estimate (that is, a unit cost estimate),  the system cannot proceed with costing until you have corrected the errors.
    If the system issues a termination message, the cost estimate cannot be processed, and processing is terminated.
    Procedure
    Check the master data for material/batch 7000118/ in plant PPP1.
    If you have authorization for Customizing, check the valuation strategy for materials in valuation variant Z02.
    Note
    If the message is a warning message or an information message, there is a danger that materials with errors will be ignored by the system.
    If, because of this, you issue a warning message and at the same time include materials with a zero value in cost estimates, you can make the following settings for these materials in the costing view of the material master:
    1. Enter a very low price in the planned price 1, 2 or 3 fields manually, for instance 0.01 USD. These prices are used for costing purposes only; they are not read by other applications.
    2. Enter the highest price unit possible, for example 10000.
    Note: If you enter a new price unit that is higher than the costing lot size, the system increases the costing lot size accordingly.
    3. Change the valuation strategy, such as strategy 4, where you could enter the planned price field in which you entered the low price.
    The system now costs as follows:
    Using the valuation strategy, the system finds planned price 1, 2 or 3. Due to the low price and high price unit, the system rounds the value to zero. However, the cost estimate still obtains status KA (free of errors), and no error message is issued.
    This procedure can be used for all materials that have caused error message CK465 to be issued.

    Dear Venkataswamy,
    Check whether have you maintained the planned price for that material in Costing 2 view,
    Also check this thread [Planned price |Re: Planned Price updation In Material Master]
    [standard Cost estimate|Re: Standard Cost Estimate]
    Regards
    Mangalraj.S

  • Import of material groups into hierarchy not possible (note 432339)

    Dear All,
    I am trying to replicate material groups (DNL_CUST_PROD1) from R3 system.  Prior to this our SRM system configured as standalone and Material Hierarchy is already defined.  When I am trying to replicate the material groups in SMQ2 I am receiving status as "sysfail" and further I am getting above message.  In the message the OSS note also mentioned.  In the OSS note they have given following solution
    Error message "Import of material groups into hierarchy &1 not possible":
    In transaction COMM_PRAPPLCAT, you specify that the hierarchy specified in the error message is to be used for application 'Purchasing' (02). This means that the material groups would be created in this hierarchy. Delete this setting in Transaction COMM_PRAPPLCAT. If hierarchy R3MATCLASS already exists, assign 
    hierarchy R3MATCLASS to application 'Purchasing'. Then the material  groups are created in hierarchy R3MATCLASS. If you want to import the material groups into the hierarchy specified in the error message, you can also keep this hierarchy
    assigned to application 'Purchasing' and deactivate the error message. Error message "Import of material types into hierarchy &1 not possible". You can do this in Customizing under 'Customer Relationship Management -> Master data -> Basic settings -> Define system message characteristics'.
    My problem is I am not able to find out the path given in the  OSS note ( i.e, Customer Relationship Management u2013 Master data) . Any one can help me in this regard ?
    with regards
    Ram

    Hi ram
    one upon a time supplier relation ship management and customer relation ship management comes under EBP node i.e ebp 3.5 versions.
    /people/marcin.gajewski/blog/2007/02/05/how-to-replicate-material-master-from-r3-to-srm
    plz visit Marchin blog to.o
    since u r aleady in standalone but now you may try push material group from ecc to srm .
    so you need to do set up all crm middleware settings in ecc and srm.
    br
    muthu

  • Problem in BDC for Material master Change

    Hi,
      I have made a BDC to change the material master, I have done the recording with SHDB   I want to do changes in Sales data and MRP data, when I do the recording I have selected views and it was 4  , 11 AND 12 VIEW IN select vie option    but in some material  Classifcation view is maitain and it is coming at 2nd position and my selected views are shiftin by one position  due to this BDC is giving error Screen contain no filed  -
    I sthere any way that I acn directly select the Three views as Sales data , MRP1 and MRP2,   because when we do the recording it is not showing the name  it is showing as
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(12)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=DEF_SAVE'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(04)'
                                  'X'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(11)'
                                  'X'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(12)'
                                  'X'.
    regards,
    zafar

    Hi,
    Myproblem is solve , in the table MARA i found the filed VPSTA : Maitenance status,   Having the vakue may  KVEDLBZX  those value is diffrent for different  material   this value indicates
      User department                       Maintenance status
    Work scheduling                                      A
    Accounting                                               B
    Classification                                            C
    MRP                                                           D
    Purchasing                                                E
    Production resources/tools                       F
    Costing                                                      G
    Basic data                                                  K
    Storage                                                       L
    Forecasting                                                 P
    Quality management                                    Q
    Warehouse management                             S
    Sales                                                           V
    Plant stocks                                                 X
    Storage location stocks                               Z,
    after reading what fields are maitain according to that i have selected the proper views  and my problem is solve.
    regards,
       zafar

  • How to understand Note1305698 creating new material batch masters data

    Hi, Expert:
    In note 1305698 have below description:
    When creating new material masters for materials subject to batch management and using
    classified batches, it is not possible to create the first batch record in the EWM system. This
    means that, for a material, the first batch is always created in the EWM system and must be
    transferred to the EWM system because this creates the connection between material and class.
    I confused by this statement.
    The first batch record should be created in which system, ERP or EWM?
    The first batch is always created in which system, ERP or EWM?
    BR.

    Hi,
    sorry, that is a typo in the english translation of the note. The original german says: "Dies bedeutet, dass zu einem Material die erste Charge jeweils immer auf ERP-Seite angelegt und an das EWM-System übertragen werden muss, da hierdurch die Verbindung zwischen Material und Klasse angelegt wird."
    (now translated from me): This means that, for a material, the first batch is always created in the ERP system and must be transferred to the EWM system because this creates the connection between material and class.
    I will ask for a correction.
    Best regards
    Juergen

  • Blocking material for sale at plant level

    Hi,
    Can you please help me whether we can block the material for sale at plant level.
    We can block the material in sales organization view --> DChain-spec. status as BLOCKED FOR SALE , but it wil block sales of the material for all the plants in the sales organization.
    Please help whether we can go ahead at plant level.

    the posting block for goods issues can already be reached with a material status, so no phyiscal inventory document necessary.
    What you could try is to control the usage by a userexit.
    E.g.  you define a sales status AND a material status, just as table entry without any customizing in detail.
    and in the userexit you check for the combination of sales status and material status, and if your material has this combination then send a error message to the user.

  • About the effect for batch level conversion from material to plant level

    Dears,
    Now  we use batch management at material level in our system, now we want to change to batch level from material level to plant level, what effects or risks it will bring during the process of conversion?
    Thanks a lot
    Zhongkai

    Hi
    check the following SAP help link it is very helpful:
    http://help.sap.com/saphelp_40b/helpdata/es/d2/1d4b6e5733d1118b3f0060b03ca329/content.htm
    at the link you can find the following
    Specify batch level and activate status management
    In this IMG activity, you specify the following:
    the level at which batch numbers are unique
    whether batch status management is active in the client
    the plants in which batch status management is active
    the initial status of new batches
    Batch level
    Batch numbers can be unique at the following levels:
    at plant level
    at material level
    at client level for a material
    If you choose plant level, the batch number is unique in conjunction with the respective material and the plant. If you choose material level, the batch number is unique together with the material. At client level, the batch number is unique in the whole client.
    To change the batch level, you have to start a conversion program. This program first checks whether conversion is possible and outputs an error log containing all batch numbers that occur more than once at the new level. Now you need to manually transfer these batch records to numbers within Inventory Management using a transfer posting 'material to material'.
    If you change the level from plant level to a higher level, it is possible that batches with the same batch numbers in different plants are actually identical. In this case, all you have to do is remove stocks (including previous period stocks) so that all batches with the same batch numbers, except one, can be reorganized.
    When you convert from plant level to material level, the material is then to be handled in batches in all plants in which it is defined.
    Standard settings
    In the standard R/3 System, batches are unique at plant level.
    Activities
    To change the batch level, proceed as follows:
          1. Choose the level at which you want your batches to be unique.
          2. Save the new settings and choose Back.
          3. Select function Batch level -> Conversion.
          4. If necessary, carry out the conversion in test mode first.
    Further notes
    Note that you cannot reset conversion from plant level to a higher level in the standard.
    If you create a client by copying an existing client, initially, there are no settings in the target client at batch level. The system makes the settings in the target client only when you have carried out an activity (maintaining master data or posting a goods movement, for example).
    SETTINGS BEFORE/AFTER CLIENT COPY:
    Source client Target client
    Client level Material level
    Material level Material level
    Plant level Plant level
    Batch status management
    Batch status management is an additional function provided by the standard R/3 System.
    Standard settings
    Batch status management is not active in the standard R/3 system.
    Activities
    To activate batch status management, proceed as follows:
          1. Choose Batch status management active.
          2. Save the new setting and choose Back.
          3. Choose Batch status management -> conversion.
          4. If necessary, carry out the conversion in test mode first.
    Further notes
    Batch status management is linked to the batch level. At material and at plant level, the status management settings are valid within the client, that is for all plants. However, if you have defined batches to be unique at plant level, you have to select the plants in which status management is to be active using function Plants with status management.
    If you activate status management, all existing batches are assigned status 'unrestricted'. If you deactivate status management, the systems transfers all restricted batches to unrestricted stock within conversion. Restricted stock only exists if status management is active.
    If you create a client by copying an existing client, status management is automatically activated if batches exist in the target client, independent of the settings in the source client. If no batches exist in the target client, it is not activated. In this case, you have to activate or deactivate status management manually, if required.
    Plants with batch status management
    Activities
    To select the plants in which status management is to be active, proceed as follows:
          1. Set characteristic Batch status management for those plants in which batch status management is to be active.
          2. Save your settings and choose function Back.
          3. Choose function Batch status management -> conversion
          4. If necessary, carry out the conversion in test mode first.
    Initial status of a new batch
    Using this function, you can specify for each material type which initial status new batches are to be assigned. However, if you use a quality management system, this specifies the status of the batches.
    Hope it will help
    Best Regards

  • Uploading data in MM01 for different material types

    Hi,
    I have a doubt regarding uploading the data in MM01 for different material types.
    Generally in MM01, we have different views for different material types. The number of views will vary depending upon the material type that we select.
    I have a scenario, where in to upload the data, I have a flat file that consists of data for different message types. So, how to upload the data in such case.
    Can anyone help me on the same by providing explanation or sample code...? What would be the possible ways to upload data in such scenario.
    That would be of great help.
    Thanks & Regards,
    Pradeep.

    See the below code and use FM SELECTION_VIEWS_FIND..
    REPORT zjpmuim306 NO STANDARD PAGE HEADING LINE-SIZE 250 MESSAGE-ID
    zjpm001.
    *&   I N B O U N D  V I A   A B A P : Batch input Session method     *
    *&   Development ID: IM_DD_306_LJP                                   *
    *&   Report        : ZJPMUIM306                                      *
    *&   The Purpose of the Object is to interface Create Input Record   *
    *&   for SAP Migration from the Material master of BPCS All the      *
    *&   information received at BPCS is collected into a single record. *
    *&   By using session method upload data from file ,one item is
    *&   created for one record                                          *
    *&   Change Log:                                                     *
    *&   Init       Who              Date         Text                   *
    *&  MALIKDH1   Seshu Reddy    26-07-2003   Initial Version           *
                             Constants                                   *
    CONSTANTS:c_vkorg(4) type c value 'JP20',        " Sales Organization
              c_vtweg(2) type c value 'TR' ,         " Distribution Channel
              c_werks(4) Type c value 'JP01' ,       " Plant
              c_viewlist(15) VALUE 'KDEALBSZXVPCFQG'," View list
              c_scm_view TYPE msichtausw-dytxt VALUE 'SCM View',
              c_sd_view TYPE msichtausw-dytxt VALUE 'SD View',
              c_seq_code(2) VALUE 'Z1',              " Sequential Code
              c_keep(1) TYPE c VALUE  'X',           " Keep
              c_group LIKE apqi-groupid VALUE 'IM306', " Session Name
              c_tcode  LIKE tstc-tcode VALUE 'MM02',  " Transaction Code
              c_blank(1) VALUE ' ',                   " Blank
              c_intls(1) VALUE 'N'.                  " Logistic Status
                  Variables                                      *
    DATA: g_flag1(1),  " Variable to hold
          g_flag(1),   " Variable to hold
          g_file LIKE rlgrap-filename VALUE
         'C:\Documents and Settings\seshur\Desktop\HCLT123.CSV'. " File name
           Internal tables/ Work area                           *
    Internal Table for Delimter
    DATA : BEGIN OF t_delim OCCURS 0,
           text(1000),
           END OF t_delim.
    Internal table for BDC processing
    DATA : t_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
    Internal table for holding the data which has to be uploaded.
    DATA: BEGIN OF t_bpcs OCCURS 0,
          matnr(15) TYPE c,  " material no
          dosage(40) TYPE c, " Dosage form(Local)
          appearance(40) TYPE c, " Appearance
          idcode(6) TYPE c,     " Identification Code
          prostformno(10) TYPE c, "SOP
          weitab(7) TYPE c,    " Weight/tablet
          uom1(2) TYPE c,     " UOM of Carton
          uom2(2) TYPE c,     " UOM of Case
          carsize(14) TYPE c, " Carton size
          cassize(14) TYPE c, " Case size
          rupqty(11) TYPE c,  " Round up
          abvname(3) TYPE c,  " Product short name
          END OF t_bpcs.
    *Internal table for t_bpcs
    DATA: BEGIN OF t_mdata OCCURS 0,
          matnr  LIKE marc-matnr, " Material number
          zzjp_dos_frm LIKE marc-zzjp_dos_frm, " Dosage form(Local)
          zzjp_aprn LIKE marc-zzjp_aprn, " Appearance
          zzjp_con_id LIKE marc-zzjp_con_id," Identification Code
          zzjp_nyu_sop LIKE marc-zzjp_nyu_sop,"SOP
          zzjp_wei_tab(10) type c , " Weight/tablet
          zzjp_bio  LIKE marc-zzjp_bio,"Biologics Indicator
          zzjp_itf LIKE marc-zzjp_itf, " ITF code
          zzjp_car(2) type c, " UOM of Carton
          zzjp_cas(2) type c, " UOM of Case
          zzjp_car_size(11) type c," Carton size
          zzjp_cas_size(11) type c, " Case size
          zzjp_rupqty(11) type c,  " Round up
          zzjp_init_ls LIKE marc-zzjp_init_ls, " Logistic Status
          zzjp_re1 LIKE marc-zzjp_re1, "Document type(Local)
          zzjp_re2 LIKE marc-zzjp_re2, "Report type
          zzjp_re3 LIKE marc-zzjp_re3, "Shipping report type
          zzjp_pro_id LIKE mvke-zzjp_pro_id," Product output sequence
          zzjp_bu_id LIKE mvke-zzjp_bu_id, " Business unit indicator
          zzjp_abv_name LIKE mvke-zzjp_abv_name," Product short name
          zzjp_abv_id1 LIKE mvke-zzjp_abv_id1," Product short name output
          zzjp_abv_id2 LIKE mvke-zzjp_abv_id2," Product short name internal
          zzjp_spl_id LIKE mvke-zzjp_spl_id,  " Sample internal order
          END OF t_mdata.
    Internal table for Mara Table
    DATA: BEGIN OF t_mara OCCURS 0,
          matnr LIKE mara-matnr,  " material Number
          vpsta LIKE mara-vpsta,  " Maintenance status of complete material
          pstat like mara-pstat,  " Maintenance status
          END OF t_mara.
    Internal table for Material Master View Selection Screens
    DATA: BEGIN OF t_bildtab OCCURS 0.
            INCLUDE STRUCTURE mbildtab.
    DATA: END OF t_bildtab.
    internal table for T_bildtab
    DATA: t_bildtab_dup LIKE t_bildtab OCCURS 0 WITH HEADER LINE.
    *Work area for T_bildtab internal table(Views Selection)
    DATA: BEGIN OF w_data,
          flag1 type c,
          anzd70 TYPE i,
          field1(20) type c,
          field2(20) type c,
          field3(20) type c,
          field4(20) type c,
          count(2) TYPE c,
          END OF w_data.
                Main Processing                           *
    START-OF-SELECTION.
    Store data from file into internal table
      PERFORM f_uplaod_data.
    Transfer the uploaded data into t_mdata internal Table
      PERFORM f_process_data.
    Selecting The views based on Material number
      PERFORM f_view_list.
    Open a BDC Session
      PERFORM f_bdc_open.
    *Selecting the fields from mara table
      SELECT matnr
             vpsta
             pstat
        FROM mara
      INTO TABLE t_mara
      FOR ALL ENTRIES IN t_mdata
      WHERE matnr = t_mdata-matnr.
      SORT t_mara BY matnr.
      SORT t_mdata BY matnr.
    Transfer the uploaded data into BDCDATA structure
      PERFORM f_process_bdc.
    Close The BDC Session
      PERFORM f_close_group.
    *&      Form  F_VIEW_LIST                                             *
             Routine to used for Calling the function module            *
              Selection_views_find                                      *
    FORM f_view_list.
      CALL FUNCTION 'SELECTION_VIEWS_FIND'
           EXPORTING
                bildsequenz     = c_seq_code
                pflegestatus    = c_viewlist
           TABLES
                bildtab         = t_bildtab
           EXCEPTIONS
                call_wrong      = 1
                empty_selection = 2
                OTHERS          = 3.
      IF sy-subrc <> 0.
             MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " F_VIEW_LIST
    *&      Form  f612_view_sort                                          *
      Routine to used for Selecting The views based on Material Number  *
    FORM f612_view_sort.
      t_bildtab_dup[] = t_bildtab[].
    Reading the Internal table t_mara
      READ TABLE t_mara WITH KEY matnr = t_mdata-matnr.
      TRANSLATE t_mara-pstat USING ' $'.
      CLEAR: w_data-flag1, w_data-anzd70.
      LOOP AT t_bildtab_dup.
        IF t_bildtab_dup-pstat CA t_mara-pstat.
          w_data-anzd70 = w_data-anzd70 + 1.
          IF t_bildtab_dup-kzanz IS INITIAL.
            t_bildtab_dup-kzanz = 'X'.
            w_data-flag1 = 'X'.
            MODIFY t_bildtab_dup.
          ENDIF.
        ELSE.
          IF NOT t_bildtab_dup-kzanz IS INITIAL.
            CLEAR t_bildtab_dup-kzanz.
            w_data-flag1 = 'X'.
            MODIFY t_bildtab_dup.
          ENDIF.
        ENDIF.
      ENDLOOP.
      TRANSLATE t_mara-pstat USING '$ '.
      IF NOT w_data-flag1 IS INITIAL.
        SORT t_bildtab_dup BY kzanz DESCENDING idxbd ASCENDING.
      ENDIF.
    *Reading The internal table for T_bildtab_dup
      READ TABLE t_bildtab_dup WITH KEY dytxt = c_scm_view.
      IF t_bildtab_dup-kzanz = 'X'.
        WRITE sy-tabix TO w_data-count.
        w_data-count = w_data-count + 2.
        IF w_data-anzd70 > 18.
          w_data-count = w_data-count - 18.
        ENDIF.
        CONCATENATE 'MSICHTAUSW-DYTXT(' w_data-count ')' INTO w_data-field1.
        CONCATENATE 'MSICHTAUSW-KZSEL(' w_data-count ')' INTO w_data-field2.
      ENDIF.
      READ TABLE t_bildtab_dup WITH KEY dytxt = c_sd_view.
      IF t_bildtab_dup-kzanz = 'X'.
        WRITE sy-tabix TO w_data-count.
        IF w_data-anzd70 > 18.
              w_data-count = w_data-count + 2.
          w_data-count = w_data-count - 18.
        ENDIF.
        CONCATENATE 'MSICHTAUSW-DYTXT(' w_data-count ')' INTO w_data-field3.
        CONCATENATE 'MSICHTAUSW-KZSEL(' w_data-count ')' INTO w_data-field4.
      ENDIF.
    ENDFORM.                    " f612_view_sort
    *&      Form  f_uplaod_data                                           *
    Routine to used for Uploading the data from file to Internal table *
    FORM f_uplaod_data.
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                filename                = g_file
                filetype                = 'DAT'
           TABLES
                data_tab                = t_delim
           EXCEPTIONS
                conversion_error        = 1
                file_open_error         = 2
                file_read_error         = 3
                invalid_type            = 4
                no_batch                = 5
                unknown_error           = 6
                invalid_table_width     = 7
                gui_refuse_filetransfer = 8
                customer_error          = 9
                OTHERS                  = 10.
      IF sy-subrc <> 0.
             MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF t_bpcs IS INITIAL.
        LOOP AT t_delim.
          SPLIT t_delim-text AT ',' INTO t_bpcs-matnr
                                         t_bpcs-dosage
                                         t_bpcs-appearance
                                         t_bpcs-idcode
                                         t_bpcs-prostformno
                                         t_bpcs-weitab
                                         t_bpcs-uom1
                                         t_bpcs-uom2
                                         t_bpcs-carsize
                                         t_bpcs-cassize
                                         t_bpcs-rupqty
                                         t_bpcs-abvname.
          APPEND t_bpcs.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " f_uplaod_data
    *&      Form  F_BDC_OPEN
          Routine  to create BDC Session to be processed
    FORM f_bdc_open.
      CALL FUNCTION 'BDC_OPEN_GROUP'
           EXPORTING
                client              = sy-mandt
                group               = c_group
                keep                = c_keep
                user                = sy-uname
           EXCEPTIONS
                client_invalid      = 1
                destination_invalid = 2
                group_invalid       = 3
                group_is_locked     = 4
                holddate_invalid    = 5
                internal_error      = 6
                queue_error         = 7
                running             = 8
                system_lock_error   = 9
                user_invalid        = 10
                OTHERS              = 11.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
      MESSAGE S000 WITH 'Batch input session is created successfully'(T02).
      ENDIF.
    ENDFORM.                    " F_BDC_OPEN
    *&      Form  F_PROCESS_BDC
          Processing of BDCDATA Structure
    FORM f_process_bdc.
      LOOP AT t_mdata.
        PERFORM f612_view_sort.
        PERFORM f_bdc_dynpro USING 'SAPLMGMM' '0060'.
        PERFORM f_bdc_field USING 'BDC_CURSOR'
                                      'RMMG1-MATNR'.
        PERFORM f_bdc_field USING 'BDC_OKCODE'
                                      '=AUSW'.
        PERFORM f_bdc_field USING 'RMMG1-MATNR'
                                      t_mdata-matnr.
        PERFORM f_bdc_dynpro USING 'SAPLMGMM' '0070'.
        PERFORM f_bdc_field USING 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
        IF w_data-anzd70 > 18.
          PERFORM f_bdc_field       USING 'BDC_OKCODE'
                                      '=P+'.
          PERFORM f_bdc_dynpro      USING 'SAPLMGMM' '0070'.
          PERFORM f_bdc_field  USING 'BDC_OKCODE' '/00'.
        ENDIF.
    reading the t_bildtab internal table
        READ TABLE t_bildtab_dup WITH KEY dytxt = c_scm_view.
        IF t_bildtab_dup-kzanz = 'X'.
          PERFORM f_bdc_field       USING 'BDC_CURSOR'
                                        w_data-field1.
          PERFORM f_bdc_field       USING w_data-field2 'X'.
          g_flag = 'X'.
        ENDIF.
    reading the t_bildtab internal table
        READ TABLE t_bildtab_dup WITH KEY dytxt = c_sd_view.
        IF sy-subrc EQ 0.
          g_flag = 'X'.
        ENDIF.
        IF t_bildtab_dup-kzanz = 'X'.
          PERFORM f_bdc_field       USING 'BDC_CURSOR'
                                        w_data-field3.
          PERFORM f_bdc_field       USING w_data-field4 'X'.
          g_flag1 = 'X'.
        ENDIF.
        IF g_flag = 'X' AND g_flag1 = 'X'.
          PERFORM f_bdc_dynpro      USING 'SAPLMGMM' '0080'.
          PERFORM f_bdc_field       USING 'BDC_CURSOR'
                                        'RMMG1-VTWEG'.
          PERFORM f_bdc_field       USING 'BDC_OKCODE'
                                        '=ENTR'.
          PERFORM f_bdc_field       USING 'RMMG1-WERKS'
                                        c_werks.
          PERFORM f_bdc_field       USING 'RMMG1-VKORG'
                                        c_vkorg.
          PERFORM f_bdc_field       USING 'RMMG1-VTWEG'
                                        c_vtweg.
          CLEAR g_flag.
          CLEAR g_flag1.
        ELSE.
          IF g_flag = 'X'.
            PERFORM f_bdc_dynpro      USING 'SAPLMGMM' '0080'.
            PERFORM f_bdc_field       USING 'RMMG1-WERKS'
                                        c_werks.
            PERFORM f_bdc_field      USING 'BDC_OKCODE' '/00'.
          ELSE.
            IF g_flag1 = 'X'.
              PERFORM f_bdc_dynpro      USING 'SAPLMGMM' '0080'.
              PERFORM f_bdc_field       USING 'BDC_CURSOR'
                                            'RMMG1-VTWEG'.
              PERFORM f_bdc_field       USING 'RMMG1-WERKS'
                                          c_werks.
              PERFORM f_bdc_field       USING 'RMMG1-VKORG'
                                            c_vkorg.
              PERFORM f_bdc_field       USING 'RMMG1-VTWEG'
                                            c_vtweg.
              PERFORM f_bdc_field       USING 'BDC_OKCODE'
                                             '=ENTR'.
            ENDIF.
          ENDIF.
        ENDIF.
    *Processing of SCM View
        PERFORM f_bdc_dynpro      USING 'SAPLMGMM' '4000'.
        PERFORM f_bdc_field       USING 'BDC_CURSOR' 'MARC-ZZJP_DOS_FRM'.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_DOS_FRM'
                                      t_mdata-zzjp_dos_frm.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_APRN'
                                      t_mdata-zzjp_aprn.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_CON_ID'
                                      t_mdata-zzjp_con_id.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_NYU_SOP'
                                      t_mdata-zzjp_nyu_sop.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_WEI_TAB'
                                      t_mdata-zzjp_wei_tab.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_CAR'
                                      t_mdata-zzjp_car.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_CAS'
                                      t_mdata-zzjp_cas.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_CAR_SIZE'
                                      t_mdata-ZZJP_CAR_SIZE.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_CAS_SIZE'
                                      t_mdata-ZZJP_CAS_SIZE.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_RUPQTY'
                                       t_mdata-ZZJP_RUPQTY.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_BIO'
                                      t_mdata-zzjp_bio.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_ITF'
                                      t_mdata-zzjp_itf.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_INIT_LS'
                                      t_mdata-zzjp_init_ls.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_RE1'
                                      t_mdata-zzjp_re1.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_RE2'
                                      t_mdata-zzjp_re2.
        PERFORM f_bdc_field       USING 'MARC-ZZJP_RE3'
                                      t_mdata-zzjp_re3.
        PERFORM f_bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
    *Processing of SD View
        PERFORM f_bdc_dynpro      USING 'SAPLMGMM' '4000'.
        PERFORM f_bdc_field       USING 'BDC_CURSOR' 'MVKE-ZZJP_PRO_ID'.
        PERFORM f_bdc_field       USING 'MVKE-ZZJP_PRO_ID'
                                      t_mdata-zzjp_pro_id.
        PERFORM f_bdc_field       USING 'MVKE-ZZJP_BU_ID'
                                      t_mdata-zzjp_bu_id.
        PERFORM f_bdc_field       USING 'MVKE-ZZJP_ABV_NAME'
                                      t_mdata-zzjp_abv_name.
        PERFORM f_bdc_field       USING 'MVKE-ZZJP_ABV_ID1'
                                      t_mdata-zzjp_abv_id1.
        PERFORM f_bdc_field       USING 'MVKE-ZZJP_ABV_ID2'
                                      t_mdata-zzjp_abv_id2.
        PERFORM f_bdc_field       USING 'MVKE-ZZJP_SPL_ID'
                                      t_mdata-zzjp_spl_id.
        PERFORM f_bdc_field      USING 'BDC_OKCODE' '/00'.
        PERFORM f_bdc_dynpro      USING 'SAPLSPO1' '0300'.
        PERFORM f_bdc_field       USING 'BDC_OKCODE'
                                      '=YES'.
    perform f_bdc_insert.
    REFRESH T_BDCDATA.
      ENDLOOP.
    ENDFORM.                    " F_PROCESS_BDC
    *&      Form  f_bdc_dynpro
      p_prog is the program name to which data is passed                *
      p_dyno is the screen number to which the data is passed
        Routine for populating the BDCDATA structure with the
        Screen related information
    FORM f_bdc_dynpro USING    p_prog
                               p_dyno.
      t_bdcdata-program  = p_prog.
      t_bdcdata-dynpro   = p_dyno.
      t_bdcdata-dynbegin = 'X'.
      APPEND t_bdcdata.
      CLEAR t_bdcdata.
    ENDFORM.                    " F_bdc_dynpro
    *&      Form  F_BDC_FIELD
          p_fnam is the field name to which value is passed
          p_fval is the field value which is passed
       p_fnam is the field name to which value is passed
       p_fval is the field value which is passed
    FORM f_bdc_field USING    p_fnam
                              p_fval.
      t_bdcdata-fnam = p_fnam.
      t_bdcdata-fval = p_fval.
      APPEND t_bdcdata.
      CLEAR t_bdcdata.
    ENDFORM.                    " F_bdc_field
    *&      Form  F_PROCESS_DATA                                          *
         Routine to used for moving data from T_bpcs internal table to  *
         t_mdata Internal Table                                         *
    FORM f_process_data.
      LOOP AT t_bpcs.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
                  input  = t_bpcs-matnr
             IMPORTING
                  output = t_mdata-matnr.
        MOVE t_bpcs-dosage TO t_mdata-zzjp_dos_frm.
        MOVE t_bpcs-appearance TO t_mdata-zzjp_aprn.
        MOVE t_bpcs-idcode  TO t_mdata-zzjp_con_id.
        MOVE t_bpcs-prostformno TO t_mdata-zzjp_nyu_sop.
        MOVE t_bpcs-weitab TO t_mdata-zzjp_wei_tab.
        MOVE c_blank TO t_mdata-zzjp_bio.
        MOVE c_blank TO t_mdata-zzjp_itf.
        MOVE t_bpcs-uom1 TO t_mdata-zzjp_car.
        MOVE t_bpcs-uom2 TO t_mdata-zzjp_cas.
        MOVE t_bpcs-carsize TO t_mdata-zzjp_car_size.
        MOVE t_bpcs-cassize TO t_mdata-zzjp_cas_size.
        MOVE t_bpcs-rupqty TO t_mdata-zzjp_rupqty.
        MOVE c_intls TO t_mdata-zzjp_init_ls.
        MOVE c_blank TO t_mdata-zzjp_re1.
        MOVE c_blank TO t_mdata-zzjp_re2.
        MOVE c_blank TO t_mdata-zzjp_re3.
        MOVE c_blank TO t_mdata-zzjp_pro_id.
        MOVE c_blank TO t_mdata-zzjp_bu_id.
        MOVE t_bpcs-abvname TO t_mdata-zzjp_abv_name.
        MOVE c_blank TO t_mdata-zzjp_abv_id1.
        MOVE c_blank TO t_mdata-zzjp_abv_id2.
        MOVE c_blank TO t_mdata-zzjp_spl_id.
        APPEND t_mdata.
      ENDLOOP.
    ENDFORM.                    " F_PROCESS_DATA
    *&      Form  f_bdc_close
          Routine to close the BDC Session
    FORM f_close_group.
      CALL FUNCTION 'BDC_CLOSE_GROUP'
           EXCEPTIONS
                not_open    = 1
                queue_error = 2
                OTHERS      = 3.
      IF sy-subrc <> 0.
             MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " f_close_group
    *&      Form  f_bdc_insert
         routine to input batch data into the Transaction MM02 from the
         session created
    FORM f_bdc_insert.
    CALL FUNCTION 'BDC_INSERT'
             EXPORTING
                  tcode            = c_tcode
             TABLES
                  dynprotab        = t_bdcdata
             EXCEPTIONS
                  internal_error   = 1
                  not_open         = 2
                  queue_error      = 3
                  tcode_invalid    = 4
                  printing_invalid = 5
                  posting_invalid  = 6
                  OTHERS           = 7.
        IF sy-subrc <> 0.
             MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    ENDFORM.                    " f_bdc_insert
    Reward Points if it is useful
    Thanks
    Seshu

Maybe you are looking for