Dual Nature for Abap code.

Hi,
Requirment is
For a Material,
Orders  required quantity
components for that material
their requirment.
my program takes material and orders from RESB table.
to get components i am looping through header table using Function module -'CS_BOM_EXPL_MAT_V2'.
If i do the debugginf i am able to see that data is going properly to internal table. but when i execute, Components data is missing.
Any body can help me in this?
What might be the cause?
Regards,
Lijo Joseph

REPORT  zpp_cut_mat_issue LINE-SIZE 130 LINE-COUNT 65(3) "LINE-COUNT 90(3)
NO STANDARD PAGE HEADING    .
*Tables
TABLES : resb,makt,marc,mara,aufk.
DATA: l_bdmng LIKE resb-bdmng.
*Inputs
*PARAMETERS :
*Lead Production Order No.
             P_AUFNR LIKE AFPO-AUFNR OBLIGATORY.
SELECT-OPTIONS :
*From No. to No.
              s_matnr FOR resb-matnr ,
              s_bdter FOR resb-bdter ,  "
              s_ekgrp FOR marc-ekgrp,
              s_mtyp FOR mara-extwg NO-EXTENSION NO INTERVALS ," TYPE  C OBLIGATORY.
              s_aufnr FOR resb-aufnr,  "production order
              s_dispo FOR marc-dispo,  "MRP type
              s_erdat FOR aufk-erdat,  "prdn order creation date
              s_werks for resb-werks.
*Raw Material /Assembly
RANGES :      r_resb FOR afko-rsnum.
*Constants
*Type Pools
TYPE-POOLS : cs01.
*Data Declaration
DATA :
       ismast TYPE cs01_mastb OCCURS 0 WITH HEADER LINE,
       topmat TYPE cstmat OCCURS 0 WITH HEADER LINE,
       stb TYPE stpox OCCURS 0 WITH HEADER LINE,
       matcat TYPE cscmat OCCURS 0 WITH HEADER LINE,
       dstst TYPE csdata-xfeld.
START-OF-SELECTION.
DATA it_resb LIKE resb OCCURS 0 WITH HEADER LINE.
  DATA: BEGIN OF it_resb OCCURS 0,
  matnr LIKE resb-matnr,
  aufnr LIKE resb-aufnr,
  bdmng LIKE resb-bdmng,
  meins LIKE resb-meins,
  bdter LIKE resb-bdter,
  werks LIKE resb-werks,
  pmatnr LIKE afpo-matnr,
  pmaktx LIKE makt-maktx,
  sbmng LIKE afko-sbmng,
  baugr LIKE resb-baugr,
  END OF it_resb.
*Variables
  DATA l_lead_aufnr LIKE afpo-aufnr.
  DATA l_pmatnr LIKE afpo-matnr.
  DATA l_sbmng LIKE afko-sbmng.
  DATA l_sbmeh LIKE afko-sbmeh.
  DATA l_slno TYPE i.
  data l_labst like mard-labst.
  SELECT aufnr matnr werks bdmng meins bdter baugr INTO CORRESPONDING FIELDS OF TABLE it_resb FROM resb
  WHERE aufnr IN s_aufnr AND matnr IN s_matnr and werks in s_werks
  ORDER BY baugr.
  IF sy-subrc <> 0.
    MESSAGE 'No Values Found' TYPE 'I'.
    LEAVE LIST-PROCESSING.
  ENDIF.
  DELETE it_resb WHERE aufnr = space.
  LOOP AT it_resb.
    SELECT SINGLE lead_aufnr sbmng sbmeh INTO (l_lead_aufnr,l_sbmng,l_sbmeh) FROM afko WHERE aufnr = it_resb-aufnr.
    SELECT SINGLE matnr INTO it_resb-pmatnr FROM afpo WHERE aufnr = l_lead_aufnr.
    SELECT SINGLE maktx INTO it_resb-pmaktx FROM makt WHERE matnr = it_resb-pmatnr.
    MODIFY it_resb TRANSPORTING pmatnr pmaktx.
  ENDLOOP.
  SORT it_resb BY matnr baugr pmatnr .
  LOOP AT it_resb.
    ON CHANGE OF it_resb-matnr.
      FORMAT COLOR COL_HEADING ON.
      WRITE:/ sy-uline.
      WRITE:/ sy-vline,it_resb-matnr,it_resb-baugr,it_resb-meins,sy-uline.
      FORMAT COLOR OFF.
      l_slno = 1.
    ENDON.
    WRITE:/1 sy-vline,2(3) l_slno,sy-vline,(12) it_resb-aufnr,sy-vline,it_resb-bdmng,it_resb-meins,it_resb-baugr,it_resb-pmaktx.
