Coding help reqd for BADI - looping strategy

Hi friends,
Pls help me to post some example codes for looping the table control data items.
i.e., Details available in table control item in MIGO.
Ex:
LINE     Material text        Qty
1             INGOT              5.0      
1             INGOT              2.5
1             INGOT              10.0
1             FURNACE OIL  180.0
Pls help me,How to loop this table control items , so that i want to sum the consolidated qty by material wise.
the fileds are cs_goitem-matnr and cs_goitem-qty.
FYI, the cs_goitem is a structure of MIGO.(cant do it for looping)
Post ur comments with sample codes.
thanks & reagrds
sankar.
Edited by: sankar babu on Jan 2, 2008 10:14 AM

Hello Sankar.
You can write the code needed in the POST_DOCUMENT method of the BAdI where you have the IT_MSEG table, so that you can loop it and collect the qty you need.
For example:
data: ls_mseg type MSEG.
data: begin of i_coll_qty occurs 0,
           matnr type matnr,
           menge type menge_d,
        end of i_coll_qty.
loop at it_mseg into ls_mseg where shkzg = 'S'.
    i_coll_qty-matnr = ls_mseg-matnr.
    i_coll_qty-menge = ls_mseg-menge.
    collect i_coll_qty.
endloop.
Please reward if helpful.
Regards,
George

