How to update line items if it exceeds 17 during creation of SO in va01.

Hi,
I have implemented one logic in mv45afzz for updating IO (internal order) with respect to line items during creation of SO through VA01.
It is working fine.
My problem is: For first 17th line items it is working fine , but those line items which come after 17th not working.
Please suggest.
Thanks,
Sakti

Hi,
Pls find the below code for your reference.
LOOP AT xvbap INTO wa_xvbap.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
        input  = wa_xvbap-matnr
      IMPORTING
        output = wa_xvbap-matnr.
    IF ( wa_xvbap-matnr = c_matno_1 OR
       wa_xvbap-matnr = c_matno_2 ) AND
       wa_xvbap-updkz <> 'D'.
*Before changing container number first check first check the IO attached to
*this container number fully settled or not.
      IF NOT yvbap[] IS INITIAL.
        SORT yvbap[] BY vbeln posnr.
        READ TABLE yvbap INTO wa_yvbap WITH KEY vbeln = xvbak-vbeln
                                                posnr = wa_xvbap-posnr
                                                BINARY SEARCH.
        IF sy-subrc = 0 AND
          ( wa_yvbap-arktx <> wa_xvbap-arktx OR
           wa_yvbap-z_container_no <> wa_xvbap-z_container_no.
          CALL FUNCTION 'CONVERSION_EXIT_OBART_INPUT'
            EXPORTING
              input  = c_sdi
            IMPORTING
              output = l_output1.
          CONCATENATE 'ORX'
                      wa_yvbap-z_container_no
                      INTO g_objnr1.
          SELECT SINGLE *
                      INTO wa_cobrb_sdi
                      FROM cobrb
                      WHERE objnr = g_objnr1 AND
                            konty = l_output1.
          IF sy-subrc <> 0.
            CONCATENATE 'ORY'
                          wa_yvbap-z_container_no
                          INTO g_objnr1.
            SELECT SINGLE *
                        INTO wa_cobrb_sdi
                        FROM cobrb
                        WHERE objnr = g_objnr1 AND
                              konty = l_output1.
          ENDIF.
        ENDIF.
      ENDIF.
*If the Io is fully settled, then can not change container number.
      IF wa_cobrb_sdi-ersja IS NOT INITIAL.
        MESSAGE s303(me) WITH 'Container can not be changed as IO already settled for' wa_yvbap-posnr.
        CLEAR:wa_yvbap,
              wa_cobrb_sdi,
              g_objnr1.
        PERFORM folge_gleichsetzen(saplv00f).
        fcode = 'ENT1'.
        SET SCREEN syst-dynnr.
        LEAVE SCREEN.
      ELSE.
*Check container number is initial or not
        IF wa_xvbap-z_container_no IS NOT INITIAL AND tcode = c_va01.
          CONDENSE wa_xvbap-z_container_no.
*Add 'X' to container number and serch for IO exist or not
          CONCATENATE c_x
                      wa_xvbap-z_container_no
                      INTO l_aufnr.
          SELECT SINGLE aufnr objnr
                     FROM aufk
                     INTO (g_aufnr,g_objnr)
                     WHERE aufnr = l_aufnr.
          IF sy-subrc = 0.  " AND wa_xvbap-arktx = l_aufnr.
            l_flag = 'X'.
          ELSE.
*Add 'Y' to container number and search for IO
            CONCATENATE c_y
                        wa_xvbap-z_container_no
                        INTO l_aufnr.
            SELECT SINGLE aufnr objnr
                      FROM aufk
                      INTO (g_aufnr,g_objnr)
                      WHERE aufnr = l_aufnr.
            IF sy-subrc = 0.  " AND wa_xvbap-arktx = l_aufnr.
              l_flag = 'X'.
            ELSE.
*Display error message if Io was not found or forgot to enter IO in description field
              MESSAGE s083(me) WITH 'IO was not found for' wa_xvbap-posnr.
              PERFORM folge_gleichsetzen(saplv00f).
              fcode = 'ENT1'.
              SET SCREEN syst-dynnr.
              LEAVE SCREEN.
            ENDIF.
          ENDIF.
       ELSE.
        ELSEIF tcode = c_va01.
*Display error message if user forget to enter container number
          MESSAGE s083(me) WITH 'container number for' wa_xvbap-posnr.
          PERFORM folge_gleichsetzen(saplv00f).
          fcode = 'ENT1'.
          SET SCREEN syst-dynnr.
          LEAVE SCREEN.
        ENDIF.
        IF l_flag EQ 'X'.
          CALL FUNCTION 'CONVERSION_EXIT_OBART_INPUT'
            EXPORTING
              input  = c_sdi
            IMPORTING
              output = l_output.
          CALL FUNCTION 'CONVERSION_EXIT_PERBZ_INPUT'
            EXPORTING
              input  = c_ful
            IMPORTING
              output = l_ful.
*Fetch 1st line of settlement rule
          CALL FUNCTION 'CONVERSION_EXIT_OBART_INPUT'
            EXPORTING
              input  = c_gl
            IMPORTING
              output = l_gl.
          SELECT SINGLE *
                INTO wa_cobrb_gl
                FROM cobrb
                WHERE objnr = g_objnr AND
                      konty = l_gl.
          IF sy-subrc EQ 0.
*Populate values for second line settlement
            wa_cobrb-objnr = g_objnr.            "OBJNR
            wa_cobrb-lfdnr = '003'.
            wa_cobrb-konty = l_output.           "Category
            wa_cobrb-kdauf = xvbak-vbeln.        "Order No
            wa_cobrb-kdpos = wa_xvbap-posnr.     "Item No
            wa_cobrb-prozs = c_percent.          "Percentage
            wa_cobrb-perbz = l_ful.              "Settlement
            wa_cobrb-extnr = c_no.               "No
            wa_cobrb-gabpe = wa_xvbap-erdat+4(2).      "From period
            wa_cobrb-gabja = wa_xvbap-erdat+0(4).      "From Fiscal
            APPEND wa_cobrb TO gt_cobrb.
          ELSE.
*Populate values for second line settlement
            wa_cobrb-objnr = g_objnr.            "OBJNR
            wa_cobrb-lfdnr = '003'.
            wa_cobrb-konty = l_output.           "Category
            wa_cobrb-kdauf = xvbak-vbeln.        "Order No
            wa_cobrb-kdpos = wa_xvbap-posnr.     "Item No
            wa_cobrb-prozs = c_percent.          "Percentage
            wa_cobrb-perbz = l_ful.              "Settlement
            wa_cobrb-extnr = c_no_1.               "No
            wa_cobrb-gabpe = wa_xvbap-erdat+4(2).      "From period
            wa_cobrb-gabja = wa_xvbap-erdat+0(4).      "From Fiscal
            APPEND wa_cobrb TO gt_cobrb.
          ENDIF.
          IF wa_cobrb_gl IS NOT INITIAL.
            wa_cobrb_gl-gbisp = wa_cobrb-gabpe - 1.
            wa_cobrb_gl-gbisj = wa_cobrb-gabja.
            APPEND wa_cobrb_gl TO gt_cobrb_gl.
          ENDIF.
     ELSEIF wa_cobrb-ersja IS NOT INITIAL.
       MESSAGE 'Container number can not be reassign' TYPE 'E'.
        ENDIF.
      ENDIF.
    ENDIF.
    CLEAR:wa_cobrb,
          g_objnr,
         wa_aufk,
          wa_cobrb_gl,
          wa_cobrb_sdi.
  ENDLOOP.
  IF l_flag EQ 'X'.
*Create 2nd line for settlement rule.
    SORT gt_cobrb[].
    DELETE ADJACENT DUPLICATES FROM gt_cobrb[].
    IF NOT xvbak-vbeln IS INITIAL AND tcode = c_va01.
      IF NOT gt_cobrb[] IS INITIAL.
        CALL FUNCTION 'K_SRULE_SAVE_UTASK'   "IN UPDATE TASK
          TABLES
            t_cobrb_insert    = gt_cobrb[]
          EXCEPTIONS
            srule_utask_error = 1
            OTHERS            = 2.
Thanks,
Sakti

Similar Messages

  • How to Update line items in a structure ?

    Hi i am getting 3 line items retrieved from a Function Module. But while displaying in the script it shows only the last line item. How do i update all the line items??
    The code is given below,
        CALL FUNCTION 'FI_PRINT_ZTERM'
             EXPORTING
                  I_ZTERM         = EKKO-ZTERM
                  I_LANGU         = EKKO-SPRAS
                  I_XT052U        = ' '
                  I_T052          = T052
             TABLES
                  T_ZTEXT         = ZBTXT
             EXCEPTIONS
                  ZTERM_NOT_FOUND = 01.
    Loop at ZBTXT.
        READ TABLE ZBTXT.
        IF SY-SUBRC EQ 0.
          PEKKO-ZBTXT = ZBTXT-LINE.
          DELETE ZBTXT INDEX 1.
    *      UPDATE PEKKO-ZBTXT.
        MOVE ZBTXT-LINE TO PEKKO-ZBTXT.
        ENDIF.
    ENDLOOP.
    And also how do i retrieve it in the script ?

    HI Navaneethan,
    please try following code.
    make  PEKKO should be internal table with appropraite structure..
    Loop at ZBTXT.
          MOVE ZBTXT-LINE TO PEKKO-ZBTXT.
          append  PEKKO.
         clear  PEKKO.
    ENDLOOP.
    loop at pekko.
    write : / PEKKO-zbtxt.
    endloop.
    if above code is helpful, REWARD POINTS.
    Regards,
    Ranjith

  • Urjent-how to add line items in tcode-FBL3N

    Hi Experts,
      How to add line items customer, customer name,  vendor and vendor name in FBL3N.
    Thanks in advance.
    mahe
    Moderator message - Please do not use words like "urjent". Please ask a specific question. Please search the forum. This question has been asked and answered before. Post locked
    Edited by: Rob Burbank on Apr 29, 2009 11:27 AM
    Edited by: Rob Burbank on Apr 29, 2009 11:28 AM

    Hi,
    Check the BTE's:
    00001020     POST DOCUMENT:       Prior to final checks             SAMPLE_INTERFACE_00001020
    00001025     POST DOCUMENT:       Final checks completed       SAMPLE_INTERFACE_00001025
    00001030     POST DOCUMENT:       Posting of standard data     SAMPLE_INTERFACE_00001030
    00001050     POST DOCUMENT:       Accounting interface           SAMPLE_INTERFACE_00001050
    Thanks & Regards,
    Harish

  • How to transfer Line Items

    Hi
    How to transfer Line Items from One GL account to another GL account.
    We, at the time of changing Non Open Item Manged account to Open Item Manged account, how can we transfer Line items to make this GL account Zero, If suppose line items are more than 200.
    Satish
    Points assured.

    If you are attempting to change the account from Non Open Item managed,  you need to make the account balance zero. The change will be be effective only for future transactions. You need not transfer all line items,  find the balance and  make an  entry to debit or credit to make it zero, to a temporary account. Later, once you have activated, you can reverse that transaction.
    The OSS 606977 refered may be helpful if you are looking for reverse activation. i.e from Open to Non Open. Here is a brief:
    Symptom
    In the G/L account master record, you can activate/deactivate the 'Open item management' indicator if the balance of the account is zero. In this case, the system does not check whether postings exist on the account.
    If postings exist, this could lead to problems, for example, if the clearing is reversed after the change to the indicator is made.
    Other terms
    FS00, FS02, FSS0, FS02, FH190, XOPVW
    Reason and Prerequisites
    The transactions for the maintenance of the G/L account master record did not check whether postings exist on the account. Now the program checks whether postings exist in the current year or previous two fiscal years.
    Solution
    Implement the attached correction or import the corresponding Support Package. Since it could make sense to change an account with balance zero from open item managed to non-open item managed (and vice versa) - despite postings to the account - the message is delivered as customizable (with error as a default setting).
    The check is also carried out, when open-item management is activated, is postings exist on the account.
    If you implement the note you must also carry out the following:
    Use Transaction SE91 to create message 190 in message class FH with the following text:
    Account balance = 0; however, postings exist on the account
    Use Transaction SM30 to insert the following entry into view T100S:
    Application area   FH
    MsgNo              190
    Allowed            EW
    Standard          E
    Afterwards, the message can be customized in View V_T100C. To do this, you can use Transaction OBA5.

  • How to get line item net price and net value?

    I have using "BAPI_SALESORDER_SIMULATE" to SIMULATE to create SO,
    the return table
    ORDER_ITEMS_OUT-NET_VALUE is not equals than created by VA01 .
    how to get line item net price and net value?

    Hi,
    Can u elaborate ur query ?
    By this FM you cannot create a SO . Use FM --> BAPI_SALESORDER_CREATEFROMDAT2
    Regards,
    MAdhukar Shetty

  • How to default Line item display in GL master record???

    Hi..Guys
    How to default Line item display selection in GL master creation.....When we create GL master it will automatically get selected.
    Is it possible to do.
    Plz reply .

    Hi
    With sample account you can succeed your requirement
    Give all the defualt fields whtatever you want then use this sample account while creating GL account
    One more possibility is with SHD0 screen layout change with defaults (this thing i am not sure)
    Reg
    Vishnu

  • BAPI_CUSTOMERCONTRACT_CHANGE - Updating Line Item Billing Plan

    Hi all,
    We're using the BAPI_CUSTOMERCONTRACT_CHANGE to update Contracts, which is nothing but updating fields in VA42.
    However for some reason it's not updating the Billing Plan date in the line items.
    Version: SAP 4.7 R/3 Enterprise.
    All OSS notes are up to date.
    How to pass data for billing plan in the BAPI.
    Any feedback regarding this matter is highly appreciated.
    Thanks
    Gopakumar
    Sr.SAP Tech.Lead
    [email protected]

    Hi Gopakumar,
    There is no separate structure to be filled out for the Billing Plan Tab. Since it is coming under the Item level, you have to use the item structure to fill in the data.
    Quickest way is, find out the "Data base structure field name" and check in the Item structure(BAPISDITM). i.e. for eg. for billing_block the field is "FAKSP" and the corresponding Item Structure field name is bill_block. you should fill this data in the structure (BAPISDITM) and set 'X' in the check_in structure (BAPISDITMX).
    CALL BAPI_CUSTOMERCONTRACT_CHANGE using update mode. You will get the data.
    Thanks and Regards
    Ratish

  • How to clean line items

    Hi,
    This is in 11.5.10.2.
    For Balance Sheet review/clean up of GL Accounts, we are facing following Problems.
    When we query a particular GL account the number of lines fetches are more than 6 lakhs line items due to which we are not able to extract complete dump .
    The data Extracted is not getting classified into open and cleared items (Clearing) at GL level and therefore the data line items are enormous. Can you suggest something in this regard as to how to proceed further? IF you can share the methodology being adopted by any of you, it will be a great help.
    Thanks

    Hello.
    Can you please try the following query? I'm not sure were are you keeping the data that indicates that the lines are not adjusted so i included the JGZZ_RECON_STATUS field but you can adjust the query to your needs.
    SELECT l.effective_date,
    h.je_source,
    h.je_category,
    l.description,
    nvl(sum(l.accounted_dr),0),
    nvl(sum(l.accounted_cr),0),
    l.jgzz_recon_status
    FROM gl_je_lines l,
    gl_je_headers h
    WHERE l.je_header_id = h.je_header_id
    AND l.set_of_books_id = <your set_of_books_id>
    AND l.effective_date >= '1-jul-09'
    AND l.effective_date <= '2-jul-09'
    GROUP BY l.effective_date,
    h.je_source,
    h.je_category,
    l.description,
    l.jgzz_recon_status
    Hope this helps, otherwise repost.
    Octavio

  • Order creation logic how to pass line items

    experts
    i have the following data in iternal table itab.
    po number ,customer number, matnr,quantity ,order date.
    1212838383  7494749  8383938833   20  20032009
    1212838383  7494749  8383938832   10  20032009
    1212838382  7494749  8383938833   20  20032009
    1212838384  7494745  8383938823   30  22032009
    1212838384  7494745  8584858588   05  22032009
    now i want to populate this data into idocs orders segement .
    for all po the customer will be the same and i need to create one order for that.
    in the above data first 2 lines have same po so i need to create order with 2 line items.
    sales org,division,distribution channnel,ordertype will be same for all the records.
    loop at itab into workarea.
    at new po. "for same po, same header data so i am using AT NEW
    edi_dd40-segnum = 1.
    edi_dd40-segnam = 'E2EDK14 '.
    edi_dd40-mandt = sy-mandt.
    edi_dd40-psgnum = psgnum.
    e2edk14-qualf = '008' .
    e2edk14-orgid = 'NN21.
    MOVE e2edk14 TO edi_dd40-sdata.
    append edi_dd40 to itab_output.
    edi_dd40-segnum = 1.
    edi_dd40-segnam = 'E2EDK14 '.
    edi_dd40-mandt = sy-mandt.
    edi_dd40-psgnum = psgnum.
    e2edk14-qualf = '006' .
    e2edk14-orgid = 'ni.
    MOVE e2edk14 TO edi_dd40-sdata.
    append edi_dd40 to itab_output.
    endat.
    now the item data comes , so i need to create items with same po.and afetr this i need to submit this data to fm before another diffent  po comes.below same customer and po so need to consider as one sales order and submit to fm.
    item1  1212838383  7494749  8383938833   20  20032009
    item2  1212838383  7494749  8383938833   20  20032009
    call function 'MAST_IDOC_DISTRIBUTE'
    My concern is how to tell to the system for the same po create the order with multipl line items , do i need to use to AT NEW
    or some other commands above?
    endloop.

    i have used at end of po. but my matnr is becoming *************. no date is showing in the internal table while populating the matnr to segments.
    Loop at itab into workarea.
    at end of po.
    here i am filling the matnr to the segment. here  workarea-matnr is showing ***********  only stars,
    endat.
    endloop.
    If i remove the at end of po , then the matnr is comming .
    Please sugggest me what to do.
    my fields sequence are like this.
    kunnr " customer
    bstnk "po
    matnr " material
    currency
    kwmeng "order quantity
    podate
    orderdate
    so how to handle this please suggest.

  • How to reject Line Items in a Service Contract?

    Hello friends,
    Can anyone help me understand how do we reject items in a Service Contract? I don't see any Reject field. Is it one of the Status I need to configure for Item Level Status Profile? Even if I add a 'Reject' status, how do I link it to Rejection Reason codes? (I know how to add Reason codes in customizing, but how they are linked to a Transaction type is something I am not finding...).
    Please provide any inputs.
    Thanks.

    HI Navaneethan,
    please try following code.
    make  PEKKO should be internal table with appropraite structure..
    Loop at ZBTXT.
          MOVE ZBTXT-LINE TO PEKKO-ZBTXT.
          append  PEKKO.
         clear  PEKKO.
    ENDLOOP.
    loop at pekko.
    write : / PEKKO-zbtxt.
    endloop.
    if above code is helpful, REWARD POINTS.
    Regards,
    Ranjith

  • How to clear line items in accounts not managed on an open item basis

    We are getting ready to archive FI accounting documents from years 1993-2002.  We encountered a great deal of documents that did not archive during testing because the documents have open items.  We were given bad advice in the beginning on how to set up accounts. Several accounts were not set up on an open item basis and these accounts will not get archived until the line items are cleared. We have set up new accounts to replace these accounts that are now being managed on an open item basis. Our FI users are unable to clear the documents using F-03. Does anyone have a way of clearing these type of documents (not managed on an open item basis)?  Thank you in advance.

    One of our users has proven that the line items on GL accounts not managed on an open item basis are not holding up the archiving. The reason for many documents not archiving is that the item posted to the vendor is still open.
    thanks!

  • How to select line items in recording(BDC)

    Hi All,
    we are trying to Recording QP02 transaction ,we have inputs like material,plant,Group,Group Counter.
    after entering these inputs we will get multiful line items(inspection characteristics).we need to check one field for each item.
    How can we get this?
    Please help me?
    Thanks,
    Peddi reddy.

    Hi Kamesh,
    Thanks.
    After selecting line items i am selecting control indicators Tab.
    then Pop up screen called as (Edit characteristic control indicators) will open ,..then just pressing enter..the it will show another pop up ..here i am selecting one field(Long term Inspection)..the process has to do for all line items.
    In My program i have copied BDC performs which i got from Recording.
    Do i need to change tha performs or will it work?
    i tested in foreground with another material .... upto 3 or 4 line items its working fine.after that sytem does.t say anything.
    if i need to chage performs please help me .

  • How to give line items in flatfile while doing BDC for Table control

    Hi all,
    I am writing BDC for Multiple line items and Transaction  is : FSE5N.
    How do i give the data in the flat file. I mean how do we give the multiple line items in flat file , i.e for second line item again we have to header data or not ?
    ex:
    1015;ALL;demo;kr;INR;01;0001;3000172;100
    1015;ALL;demo;kr;INR;01;0001;3000172;200
    for first lineitem  : 3000172;100
    for 2nd line item : 3000172; 200.
    header data : 1015;ALL;demo;kr;INR;01;0001.
    Thanks in advance
    krupali

    Hii ,
    u can give in the same format as u have done in the example.
    A       B    C     D  E    F   G        H          I
    1015;ALL;demo;kr;INR;01;0001;3000172;100
    1015;ALL;demo;kr;INR;01;0001;3000172;200
    and while writing the loop u can give
    loop at it_head.
    loop at it_head where a = it_head-A and b = it_head-B ..........upto G = it_head-G.
      endloop.
    endloop.
    check this
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    Neeraj

  • How to show line items repeating n times alternatively or assa sets

    Dear All
    Situation: Here is my problem. I have have editable ALV which saves the
    data on pressing save. The no. of qty against an invoce gets repeated on
    the basis of input from the selection screen.
    Problem Area: For example if user entered invoce number and 2 at one field
    in selection screen so if there were 2 line items against the invoce both of
    them should be repated 2 and 2 times. Right now if there are 2 line items
    and user entered 4 so first line item will be shown 1 times and second will
    be repeated 3 times.
    Question how can I have both the line items to appear 4 and 4 times
    instead of the current situation described above.
    I would appreciate help all the senior members of the ABAP group.
    Regards,
    Anurag Jain

    Dear All
    Situation: Here is my problem. I have have editable ALV which saves the
    data on pressing save. The no. of qty against an invoce gets repeated on
    the basis of input from the selection screen.
    Problem Area: For example if user entered invoce number and 2 at one field
    in selection screen so if there were 2 line items against the invoce both of
    them should be repated 2 and 2 times. Right now if there are 2 line items
    and user entered 4 so first line item will be shown 1 times and second will
    be repeated 3 times.
    Question how can I have both the line items to appear 4 and 4 times
    instead of the current situation described above.
    I would appreciate help all the senior members of the ABAP group.
    Regards,
    Anurag Jain

  • How to findout line  items of zero balance clearing account?

    Hi Friends,
    my zero balance clearing account shows balance.
    we have 6 business areas and document splitting activated.
    Trial balance is matching at co.code level.but its mis matching at business area level.
    Line item management is checked in the master data of zero balance clearing account.
    How to find out the line items of the zero bal.clearing account so that i ll get the relevant business area amount and ll pass journal entry accordingly and ll get the balanced trial balance at business area level.
    What is the table for zero balance clearing account line items?
    suggest.
    Regards,
    Sumeay

    Dear
    I am also facing the same problem. We are having 7 business areas. Trial balance is tallied even at busness area level. However, the zero balance clearing account is showing balance in each business area ( we can say "inter business area balncess.").
    Please help
    Regards.

Maybe you are looking for

  • Problem in RWB of PI 7.1

    Hello All, I have installed PI 7.1 on Solaris with Oracle DB...Installation went fine but i am unable to see the Adapters whicg are installed..i have imported the .TPZ file also.. When i got to Runtime Work Bench and click --> DOMAIN <SID>           

  • Problem with ADO

    I have defined a view to get the data from an XMLTYPE table into relational form. I have a problem with opening this view with ADO and Delphi 6. If I define my view like this: CREATE OR REPLACE VIEW xml_test (versionsnr) AS SELECT extractValue(value(

  • Syncing iPad back to iTunes

    I accidentally deleted some video files out of my iTunes account which are still on my iPad. How can I sync them back to my iTunes account. I don't have MobileMe to use.

  • Need urgent help on nested tables

    Everywhere i could find a single nested table but not two. Can anyone help me on how to access and assign multi nested tables ? Declare Type a is table of varchar2(1000); Type b is table of a; v_temp b; Begin How can i assign and access variable of v

  • How do I add numbers to contact groups I've created

    Ive created a list of sub-groups for my fairly extensive contact list, but I can't figure out how to add contacts to these subgroups without having to re-enter the contact info as a "new contact".   Is it possible to select from my "All Contacts" lis