l_slno = l_slno + 1.
    AT END OF matnr .
      READ TABLE it_resb INDEX sy-tabix.
      SUM.
      l_bdmng = it_resb-bdmng.
      WRITE:/ sy-uline.
      FORMAT COLOR COL_TOTAL ON.
      WRITE:/ 'Total:',l_bdmng.
      FORMAT COLOR OFF.
      PERFORM bom_explode .
    ENDAT.
  ENDLOOP.
*&      Form  bom_explode
      text
-->  p1        text
<--  p2        text
FORM bom_explode .
  CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
    EXPORTING
      aufsw                 = ' '
      aumng                 = 0
      capid                 = 'PP01'
      datuv                 = sy-datum
      ehndl                 = '1'
      emeng                 = it_resb-bdmng
      mktls                 = 'X'
      mehrs                 = 'X'
      mtnrv                 = it_resb-matnr
      stpst                 = 0
      svwvo                 = 'X'
      werks                 = it_resb-werks
      vrsvo                 = 'X'
    IMPORTING
      topmat                = topmat
      dstst                 = dstst
    TABLES
      stb                   = stb
      matcat                = matcat
    EXCEPTIONS
      alt_not_found         = 1
      call_invalid          = 2
      material_not_found    = 3
      missing_authorization = 4
      no_bom_found          = 5
      no_plant_data         = 6
      no_suitable_bom_found = 7
      conversion_error      = 8
      OTHERS                = 9.
  IF sy-subrc <> 0.
   MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    WRITE:/ sy-uline.
    LOOP AT stb.
      WRITE:/ stb-idnrk,stb-menge,stb-meins,stb-mnglg,stb-meins,l_labst.
    ENDLOOP.
    WRITE:/ sy-uline.
    SKIP 1.
  ENDIF.
ENDFORM.                    " bom_explode
TOP-OF-PAGE.
  CALL FUNCTION 'ZCA_REPORT_HEADER'
    EXPORTING
      hdval  = 'Cutting List For Stores'
      rpsize = 130
      plant  = 'BLR'.
  COMMIT WORK.

