Function Module to Edit Billing Document Header (table VBRK)

Hi all,
Can someone tell me if there is a function module that can edit the billing document header please?  I do not need to created the billing document, it already exists.  I just need to edit specific fields.
Many thanks.

The requirement is to update these 2 fields in the table VBRK:
BSTNK_VF (customer po number)
ZUONR (assignment number)
The client uses these 2 fields for non-standard purposes.
Actually I was already trying to use the FM RV_INVOICE_DOCUMENT_UPDATE, but I am unable to make it work, for some reason. 
For that function, I only passed VBRK as table, nothing else.  Specifically, I retrieved the header from VBRK, modify the 2 fields, then pass it to the VBRK table parameter of the function.

Similar Messages

  • Any BAPI/function module to change Billing document

    Is there any BAPI / FM to change the Billing document once it has been created ?
    Your help is appreciated.
    Regards,
    Ankur Bhandari

    Hi,
    Go through the forums,
    BAPI/FM for printing Billing doc.
    Re: BAPI for creating billing document
    VF02 - CHANGE BILLING DOCUMENT
    Regards,
    Azaz Ali.

  • Any functional module to get financial document based on billing document

    hi all,
    do we have any functional module to get accounting document (bseg-BELNR) based on billing document (bseg-VBELN)?
    i have a requirement to retrieve the clearing document (bseg-augcp) & date(bseg-augdt) from BSEG with billing document.
    billing document is not a key, so i would like to retrieve the accounting document from any function module and use that to get clearing document (bseg-augcp) & date(bseg-augdt).
    thanks.

    hi all,
    i got other option to get this....thanks.
          select single * from bkpf
          where bukrs = <data>-werks
            and AWTYP = 'VBRK'
            and AWKEY = billing doc.
          if sy-subrc EQ 0.
            select single * from bseg
            where bukrs = bkpf-bukrs
              and belnr = bkpf-belnr
              and gjahr = bkpf-gjahr.
            if sy-subrc EQ 0.
              <data>-AUGDT = bseg-augdt.
              <data>-AUGBL = bseg-augbl.
            endif.

  • Billing document header & Item tables

    Hi all
    What are the CRM billing doc header & Item tables???
    Thanks
    Sonali

    1. Billing doc header table should be /1BEA/CRMB*BDH
    2. Billing doc item table should be /1BEA/CRMB*BDI
    indicates the missing phrase (which i have forgotten)
    Go to SE16 and input the same, SAP will through up some options.

  • Payer change at Billing document Header

    Hi
    Is it possible to change the "Payer " partner at billing document header once the billing has been
    created and not posted to accounting? if so how?
    Regards

    In billing document, you can change only fields like Billing Date and  Account Assignment Group at Header Level and Account Assignment Group of material and sales text at item level.  You cannot change partner function in billing.
    Of course, you can change the ship to party in sale order at header level which will be considered for the subsequent deliveries.
    thanks
    G. Lakshmipathi

  • Function Module to edit the ALV Output

    Hi,
      I have an ALV report output.I need the edit values based on some conditions in the ALV output and 
      save the changes. Is there any function module to edit the output and proceed further.
      Thanks in advance.
    Regards,
    Navas

    First create the field catalog of the field that you want to edit in this way
    WA_fieldcat-fieldname  = 'MENGE'.
      WA_fieldcat-qfieldname = 'MEINS'.
      WA_fieldcat-seltext_m  = 'PO Quan.'
      WA_fieldcat-edit = 'X' .
    Secondly you keep a custom button like 'SAVE' in the toolbar and  also try to keep a checkbox in your ALV.
    for checkbox you have to keep a following code snippet in your finallly displayed interanal table:
    chk(1)    TYPE c, and in the fieldcatalog you have to write following piece of code
      WA_fieldcat-fieldname = 'CHK'.
      WA_fieldcat-seltext_m = 'CheckBox'.
      WA_fieldcat-checkbox = 'X'.
      WA_fieldcat-edit = 'X' .
      WA_fieldcat-input = 'X'.
      WA_fieldcat-tabname = 'IT_FINAL'.
      WA_fieldcat-col_pos = 1.
    then you have to set the parameter i_callback_user_command           = 'USER_COMMAND'
    of FM REUSE_ALV_GRID_DISPLAY.
    Then write a subroutine like the following one to handle the SAVE operation
    FORM user_command USING I_r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    DATA:l_cntr TYPE i.
    CASE I_r_ucomm.
    WHEN '&ZXZ'.
          CLEAR l_cntr.
          CLEAR WA_final.
          LOOP AT IT_final INTO WA_final.
            IF WA_final-chk = 'X'.
              l_cntr = l_cntr + 1.
            ENDIF.
          ENDLOOP.
          IF l_cntr GT 1.
            MESSAGE i011.
          ELSEIF l_cntr = 1.
               READ TABLE IT_final INTO WA_final WITH KEY chk = 'X'.
               MODIFY IT_final FROM WA_final TRANSPORTING menge
              WHERE chk = 'X'.
              CLEAR WA_final.
              PERFORM disp_alv. <<<This is to display the refreshed alv after saving your data
         endif.
    ENDCASE.
    ENDFORM.

  • How to update the field 'VBRK-ZUONR' of Billing Document Header(VF03)

    Hi Experts.
    I got a request to update the field 'VBRK-ZUONR' of Billing Document Header(T-code:VF03).
    At first i thought it might be a BADI or User-Exit case and looked up in Standard Program but found nothing.
    Thus i doubted if it was a configuration problem.
    I tryed to configure through transaction code "VTFA" "VTFL" "VTFF" and met another failure.
    Now i'm totally lost and hope for your advice,any information would be appreciated.
    The Billing Document is automatically generated from the posting of Outbound Delivery.
    Regards.
    Panda.

    Hi friends.
    I've found where point is.
    The include program 'RV60AFZC' contains a form named 'USEREXIT_FILL_VBRK_VBRP',
    in which the field 'VBRP-ZUONR' could be set through coding.
    In our system the codes had been changed once,which led to the misalignment that confused me yesterday.
    On the other hand,undoubtedly VTFL is available to configure the value of 'VBRP-ZUONR'.
    For more information plz refer to
    http://help.sap.com/saphelp_46c/helpdata/en/18/f62c7dd435d1118b3f0060b03ca329/content.htm
    Thanks again to all of you.
    Best Regards
    Panda.

  • To make  the Billing document header  updated with the new VAT number.

    Hi Experts
    Due the business requirement we change the VAT number of  customers  for the European countries.
    And now how can we ensure that the Billing document header gets updated with the new VAT Reg.Number for the existing Billing documents.
    The intention is to ensure that when we Print an already existing invoice,the new changed VAT number should appear in the invoice output.
    Please suggest.
    Montee

    Hi,
       Have these documents been released to accounting? If yes then you have top canecl all the documents to update the billing documents and repost them with the new vat number. I think you might know how VAT gets determined in SAP. If not please go to SPRO-IMG-SD-BF-TAXES-MAINTAIN SALES TAX IDENTIFICATION UMBER DETERMINATION.
      1.  If the payer has a VAT ID number and RG <> AG, then the tax number
          and tax classification are copied from the payer (in this case, the
          ship-to party is not relevant).
          The tax number is taken according to the 'tax country of
          destination'.
      2.  If 1. does not apply:
          If the ship-to party has a VAT registration number and the sold-to
          party does not, tax number and tax classification are copied from
          the ship-to party.
      3.  If 2. does not apply:
          Tax number and tax classification are copied from the sold-to party.
      If you enter A, tax number and tax classification are generally copied
      from the sold-to party.
      The tax number is copied according to the 'country of destination
      relevant for taxes'.
      If you enter B, tax number and tax classification are generally copied
      from the payer.
      The tax number is copied according to the 'country of destination
      relevant for taxes'.
    Kindly please let me know If you need any more information on this.
    Regards
    Ram Pedarla

  • Posting Status in billing document header

    Hi all,
    In the billing document header we have 'Posting Status'. For example if we won't require accouting document, it says 'Billing document is not relevant for accounting'. Where do we maintain control for this.
    Thanks
    Sri

    Dear All,
    In-line with Mr. Muthu's explaination, I would like to add:
    It is VBTYP and Account Determination Procedure in Billing Document Type Configuration, which defines the Accounting Document generation.
    Say, in case of Proforma Invoice (F5, or F8), you will find:
    VBTYP as "U" (Blank) and No Acct. Doc. Deter. Procedure assigned.
    Whereas, in case of F1, or F2:
    VBTYP as "M" and Acct. Doc. Deter. Procedure assigned.
    Important: Check Fields: SD Document category and Transaction group, for F5 and F8 (it would be "U" and "8") AND F1 and F2 (it would be "M" and "7")
    Also,
    What Billing Document Type would be considered As Cancellation Billing Document Type, would also get considered by VBTYP.
    An Invoice, with VBTYP 'M', can only be canceled with Billing Type with VBTYP 'N' .
    Note: Check Billing Documents in VOFA.
    Very Best Regards,
    Amit
    I am really Sorry, But I could not Stop myself, to provide my inputs.

  • Rfc enabled function module for the updating the database table

    Hi,
            I need one rfc enabled function module for the updating the database table from the legacy system.currently i am using the rfc_read_table to read the database table.similarly i need for the update.

    Hi
    I believe you need to create one by yourself
    Max

  • Function Module to update Bill of Lading & No. of packages in a Delivery

    Hi,
    Can any one suggest me a function module to update Bill of Lading & No. of packages in a Delivery ?
    Thanks in Advance.

    Hi:
    I am also trying to update components of PM. I used the function CO2M_COMPONENT_CHANGE_WITH_REF, but I am not sure if I am passing the correct parameters. If possible  can you please send a sample code Or you can take a look at my code and tell me where I am doing wrong.. Thanks.
    Here is what I am passing into the the function:
    DATA: in_resbd_new LIKE resbd,
    in_rsnum_source    LIKE     resb-rsnum,
    in_rspos_source    LIKE     resb-rspos,
    in_rsart_source    LIKE     resb-rsart,
    out_INDEX_BT       LIKE     SY-TABIX.
    When I created the component, Requirement quantity of the component
    was set to initial. I am trying to change that to 1.
    in_resbd_new-MANDT = '200'.
    in_resbd_new-RSNUM = '0000000708'.  " from RESB-RSNUM
    in_resbd_new-RSPOS = '0001'.             " from RESB-RSPOS
    in_resbd_new-MATNR = '000000000000000072'. " RESB-MATNR
    in_resbd_new-WERKS = '0010'.             " from RESB-WERKS
    in_resbd_new-LGORT = '0010'.              "" from RESB-lgort
    in_resbd_new-MENGE = '1'.
    in_rsnum_source = '0000000708'.
    in_rspos_source = '0001'.
    CALL FUNCTION 'CO2M_COMPONENT_CHANGE_WITH_REF'
      EXPORTING
        i_resbd_new          = in_resbd_new
        i_rsnum_source       = in_rsnum_source
        i_rspos_source       = in_rspos_source
        i_rsart_source       = in_rsart_source
    IMPORTING
       E_INDEX_BT           = out_INDEX_BT
    EXCEPTIONS
       ERROR_OCCURED        = 1
       OTHERS               = 2
    The return value in out_index_bt is '1'.
    Thanks for your help.

  • Function modules to edit table's record

    Hi, thanks in advance. I have two questions:
    1. I call function 'STC1_FULLSCREEN_TABLE_CONTROL' to edit a table, the problem is fieldnames are not displayed, all emptys. Please check below calling.
    CALL FUNCTION 'STC1_FULLSCREEN_TABLE_CONTROL'
           EXPORTING
                HEADER = p_table
                tabname = p_table
                endless = 'X'
                no_button = space
           IMPORTING
                okcode = w_okcode
           TABLES
                 nametab = it_dfies
                 TABLE = <itab>
                 fielddif = it_fdiff
                 modif_table = <ntab>
           EXCEPTIONS
                 OTHERS = 1.
    2. The second question is above function module is to edit a table in full screen style, multiple record lines are displayed. Could you please tell me which function module can be called to only edit one record in the screen?
    Thanks.
    Tom

    Hello Tom
    Use the following code before calling the function.
    loop at IT_DFIES into is_dfies.
        if is_dfies-reptext is initial.
          select single scrtext_s into is_dfies-reptext from ddftx where tabname = is_dfies-tabname
                                                                     and fieldname = is_dfies-fieldname
                                                                     and ddlanguage = sy-langu.
          IF sy-subrc = 0 and is_dfies-reptext is initial.
            select single scrtext_m into is_dfies-reptext from ddftx where tabname = is_dfies-tabname
                                                                       and fieldname = is_dfies-fieldname
                                                                       and ddlanguage = sy-langu.
            IF sy-subrc = 0 and is_dfies-reptext is initial.
              select single scrtext_l into is_dfies-reptext from ddftx where tabname = is_dfies-tabname
                                                                         and fieldname = is_dfies-fieldname
                                                                         and ddlanguage = sy-langu.
            endif.
          endif.
          If is_dfies-reptext is initial.
            select single fieldtext into is_dfies-reptext from ddftx where tabname = is_dfies-tabname
                                                                       and fieldname = is_dfies-fieldname
                                                                       and ddlanguage = sy-langu.
          ENDIF.
          If is_dfies-reptext is initial.
            is_dfies-reptext = is_dfies-fieldname.
          ENDIF.
          modify it_dfies from is_dfies .
        endif.
      endloop.
    I hope that could help
    Regards
    dstj

  • Is there any BAPI or function module  to delete entries from a table (VBAK)

    Hi Everybody,
    this is my first thread in SDN...
    my problem follows...
    A report is be created that selects all sales orders created by e-Sales that are more than 20 minutes old and still have a delivery block:
    tables:
    VBAK     sales document: header data
    selection fields:
    VBAK-LIFSK      &#8800;     <BLANK>
    VBAK-ERNAM     =     userID used by e-Sales / IVE
              (EP-BATCH / EAI-BATCH)
    VBAK-ERDAT      <=     Current system Date
    VBAK-ERZET     <=     Current system Time - 20 minutes
    These orders should be deleted from SAP system.
    This report should be scheduled to run regularly every 10 minutes.
    my doubt : is ther any BAPI or Function module to delete entries from a standard table...if no what is the way to delete the enteries from a std table...
    best replies will be rewarded....
    regards
    Reddy

    Hi Vasanth ,
    thanks for your reply.
    i tried in the same manner what u mentioned.
    but how to pass only one parameter to the functionmodule..
    here in this case we have to pass only update flag as 'D'..
    i did the same it giving dump..
    An exception occurred that is explained in detail below.                          
    The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was      
      not caught and                                                                   
    therefore caused a runtime error.                                                 
    The reason for the exception is:                                                  
    The call to the function module "BAPI_SALESORDER_CHANGE" is incorrect:                                                                               
    In the function module interface, you can specify only                            
    fields of a specific type and length under "ORDER_HEADER_INX".                    
    Although the currently specified field                                            
    "INT_ORDER_HEADER_INX" is the correct type, its length is incorrect.              
    my pgm :
    *& Report  YNEW_ORDER_DELETION
    REPORT  ynew_order_deletion.
    TABLES:vbak.
    PARAMETERS:
         p_lifsk LIKE vbak-lifsk DEFAULT '02'.
    SELECT-OPTIONS:
       s_lifsk FOR vbak-lifsk DEFAULT '10',
        s_ernam FOR vbak-ernam,
        s_erdat FOR vbak-erdat,"DEFAULT sy-datum.
        s_erzet FOR sy-uzeit.
    *PARAMETERS:
    p_erzet LIKE sy-uzeit.
       s_erdat like vbak-erdat,
       s_erzet like vbak-erzet.
    DATA:
       BEGIN OF int_final OCCURS 0,
            w_vbeln TYPE vbak-vbeln,
       END OF int_final.
    DATA:
      int_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    DATA: int_order_header_inx LIKE bapisditmx OCCURS 0 WITH HEADER LINE.
    DATA:
      wf_time TYPE sy-uzeit.
    INITIALIZATION.
      s_ernam-low = 'KULKARMA'.
      s_ernam-sign = 'I'.
      s_ernam-option = 'EQ'.
      APPEND s_ernam.
    s_ernam-low = 'EAI-BATCH'.
    s_ernam-sign = 'I'.
    s_ernam-option = 'EQ'.
    APPEND s_ernam.
    wf_time = sy-uzeit - 1200.
    p_erzet = sy-uzeit - 1200.
    p_erzet-low = wf_time.
    APPEND s_erzet.
      int_order_header_inx-updateflag = 'D'.
      APPEND int_order_header_inx.
    START-OF-SELECTION.
      SELECT vbeln FROM vbak
                       INTO TABLE int_final
                       WHERE lifsk EQ p_lifsk
                         AND ernam IN s_ernam
                         AND erdat IN s_erdat
                         AND erzet IN s_erzet.
      IF sy-subrc = 0.
        LOOP AT int_final.
          CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
            EXPORTING
              salesdocument         = int_final-w_vbeln
      ORDER_HEADER_IN             =
        order_header_inx            = int_order_header_inx
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
      NO_STATUS_BUF_INIT          = ' '
            TABLES
              return                      = int_return
      ORDER_ITEM_IN               =
      ORDER_ITEM_INX              =
      PARTNERS                    =
      PARTNERCHANGES              =
      PARTNERADDRESSES            =
      ORDER_CFGS_REF              =
      ORDER_CFGS_INST             =
      ORDER_CFGS_PART_OF          =
      ORDER_CFGS_VALUE            =
      ORDER_CFGS_BLOB             =
      ORDER_CFGS_VK               =
      ORDER_CFGS_REFINST          =
      SCHEDULE_LINES              =
      SCHEDULE_LINESX             =
      ORDER_TEXT                  =
      ORDER_KEYS                  =
      CONDITIONS_IN               =
      CONDITIONS_INX              =
      EXTENSIONIN                 =
        ENDLOOP.
        LOOP AT int_return.
          WRITE:/ int_return-type,
                  int_return-id,
                  int_return-number,
                  int_return-message.
        ENDLOOP.
      ENDIF.
    please help me ..its a very urgent issue to be solved...
    am waiting for ur reply...
    regards
    gangareddy

  • Generic datasource by function module to fetch data from multiple tables?

    I'm writing a function module to fetch price, for generic datasource.
    At first, extract test is OK. But InfoPackage never stop  when loading data to PSA in BW.
    And I find the example codes:
         OPEN CURSOR WITH HOLD S_CURSOR FOR
          SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT
                                   WHERE CARRID  IN L_R_CARRID AND
                                         CONNID  IN L_R_CONNID.
        ENDIF.                             "First data package ?
    * Fetch records into interface table.
    *   named E_T_'Name of extract structure'.
        FETCH NEXT CURSOR S_CURSOR
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE E_T_DATA
                   PACKAGE SIZE S_S_IF-MAXSIZE.
        IF SY-SUBRC <> 0.
          CLOSE CURSOR S_CURSOR.
          RAISE NO_MORE_DATA.
        ENDIF.
        S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
      ENDIF.
    There using Cursor to fetch data package by package, and raise exception NO_MORE_DATA to stop the loading process.
    Now I fetch data from multiple tables, I don't think I can use Cursor.
    Then How can I handle this?  
    Thanks a lot.

    Thanks
    IF IT_999[] IS INITIAL.
        SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
          TABLE TP_DATA
            FROM A999 AS A
              INNER JOIN KONP AS B
                  ON A~KNUMH = B~KNUMH
              INNER JOIN MARA AS C
                 ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_999
                    WHERE
    *      A~KNUMH = IT_999-KNUMH  AND
           ( ( A~KSCHL = 'ZPRC' AND VKORG = 'Z000' AND VTWEG = 'Z1' ) OR
                          ( A~KSCHL = 'ZPRD' AND VKORG = 'A000' AND VTWEG = 'Y3' ) ) AND
    *                      A~DATBI >= SY-DATUM AND
                          LOEVM_KO = ''.
        SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR AS KHETR  KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
          TABLE TP_DATA
            FROM A999 AS A
              INNER JOIN KONP AS B
                  ON A~KNUMH = B~KNUMH
              INNER JOIN MARA AS C
                 ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_999
                    WHERE
    *      A~KNUMH = IT_999-KNUMH AND
          A~KSCHL = 'ZPR3' AND A~VKORG = 'I000' AND
    *                      DATBI >= SY-DATUM AND
                          LOEVM_KO = ''.
      ENDIF.
      IF IT_997[] IS INITIAL.
        SELECT A~KNUMH A~MATNR A~KSCHL VTWEG A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
          TABLE TP_DATA
            FROM A997 AS A
              INNER JOIN KONP AS B
                  ON A~KNUMH = B~KNUMH
              INNER JOIN MARA AS C
                 ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_997
                    WHERE
    *      A~KNUMH = IT_997-KNUMH      AND
          A~KSCHL = 'ZPRA' AND VTWEG = 'Y1' AND
    *                      DATBI >= SY-DATUM AND
                      LOEVM_KO = ''.
      ENDIF.
      IF IT_996[] IS INITIAL.
        SELECT A~KNUMH A~MATNR A~KSCHL A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
           TABLE TP_DATA
             FROM A996 AS A
               INNER JOIN KONP AS B
                   ON A~KNUMH = B~KNUMH
               INNER JOIN MARA AS C
                  ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_996
                    WHERE
    *      A~KNUMH = IT_996-KNUMH AND
          A~KSCHL = 'ZPRB' AND
    *                       DATBI >= SY-DATUM AND
          LOEVM_KO = ''.
      ENDIF.
      SELECT   MATNR     "u7269u6599u53F7u7801
               MEINH     "u4ED3u50A8u5355u4F4Du7684u5907u7528u8BA1u91CFu5355u4F4D
               UMREZ     "u57FAu672Cu8BA1u91CFu5355u4F4Du8F6Cu6362u5206u5B50
               UMREN     "u8F6Cu6362u4E3Au57FAu672Cu8BA1u91CFu5355u4F4Du7684u5206u6BCD
          FROM MARM
          INTO CORRESPONDING FIELDS OF TABLE IT_MARM
           FOR ALL ENTRIES IN TP_DATA
         WHERE MATNR = TP_DATA-MATNR AND  MEINH = TP_DATA-KMEIN.
      LOOP AT TP_DATA.
        IF TP_DATA-KPEIN NE 0.
          TP_DATA-KBETR =  TP_DATA-KBETR / TP_DATA-KPEIN.
          TP_DATA-KHETR =  TP_DATA-KHETR / TP_DATA-KPEIN.
        ENDIF.
        IF TP_DATA-KSCHL = 'ZPRA'.
    *       TP_DATA-MEINH = 'ZI'.
    *      TP_DATA-KSCHL = 'B4'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'CT'.
            TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ENDIF.
        ELSEIF TP_DATA-KSCHL = 'ZPRB'.
    *      TP_DATA-KSCHL = 'L0'.
    *       TP_DATA-MEINH = 'ZI'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
            TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ENDIF.
        ELSEIF TP_DATA-KSCHL = 'ZPRC' OR TP_DATA-KSCHL = 'ZPRD'.
    *       TP_DATA-MEINH = 'ZI'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'WZI'.
            TP_DATA-KBETR = TP_DATA-KBETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
          ENDIF.
        ELSEIF TP_DATA-KSCHL = 'ZPR3'.
    *      TP_DATA-KSCHL = 'B2'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
            TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ENDIF.
        ENDIF.
        TP_DATA-MEINH = '01'.
        MODIFY TP_DATA.
    E_T_DATA-MATNR =   TP_DATA-MATNR.
    E_T_DATA-KSCHL =   TP_DATA-KSCHL.
    E_T_DATA-KHETR =   TP_DATA-KHETR.
    E_T_DATA-KBETR =   TP_DATA-KBETR.
    E_T_DATA-KMEIN =   TP_DATA-KMEIN.
    E_T_DATA-DATAB =   TP_DATA-DATAB.
    E_T_DATA-DATBI =   TP_DATA-DATBI.
    APPEND E_T_DATA.
        CLEAR WA_MARM1.
        CLEAR WA_MARM2.
      ENDLOOP.
    Edited by: Shen Peng on Oct 20, 2010 10:09 AM

  • Function module to get data into internal table from Excel file sheets

    Hi,
    I have to upload customers from excel file.
    we are donloading customer data excel file sheets.
    Customer data in 1 sheet, tax data the other sheet of same excel file, Customer master-Credit data in other sheet of same excel file.
    so i have 3-4 sheet in one excel file.
    now my requirement is to get the data from excel file into internal table.
    is there any function module.
    Thanks & Regards

    I am sending you the idea with an example how you can upload data from an EXCEL file into an internal table. I am not sure if you can take data from different sheet in the same EXCEL file. I think that this is not possible (try it )
    Upload the data into an internal table, like the way that I am describing in the above:
      DATA: L_MAX_COL_NB TYPE I.
      DATA: l_file_name LIKE RLGRAP-FILENAME.
    Just to be sure that is the correct type for the FM.
      l_file_name = P_FILE_NAME.
      L_MAX_COL_NB = 58.  "Maximum nb of colums that the FM can read.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                FILENAME                = l_file_name
                I_BEGIN_COL             = 1
                I_BEGIN_ROW             = 2
                I_END_COL               = L_MAX_COL_NB
                I_END_ROW               = 9999
           TABLES
                INTERN                  = PT_EXCEL
           EXCEPTIONS
                INCONSISTENT_PARAMETERS = 1
                UPLOAD_OLE              = 2
                OTHERS                  = 3.
      IF SY-SUBRC <> 0.
      ENDIF.
    Now you should upload the data into your own itab. The Function Module will return to you all the an itab
    from all fields and columns. Define the structure of the uploading file into SE11 - Data Dictionary. Then read the fieldcatalog of this structure. In the code that I am sending to you, I am insearting an empty line into the internal table and then I am assigning this line into a corresponding field-symbol. Then I am able to change the working area - so and the line of the itab. Propably you could you the statement APPEND INITIAL LINE TO (your_table_name) ASSIGNING <your_field_symbol>, but the example was written in an old SAP version.
      FIELD-SYMBOLS:
                     <F_REC> LIKE WA_UPLOAD_FILE,      "working are of the uploading file
                     <F_FIELD> TYPE ANY.
      DATA: COLUMN_INT TYPE I,
            C_FIELDNAME(30) TYPE C.
      PERFORM GET_FIELDCATOLG TABLES FIELDCAT
                               USING 'ZECO_CHARALAMBOUS_FILE'.
      LOOP AT PT_EXCEL.
        AT NEW ROW.
          ASSIGN WA_UPLOAD_FILE TO <F_REC>.
        ENDAT.
        COLUMN_INT = PT_EXCEL-COL.
        READ TABLE FIELDCAT INTO WA_FIELDCAT INDEX COLUMN_INT.
        CONCATENATE '<F_REC>-' WA_FIELDCAT-FIELDNAME INTO C_FIELDNAME.
        ASSIGN (C_FIELDNAME) TO <F_FIELD>.
        <F_FIELD> = PT_EXCEL-VALUE.
        AT END OF ROW.
          APPEND WA_UPLOAD_FILE TO GT_UPLOAD_FILE.
          CLEAR WA_UPLOAD_FILE.
        ENDAT.
      ENDLOOP.
    With Regards
    George
    Edited by: giorgos michaelaris on Mar 4, 2010 3:44 PM

Maybe you are looking for