Similar Messages

  • Coding help reqd for BADI

    HI Friends,
    Im working on MB_MIGO_BADI object for MType: 261.Here, im facing a problem to call a info msg with coding effect.i.e, I've to give a conditional message says that if the user tries to change the quantity (changing the existing/available in the field text of MIGO), then it'll give a window pop-up message or info msg like "Quantity should not be changed". Pls reply ur post how to fix this.
    The fields are
    1) cs_goitem-bwart " MType
    2) cs_goitem-erfmg "Quantity
    Note: A) It'll be applied only for MType:261.
              B) Pls advise, Here, shall I declare the export and import memory id concept?
    FYI
    ******Below is the coding part declared inside the method function.
    method IF_EX_MB_MIGO_BADI~LINE_MODIFY.
    if cs_goitem-bwart eq '261'.
    *cs_goitem-erfmg is not initial and
    *call function 'CUSTOMIZED_MESSAGE'
    *exporting
    Message i006(zmsg).
    endif.
    endmethod.
    Above, it helps only showing the info msg while entering the mtype: 261.But i need to display it only if the cursor comes into Qty (ERFMG) field. Pls advise me how to fix with ur coding example.
    mail me:[email protected]

    Posted newly since one of the issue got solved.
    thanks

  • Coding help reqd for cs_goitem-erfmg

    Hi friends,
    In MIGO, and Qty field ERFMG...i want to put a coding check that it should display a message as "Quantity should be minimum of 10% less and maximum of 20% high only",whenever the user tries to change the value of the field(existing value from the order #).
    the field is cs_goitem-erfmg....
    FYI.
    I know the badi implementation and assinged it also.the coding part is not coming perfectly what i needed.
    Pls do reply, if anyone have sample code or have solutions how to declare it.
    thanks & regards
    sankar.

    hi,
              I have the same requirement please can u tel me how did u solve it....
    thanks and regards...
    Mady

  • Package Help needed For each Loop container

    Hello all,
    I need a bit of advice, I`m a newbee to SSIS so I`m learning. Here`s what I need. I have a EDI 837 file which needs to be converted and inserted into a sql table. These are multiple files and I need to maintain them with a monthly load. So I have a source
    folder where these files will be dumped. I created a Package which will grab the files process the EDI aspect inserts into the data into table. This is the story on a high level.
    Here`s what I did.
    Created a For each loop container.
    I have a stored proc which takes in a 837 files and gets the fields what I want and it inserts it into a staging table from there I have a data flow task which pipes it into my production table.
    Inside the loop first task is to exec the Stored Proc but my question is once a file is picked up from for each loop I need the file to be inserted into a table which I am referencing in my store proc. All the EDI conversion takes place in my SP and it references
    the table..
    My question is the For each loop container picks up the files but where does the data goes?? Can someone help me out
    FM

    The foreach loop container (file enumerator) only returns the filename or filepath which you can use as a parameter in an Execute SQL Task or within an expression on a connection manager (which can be used in a Data Flow). So it doesn't do anything with
    the file. You have to add a task within the loop to do something with the file (Execute SQL Task/Data Flow Task/File System Task/etc.).
    Please mark the post as answered if it answers your question | My SSIS Blog:
    http://microsoft-ssis.blogspot.com |
    Twitter

  • Urgent: please help me for BADI in CRM

    Hi,
    Could you please find me the Order check BADI in CRM .
    Answered will be rewarded .
    Requirement:- The average weight can be derived from the total weight during order entry by dividing the total weight by number of items. As is done in posting cheque entry.
    Thanks In Advance
    -Regards.

    Hi Maddela,
    u can find BAdIs in different ways...
    1>First go to any transaction->iN THE menu bar SYSTEM->STATUS->Get the program name ->double click->u will go to the program attached to the tcode.Now search term will be CALL CL_EXITHANDLER.Now u will get list of BADI'S available..
    2>Goto SE24->Give class name as CL_EXITHANDLER->Display->double click on get_instance mathod->Now u will go inside the method->Now put break point on the cl_exithandler.Now go to any transaction code and pass dat..U will see that it will be stopped on the break point which u set on the cl_exithandler...In the exit name u can find list of badi's attached to the tcode..
    There are multiple ways of searching for BADI.
    • Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE
    • Finding BADI Using SQL Trace (TCODE-ST05).
    • Finding BADI Using Repository Information System (TCODE- SE84).
    1. Go to the Transaction, for which we want to find the BADI, take the example of Transaction VD02. Click on System->Status. Double click on the program name. Once inside the program search for ‘CL_EXITHANDLER=>GET_INSTANCE’.
    Make sure the radio button “In main program” is checked. A list of all the programs with call to the BADI’s will be listed.
    The export parameter ‘EXIT_NAME’ for the method GET_INSTANCE of class CL_EXITHANDLER will have the user exit assigned to it. The changing parameter ‘INSTANCE’ will have the interface assigned to it. Double click on the method to enter the source code.Definition of Instance would give you the Interface name.
    2. Start transaction ST05 (Performance Analysis).
    Set flag field "Buffer trace"
    Remark: We need to trace also the buffer calls, because BADI database tables are buffered. (Especially view V_EXT_IMP and V_EXT_ACT)
    Push the button "Activate Trace". Start transaction VA02 in a new GUI session. Go back to the Performance trace session.
    Push the button "Deactivate Trace".
    Push the button "Display Trace".
    The popup screen "Set Restrictions for Displaying Trace" appears.
    Now, filter the trace on Objects:
    • V_EXT_IMP
    • V_EXT_ACT
    Push button "Multiple selections" button behind field Objects
    Fill: V_EXT_IMP and V_EXT_ACT
    All the interface class names of view V_EXT_IMP start with IF_EX_. This is the standard SAP prefix for BADI class interfaces. The BADI name is after the IF_EX_.
    So the BADI name of IF_EX_CUSTOMER_ADD_DATA is CUSTOMER_ADD_DATA
    3. Go to “Maintain Transaction” (TCODE- SE93).
    Enter the Transaction VD02 for which you want to find BADI.
    Click on the Display push buttons.
    Get the Package Name. (Package VS in this case)
    Go to TCode: SE84->Enhancements->Business Add-inns->Definition
    Enter the Package Name and Execute.
    Here you get a list of all the Enhancement BADI’s for the given package MB.
    The simplese way for finding BADI is
    1. chooes Tcode Program & package for that Tcode.
    2. Go to Tcode se18
    3. Press F4
    4. search by package or by program.
    Regards,
    Ashish

  • Help reqd for coding to assign the  field as mandatory.

    HI all,
    I got the user exit and also assigned the component as "EXIT_SAPLMRIM_002"..im now here to create a code under the include program of "ZM08U09"....for to make the amount field as mandatory(obligatory)..with some pop-up message...
    how to do that....
    Do u people have any experience on this...pls post ur comments on urgent basis.
    thanks & regards
    sankar.

    Hi Sriram.P
    thanks for ur prompt reply
    ...but actually,my problem is...i dont know the exact table for miro (invfp-wrbtr showing in the screen)....i've already prepared some coding but the table i've mentioned is not the correct one...
    Do u know the table for Incoming invoices records (MIRO)
    thanks & regards
    sankar.

  • Coding help reqd

    Hi friends,
    In MIGO, and Qty field ERFMG...i want to put a coding check that it should display a message as "Quantity should be minimum of 10% less and maximum of 20% high only",whenever the user tries to change the value of the field(existing value from the order #).
    the field is cs_goitem-erfmg....
    FYI.
    I know the badi implementation and assinged it also.the coding part is not coming perfectly what i needed.
    Pls do reply, if anyone have sample code or have solutions how to declare it.
    thanks & regards
    sankar.

    Hi Sankar,
    Please post your coding and explain what "is not coming perfectly" and we might be able to help you.
    Regards,
    John.

  • Help reqd for finding TAXES & CONDITIONS FOR GIVEN PO IN SAP-SCRIPT

    HI ALL,
             Currently iam working on SAP-SCRIPT developing PO in that i displayed fields like EMATN TYPE EKPO-EMATN,( material no. )
                 TXZ01 TYPE EKPO-TXZ01, ( long text )
                 MEINS TYPE EKPO-MEINS, ( units )
                   MENGE TYPE EKPO-MENGE (quantity)
    now i want to display taxes & conditions for given ematn no.( material no . ) so from which tables i should get the data  how to display. plz help me.
    thanks in advance.
    Regards,
    mahesh dudam

    Hi !!
      for this please study teh following extract :
    All pricing values are maintained in the KONV table for the respective pricing condition . Extract these values from KONV table by passing EKKO-KNUMV values for the Purchase order number from the EKKO purchase order header table .
    ************************************************************************88
    FORM GET_PRICING_DATA  USING    P_KNUMV.
      SELECT * INTO TABLE I_KONV
                FROM KONV
                WHERE KNUMV = WA_EKKO-KNUMV.
      IF SY-SUBRC = 0.
        SORT I_KONV.
      ENDIF.
    ENDFORM.                    " GET_PRICING_DATA
    *&      Form  get_tax_details
    extract Tax item details.
         -->P_EBELp  for purchase order item.
    FORM GET_TAX_DETAILS  USING    P_EBELP.
      DATA : L_OCTROI LIKE KONV-KWERT,
            L_BASE LIKE KONV-KWERT,
            L_OTHERS LIKE KONV-KWERT,
            L_DISCOUNT LIKE KONV-KWERT,
            L_PFORWARD LIKE KONV-KWERT,
            L_INSU LIKE KONV-KWERT,
            L_NUM LIKE I_KONV-KUMZA VALUE 1,
            L_DENO LIKE I_KONV-KUMNE VALUE 1,
            L_KPEIN LIKE KONV-KPEIN VALUE 1,
            L_FRT LIKE KONV-KWERT,
            L_CHAR(15).
    *-- getting numerator and denominator for base value.
      READ TABLE I_KONV  WITH KEY KSCHL = 'PBXX'.
      IF SY-SUBRC = 0.
        L_NUM = I_KONV-KUMZA.
        L_DENO = I_KONV-KUMNE.
        L_KPEIN = I_KONV-KPEIN.
      ELSE.
        READ TABLE I_KONV  WITH KEY KSCHL = 'PB00'.
        IF SY-SUBRC = 0.
          L_NUM = I_KONV-KUMZA.
          L_DENO = I_KONV-KUMNE.
          L_KPEIN = I_KONV-KPEIN.
        ELSE.
          READ TABLE I_KONV  WITH KEY KSCHL = 'P001'.
          IF SY-SUBRC = 0.
            L_NUM = I_KONV-KUMZA.
            L_DENO = I_KONV-KUMNE.
            L_KPEIN = I_KONV-KPEIN.
          ELSE.
            READ TABLE I_KONV  WITH KEY KSCHL = 'P000'.
            IF SY-SUBRC = 0.
              L_NUM = I_KONV-KUMZA.
              L_DENO = I_KONV-KUMNE.
              L_KPEIN = I_KONV-KPEIN.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
      CLEAR : V_OCTROI,V_OTHERS, V_DISCOUNT,V_PFORWARD,V_INSU,V_FTR.
      LOOP AT I_KONV WHERE KPOSN = P_EBELP.
    *-- Considering the numerator denominator and UOPricing
        IF   I_KONV-KPEIN = 0  .
          I_KONV-KUMZA = 1.     " Numerator
          I_KONV-KUMNE  = 1.    " Denominator
          I_KONV-KPEIN  = 1.    " Unit of pricing
        ENDIF.
       IF NOT I_KONV-KWERT  IS INITIAL .
         IF  I_KONV-KRECH = 'C'  AND  I_KONV-KSCHL <> 'PB00'
           AND I_KONV-KSCHL <> 'PBXX'.
           I_KONV-KWERT  = ( I_KONV-KWERT * I_KONV-KUMZA  )
                           * L_KPEIN / ( I_KONV-KUMNE * I_KONV-KPEIN ).
         ELSEif I_KONV-KRECH = 'C'  AND  I_KONV-KSCHL = 'PB00'
           AND I_KONV-KSCHL = 'PBXX'.
           I_KONV-KWERT  = ( I_KONV-KWERT * L_NUM * L_KPEIN ).
                          / ( L_DENO ).
        elseif I_KONV-KRECH = 'A'  AND  I_KONV-KSCHL = 'PB00'
           AND I_KONV-KSCHL = 'PBXX'.
           I_KONV-KWERT  = ( I_KONV-KWERT * L_NUM * L_KPEIN )
                            / ( l_deno ).
         ENDIF.
       ENDIF.
        CASE I_KONV-KSCHL.
    *-- For base price
          WHEN 'PB00'.
            L_BASE = L_BASE + I_KONV-KWERT.
          WHEN 'PBXX'.
            L_BASE = L_BASE + I_KONV-KWERT.
          WHEN 'P000'.
            L_BASE = L_BASE + I_KONV-KWERT.
          WHEN 'P001'.
            L_BASE = L_BASE + I_KONV-KWERT.
    *-- For octroi
          WHEN 'JOCM'.
            L_OCTROI = L_OCTROI + I_KONV-KWERT  .
    *-- For discount calculation
          WHEN 'ZDT%'.
            L_DISCOUNT = L_DISCOUNT + I_KONV-KWERT .
          WHEN 'ZDN%'.
            L_DISCOUNT = L_DISCOUNT + I_KONV-KWERT.
          WHEN 'ZDTV'.
            L_DISCOUNT = L_DISCOUNT + I_KONV-KWERT .
          WHEN 'ZDNV'.
            L_DISCOUNT = L_DISCOUNT + I_KONV-KWERT.
    *--- For packing forwarding .
          WHEN 'ZPNV'.
            L_PFORWARD = L_PFORWARD + I_KONV-KWERT.
          WHEN 'ZPN%'.
            L_PFORWARD = L_PFORWARD + I_KONV-KWERT.
    *--- For frieght .
          WHEN 'ZFTV'.
            L_FRT  =  L_FRT + I_KONV-KWERT.
          WHEN 'ZFT%'.
            L_FRT  =  L_FRT + I_KONV-KWERT.
          WHEN 'ZFNQ'.
            L_FRT  =  L_FRT + I_KONV-KWERT.
    **-----for others
         WHEN 'ZOTV'.
           L_OTHERS  =  L_OTHERS + I_KONV-KWERT.
         WHEN 'ZOT%'.
           L_OTHERS  =  L_OTHERS + I_KONV-KWERT.
         WHEN 'ZOTP'.
           L_OTHERS  =  L_OTHERS + I_KONV-KWERT.
         WHEN 'ZONV'.
           L_OTHERS  =  L_OTHERS + I_KONV-KWERT.
         WHEN 'ZON%'.
           L_OTHERS  =  L_OTHERS + I_KONV-KWERT.
         WHEN 'ZONP'.
           L_OTHERS  =  L_OTHERS + I_KONV-KWERT.
    *--- for insurance
          WHEN 'ZINV'.
            L_INSU  =  L_INSU + I_KONV-KWERT.
          WHEN 'ZIN%'.
            L_INSU  =  L_INSU + I_KONV-KWERT.
          WHEN OTHERS.
            CONTINUE.
        ENDCASE.
        CLEAR I_KONV.
      ENDLOOP.

  • Help reqd for printing the word text into two lines(AMOUNT in Rupees)

    Hi all,
    Im working for cheque printing and in the Amount in words column....im getting the text in a single line...as i've made it as in my script.
    (im moving the rate in to amount thru FM "HR_IN_CHG_INR_WRDS"....
    and it displaying into a single line....)
    But in every bank cheque...we have only a limit space for the first line and balance words should come in to the next line....How to achieve this in my form print.(when im giving the cheque(laser print) inside the printer for print)...
    *******FYI..
    now im getting it as
    RUPEES Ninety Seven Thousand Thirty seven and four paise only.(its going out in my cheque as it's coming in a single line,going beyond the words column)
    the above one...i want to print it as two lines as like in normal cheque...
    what condition i've to give and how to split the text or make it to continue in the second line....
    Pls do the needful with any examples or any coding.....
    help needed
    thanks & regards
    sankar

    hi Nehal,
    the below one is my coding part........FYI
    DATA AMT LIKE REGUD-WAERS.
    data: words(120) type c,AMOUNT(120).
    data: ant like PC207-betrg,t like reguh-vblnr,t1 type int4.
    FORM WORDS TABLES intab
    STRUCTURE itcsy outtab
    STRUCTURE itcsy.
    READ TABLE intab INDEX 1.
       t   = intab-value.
    select single RWBTR from reguh into ant where vblnr eq t.
    ant = ant * ( -1 ).
    CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
    EXPORTING
    AMT_IN_NUM               = ant
    IMPORTING
    AMT_IN_WORDS             = words.
    amount = words.
    READ TABLE outtab INDEX 1.
      MOVE WORDS TO outtab-value.
      MODIFY outtab INDEX 1.
    ENDFORM.                    "diff
    with the above code,im getting the amount field in a single line and it goes out beyond the line specified.
    How to split it as a length basis as u said....pls explain in detail...
    thanks & regards
    sankar

  • Help needed for badi while posting MB1A

    Hi,
    I used a badi defn MB_DOCUMENT_BADI and used a method MB_DOCUMENT_BEFORE_UPDATE while posting MB1A BUT ITS NOT WORKING FOR MB1A.THIS BADI IS WORKING FOR MIGO, MB1C
    CAN YOU PLEASE HELP ME IN THIS REGARD .ITS VERY URGENT.
    THANKS
    ESWAR

    Hi Eswar,
    Try this one.
    IF_EX_MB_DOCUMENT_BADI~MB_DOCUMENT_UPDATE.
    Chk this link http://www.geocities.com/rmtiwari/Resources/MySolutions/Dev/Codes/Enhancements/ZCL_MB_DOCUMENT_SAVE.html
    Also check this thread. See if this solves your issue.
    Re: Goods Issue
    Reward Points if Useful..
    All the Best!
    Gokul

  • Help need for badi method me_process_po_cust~check

    Dear All expert
    Pl see following thread
    I am stuck
    Help needed
    http://scn.sap.com/thread/3610303

    See the issue here is HOLD feature in PO should not be there if it meets the error condition.
    For this you can refer another BADI for this purpose ME_HOLD_PO.
    Refer one of my previous threads below , it might be helpful :
    Held Purchase order need not be created.
    Reiterating a thread related to same topic is not a good practice.

  • Help outline for a LOOP

    Im trying to make one loop using JBuilder.
    Im using the while(stdin.peek() != 'q').
    I know how to make it prompt the user 1 time to enter a number but where would I use the while(stdin.peek() != 'q') and If they dont type q how does it ask the user again to enter a number if Im only using double x = ? Is there a better way than contantly using (double x = ) and so on using differnt numbers? Im not sure where to put the while and the if and else. I keep getting no if with else statement. Then if the user is typing numbers on a new line over and over once q is typed It should be able to add all the numbers together. I dont know how to add numbers together from differnt lines.
    Can someone outline the order of where the while, if and else. Also help me take all the numbres that the user entered and add them up? I always end up with the print line printing over and over when I type q.
    Thank you
    Rewind

    I tried this again.It compiled but It keeps skiping lines before asking for a number again. then When I press q it says invalid responce and continues to print a blank line. Eventually after pressing q a bunch of times it gives you the total but the total does not give the total of the decimal numbers added together. I dont know what its adding together or where that number is comeing from.
    HELP PLEASE
    Thank you
    Rewind
    public class excercise1
      public static void main(String[] args)
        EasyReader stdin=EasyReader.getStdin();
        double total = 0.0;
        do
        System.out.println("Enter decimal numbers. Press q to quit ");
        double x = stdin.doubleQuery("Enter a decimal number: ");
               total += x;
       while (stdin.peek() != 'q');
              System.out.println("Your total is: " + total);
    [code\]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Help reqd for Selection Screen Input paramter

    Hi Friends,
    I've developed a noraml ALV grid report which have Date selection option as input selection parameter. In that , I want to declare last month date as defualt value to date-low range. Whenever the Tcode is entered, it should show the date ranges with my default values as date-low is last month date and date-high is current system date (this one I've given as sy-datlo).
    Please help me how to declare last month date to my low range field.
    thanks & regards
    sankar.

    Hi Suhas,
    i think so there is no need to specify the sign and options.
    SELECT-OPTIONS:so_dat for sy-datum.
    INITIALIZATION.
    so_dat-low = sy-datum.
    so_dat-high = sy-datum.
    append so_dat.
    START-OF-SELECTION.
    BREAK-POINT.
    it assigns BT by default.
    Sankar:Please provide your code

  • Help reqd for a newbie on Oracle App Server 10g

    I installed Oracle 10g Appserver. I have used Websphere, WebLogic and other App servers. But, Iam completely new to Oracle 10g App Server. Can you guys help me how to go about it to deploy an application on Oracle 10g App Server and if any pointers are there, they are very very helpful.
    First of my problems, is that, it is asking me for "Enter your single sign-on username and password", when I give oc4jadmin/oc4jadmin, its giving "Incorrect username or password". Can someone give me a pointer to docs, if any to resolve these issues.
    TIA.
    Thanks a lot.
    Prashanth Babu.

    Hi Hamdy,
    Thanks for the quick response. I got the document on the deployment.
    I have installed Oracle Application Server SOA suite 10.1.3.1.0 (for WindowsXP) on my machine. I did a "Basic Install" on this.
    Iam not able to understand what to do with the problem of SSO.
    Any inputs for the problem would be of great help. Thanks a ton for the same.
    Regards,
    Prashanth Babu.

  • Help needed for badi HRHAP00_COL_ACCESS

    Hi
    based on the Appraisal Status, appraisal sub status and column owner like HR ADMIN, Employee i need to set access level to change, display or change& display.
    For ex: if Appraisal Status is IN PLANNING.... Column Owner is Employee / HR MAtrix then access level should be change and display
    How do i know who is accessing the document... whether appraiser or appraisee...
    i creted a z implementation for the badi and gave a filter value as zappraiser_appraisee.... will this filter contains whether appraiser or appraisee is accessing the document....
    in detail explanation is highly appreciated
    regards
    ajay

    Hi Eswar,
    Try this one.
    IF_EX_MB_DOCUMENT_BADI~MB_DOCUMENT_UPDATE.
    Chk this link http://www.geocities.com/rmtiwari/Resources/MySolutions/Dev/Codes/Enhancements/ZCL_MB_DOCUMENT_SAVE.html
    Also check this thread. See if this solves your issue.
    Re: Goods Issue
    Reward Points if Useful..
    All the Best!
    Gokul

Maybe you are looking for