Similar Messages

  • Syntax helper for ABAP code?

    Please, I would like to ask any of you ABAP developers with some expirience...is there any tool (inside or outside the Workbench) that can color the syntax of ABAP code... (the way it is done in some other IDEs like Visual Studio, JBuilder or even Ultra Edit...) ???

    There are some IDE external of SAP that do that. But .. I try it and don't like that.
    Ex : http://www.sapedit.com/
    Wait for next release, there will be some new stuff.
    Frédéric

  • Pluggin for abap code editor

    Hi All,
    I was wondering is there anyway we could create a pluggin for our existing code editor in abap ?
    I have absolutely no idea about how could i do that. If there are any links or tutorials you can help me with, it would be of great help
    Thanks & Best Regards,
    Prateek

    Hi,
    Look at Create your own New Editor for BOR objects - ABAP Development - SCN Wiki
    Regards,
    Jarek

  • Possi. for ABAP code instead of JAVA Script for creating searachhelp in BSP

    Hi Consultants i have a doubt that is there a possibility to use ABAP coding in BSP object for creating search help
    instead of JAVA Script if so please reply me with the procedure or else with some sample coding.

    Hi Consultants i have a doubt that is there a possibility to use ABAP coding in BSP object for creating search help
    instead of JAVA Script if so please reply me with the procedure or else with some sample coding.

  • Need help for ABAP CODE

    hi,
    i need to reload the master data without FM, i put the comments on fm and relaod the data, now i having a problem, loading process is slow now as compair to before, when i was using with FM.i checked the manage of infoObject, it is show 1123455 records in "transfer" column and 0 record in "added" column, below is the start routine,
    Please help me to fix that problem
    IF NOT DATAPAK[] IS INITIAL.
        LOOP AT DATAPAK INTO S_DATAPAK.
          CLEAR V_INDEX.
          V_INDEX = SY-TABIX.
         IF S_DATAPAK-/BIC/ABRETPRI CO ' 0123456789.'.
           CLEAR: V_AMOUNT, V_PRC.
          V_AMOUNT = S_DATAPAK-/BIC/ABRETPRI.
          CALL FUNCTION 'RSAR_CURRENCY_CONVERT'
          EXPORTING
          I_CURRENCY = S_DATAPAK-CURRENCY
          CHANGING
          C_AMOUNT   = V_AMOUNT.
         V_PRC = V_AMOUNT.
         S_DATAPAK-/BIC/ABRETPRI = V_PRC.
        ENDIF.
    IF S_DATAPAK-/BIC/ABBLNKFLG IS INITIAL.
            S_DATAPAK-/BIC/ABBLNKFLG = 'N'.
          ENDIF.
    TRANSLATE S_DATAPAK-/BIC/ABSZRANGE TO UPPER CASE
    IF S_DATAPAK-CURRENCY IS INITIAL.
          S_DATAPAK-CURRENCY = S_DATAPAK-WHLPRCCURR.
    MODIFY DATAPAK FROM S_DATAPAK INDEX V_INDEX TRANSPORTING
         /BIC/ABRETPRI /BIC/ABWHLPRCE /BIC/ABBLNKFLG
         ENDIF.
    *ENDLOOP.
      ENDIF
    Thanks

    You need not use start routine to achieve this. Instead you can write transfer routines/formulas for those fields in UR.

  • ABAP code for Date Range

    Hi All,
    I have requirement to write code for date range.
    Characterstic = Run-Out Date, it was created reference to 0Date.
    Requirement is data should load depends on Run-Out Date 7 days old and 14 days future.
    Logic is -7 days old >= Run_out date <= 14 days future.
    please let me know how I need to proceed with ABAP code for this requirement.
    Thanks.
    Please do not ask for ABAP code here. Its not a training forum
    Edited by: Pravender on Aug 18, 2011 1:46 AM

    >
    Sree vignesh wrote:
    > Hi,
    > In the select option we have a field month range as
    > SELECT-OPTION : FROM 01.2007       TO  01.2009 " Let say Ur Selection option is SO_MONTH
    > but now i need to add the DMBTR field considering the month range in the SELECT OPTION i.e., only FROM 01.2007 TO  01.2009 i mean without 2006 data.
    >
    > LOOP AT LT_DATA WHERE month in SO_MONTH. " Here add a Where condition
    >     ls_output-matnr = lt_data-belnr.
    >     ls_output-werks = lt_data-bukrs.
    >     ls_output-lgort = lt_data-dmbtr.   
    >
    >     COLLECT  ls_output INTO lt_output .
    >
    >   ENDLOOP.
    >
    > please help with code .
    >
    > thanks in advance.
    Regards,
    Suneel G

  • ATP control in ABAP code, product allocation

    Hello,
    Scenario is like this:
    I am creating sales order for 10 PC of material. Material is fully available on unrestricted stock but product allocation is allowing me to use only 3 PC of material.
    Question:
    I am searching for ABAP code which tells me what is the reason of 'incomplete' availability control?
    So in other words I would like to know (in ABAP) whether the quantity is blocked due to the product allocation or due to the stock shortage.
    Regards,
    Piotr

    Hi,
    Please check the below code, MODULE should be in between Loop and End loop.
    PROCESS BEFORE OUTPUT.
    LOOP AT ITAB WITH CONTROL EMPTABLE CURSOR EMPTABLE-CURRENT_LINE.
       MODULE STATUS_0001.
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0001.
    LOOP AT ITAB.
    ENDLOOP.
    Thanks,
    Sriram.

  • ABAP Code to delete old PSA requests

    Hi Friends,
    I have a requirement where I am loading two different types of data through two different InfoPackages. Both the InfoPackages are scheduled to load data daily to a DataSource. Now the issue is I have to delete data every day from PSA, related to just one InfoPackage before I load data and leave the data coming from other InfoPackage as it is in the PSA.
    In other words I want to delete PSA data based on an InfoPackage. I am not sure if we have a standard SAP program to achieve this or it involves custom ABAP code.
    Any help will be appreciated.

    Hi
    two info packages are loading data from from same source system or same source system..?
    If this 2 info packages are loading from different source systems, then you can achieve this using "Delete PSA" process type.In this process type we can delete PSA based on source system.
    If 2 info packages are loading from same source system, then we need to look for ABAP program.
    check the below document for ABAP Code
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00be6ce4-aa1c-2e10-df81-856c1ffec357?QuickLink=index&overridelayout=true
    how to create delete PSA process type in PC
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a02ba9e7-bb6f-2c10-09b4-e86b9fcbad41?QuickLink=index&overridelayout=true
    Regards,
    Venkatesh

  • Any good books for abap coding

    Hi..
    Any one can tell me the good books on routines,user exists,mailny for abap code used in BW.Sap press books also.I dont known the abap.if any docs is ther please sent me to my mail id:[email protected] simens or reliance material.will assign points.
    Advance Thanks,
    Madhavi

    Hi Madhavi,
    First check the link in below then your email
    <a href="http://www.sap-press.com/library.cfm?account=&library=H1968">The ABAP Collection</a>
    Regards,

  • Abap code standards

    Hi all,
    Please give me some information for abap code standards using in it companies.

    Hi
    Normally company or client specific.
    Mostly used common are
    Modification history should be there..
    for local variables l_variable
    Internal tables i_ vbak etc....
    any report shud start with z_modulename_programname

  • ABAP Code Formatter

    Hi,
    I want a code formatter  for ABAP code which will look afte proper alignment of every staement as well as indentation according to my requirements. Pretty printer was used but the format is not as expected.
    Can anyone help.?

    Hi,
    Im afraid there is no other tool than Pretty printer available, so unless you want to write you own tool for formatting the source code, you'll have to stick to the Pretty printer
    Personally I find the Pretty printer Indentation and Keyword uppercase quite sufficient, and I don't see much point in having some special formatting - the next developer might use the Pretty printer on your code and your formatting is gone anyway...
    regards,
    Stano

  • ABAP Code example using "GENERATE DYNPRO"

    I am looking for ABAP code example who use the "Generate dynpro" dynamic generation of dynpro at runtime under SAP 4.6C version.
    Best regards,

    We have some programs that do:
    form %view.
    data: anz type i,
          prog like sy-repid.
      prog = sy-repid.
      perform init_download(rsaqexce).
      case %tab.
      when 'G00'.
        perform generate_view_dynpro(rsaqexce)
                using prog text-grl.
        describe table %g00 lines anz.
        tview100-lines = anz.
        perform init_view(rsaqexce) tables %g00 using tview100.
        call screen 100.
        perform reset_view_dynpro(rsaqexce).
      when others.
        message s860(aq).
      endcase.
    endform.
    I think they were copied from existing SAP programs. In any event, look at the relevant forms in program rsaqexce.
    And as Rich noted, SAP doesn't recommend this.
    Rob

  • Needs sample ABAP code for field routine

    Dear Expert,
    There is a field "Pay Scale Group" in my DSO which stores the data in the format
    AA1/B1/CCC2/DD2/EEE1, A1/BB2/CC2/DDD3/EE2 etc. These data has to be transferred to
    InfoCube where "pay Scale Group" in the InfoCube will store the data like EEE1,EE2 etc.
    I need to write a field routine on the transformation between DSO and Cube.
    Can any one please help me with the sample ABAP code for this scenario.
    Some more examples for better understanding of the requirement:-
    Data in DSO(Source)            Data in Cube(Target)
    ===================            ===================
    AA1/B1/CCC2/DD2/EEE1            EEE1
    AAA1/BB2/CC1/DDD3/EE2           EE2
    A2/BBB2/CC2/DDD3/EEE5           EEE5
    AA2/BB1/C1/DDD3/EE3             EE3
    A3/B1/CC2/DDD1/EE4              EE4
    Many thanks in advance.
    Regards,
    Prakash
    Please do not dump your code requirements in SDN
    Edited by: Pravender on May 18, 2011 11:37 AM

    Hi,
    You can use the following code :
    Suppose the technical name of the field coming from DSO is ZPAY_SGRP.
    And also for example let me take one record, that is ZPAY_SGRP = AA1/B1/CCC2/DD2/EEE1 .
    My assumption is that there will always be 4 '/'.
    In the field routine write the below code
    data: V1(5) type c,
              V2(5) type c,
             V3(5) type c,
              V4(5) type c,
             V5(5) type c.
    data : VAR1 TYPE /BIC/OIZPAY_SGRP.
    split VAR 1  at '/' into V1 V2 V3 V4 V5.
    result = V5.
    V5 will be having the characters after the last '/' .That is V5 = EEE1.
    Hope the above reply was helpful.
    Kind Regards,
    Ashutosh Singh
    Edited by: Ashutosh Singh on May 17, 2011 3:53 PM
    Edited by: Ashutosh Singh on May 17, 2011 4:17 PM

  • Sample ABAP code for userexits, and calling bapi's

    Hi,
    Can someone please send me sample ABAP code
    1) to do extractor enhancement using user exit.
    2) ABAP program to call BAPI to read live cache order series data in SNP and write to Idocs through some ports.
    3) ABAP routine to generate file name (based on date/country)in the infopackage to upload flatfiles.
    Thank you very much in advance and appreciate any help.
    Regards
    Prasad

    hai ,
    check this code...
    *& Tables
    tables : tstc,     "SAP Transaction Codes
             tadir,    "Directory of Repository Objects
             modsapt,  "SAP Enhancements - Short Texts
             modact,   "Modifications
             trdir,    "System table TRDIR
             tfdir,    "Function Module
             enlfdir,  "Additional Attributes for Function Modules
             tstct.    "Transaction Code Texts
    *& Variables
    data : jtab like tadir occurs 0 with header line.
    data : field1(30).
    data : v_devclass like tadir-devclass.
    *& Selection Screen Parameters
    selection-screen begin of block a01 with frame title text-001.
    selection-screen skip.
    parameters : p_tcode like tstc-tcode obligatory.
    selection-screen skip.
    selection-screen end of block a01.
    *& Start of main program
    start-of-selection.
    Validate Transaction Code
      select single * from tstc
        where tcode eq p_tcode.
    Find Repository Objects for transaction code
      if sy-subrc eq 0.
        select single * from tadir
           where pgmid    = 'R3TR'
             and object   = 'PROG'
             and obj_name = tstc-pgmna.
        move : tadir-devclass to v_devclass.
        if sy-subrc ne 0.
          select single * from trdir
             where name = tstc-pgmna.
          if trdir-subc eq 'F'.
            select single * from tfdir
              where pname = tstc-pgmna.
            select single * from enlfdir
              where funcname = tfdir-funcname.
            select single * from tadir
              where pgmid    = 'R3TR'
                and object   = 'FUGR'
                and obj_name = enlfdir-area.
            move : tadir-devclass to v_devclass.
          endif.
        endif.
    Find SAP Modifactions
        select * from tadir
          into table jtab
          where pgmid    = 'R3TR'
            and object   = 'SMOD'
            and devclass = v_devclass.
        select single * from tstct
          where sprsl eq sy-langu
            and tcode eq p_tcode.
        format color col_positive intensified off.
        write:/(19) 'Transaction Code - ',
        20(20) p_tcode,
        45(50) tstct-ttext.
        skip.
        if not jtab[] is initial.
          write:/(95) sy-uline.
          format color col_heading intensified on.
          write:/1 sy-vline,
          2 'Exit Name',
          21 sy-vline ,
          22 'Description',
          95 sy-vline.
          write:/(95) sy-uline.
          loop at jtab.
            select single * from modsapt
            where sprsl = sy-langu and
            name = jtab-obj_name.
            format color col_normal intensified off.
            write:/1 sy-vline,
            2 jtab-obj_name hotspot on,
            21 sy-vline ,
            22 modsapt-modtext,
            95 sy-vline.
          endloop.
          write:/(95) sy-uline.
          describe table jtab.
          skip.
          format color col_total intensified on.
          write:/ 'No of Exits:' , sy-tfill.
        else.
          format color col_negative intensified on.
          write:/(95) 'No User Exit exists'.
        endif.
      else.
        format color col_negative intensified on.
        write:/(95) 'Transaction Code Does Not Exist'.
      endif.
    Take the user to SMOD for the Exit that was selected.
    at line-selection.
      get cursor field field1.
      check field1(4) eq 'JTAB'.
      set parameter id 'MON' field sy-lisel+1(10).
      call transaction 'SMOD' and skip first screen.

  • ABAP code for BI 7.0 transformations start routine

    Hi all,
    I am trying to update data from DSO1 (Source1: transaction data) to Infocube(TARGET)
    In the transformations Start routine, I have to read DSO2(Source2: Master data) for some fields.
    DSO1 has CUSTOMER as part of key
    DSO2 has CUSTOMER (key) and other fields....FIELD1, FILED2, FIELD3
    Infocube to be updated with FIELDS1,2 & 3 WHILE READING DSO2.
    WHERE DSO1 CUSTOMER matches with DSO2 CUSTOMER.
    Also, data NOT TO BE UPLOADED into Infocube if FIELD1 in DSO2= NULL
    Please give me the abap code for the above logic.
    Appreciate any help in this regard.
    Thanks.

    This is a doc from this site:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19
    Ravi Thothadri

Maybe you are looking for

  • How do I get my IPod Touch to be recognized by ITunes

    A few weeks ago I brought my Ipod Touch in to connect to ITunes to resynch (bring it up to date). It had been some time since I had done that even though the IPod was working just fine tethered to by 2012 VW Jetta by way of in-vehicle connection. Whe

  • How to use a custom css with a ditamap?

    I'm still trying to get to grips with some DITA Frame basics and another piece of info that I would like to have is how to get the ditamap to use a custom css when it is output to xhtml with the DITA OT. Is there any simple non-super-techie way to do

  • How to process a cvs file in vbscript

    I have a several folders on a server with part of the computer names.  The computer names are csimpam3353726, csimpam3379465, etc. The Folder names are just the numbers.  3353726, 3379465, etc...  These folders contain the favorites for each of the c

  • Need web service wrappers using XML

    I have written ABAP code to get o/p in XML.Below is theo/p in xml. <?xml version="1.0" encoding="utf-8" ?> - <Employees> - <Employee>   <EmployeeId>00000013</EmployeeId>   <Action>I</Action>   </Employee> - <Employee>   <EmployeeId>00000013</Employee

  • User threads in OC4J 10.1.2

    I have a servlet running in an OC4J container that kicks off a daemon thread. It looks like the thread ends when the OC4J instance is restarted... Can anyone confirm this? Also, does adding the -userThreads switch to the OC4J startup offer any advant