What is exact BAPI for FB01 transaction......

Hi,
   Currently i got requirement to upload transactional data into FB01 using BAPI. I used BAPI_acc_gl_posting_post but it applicable only for GLs, but i want to upload Vendors, Customers, assets, Materials.. Please tell me apropriate BAPI for the requirement. Its urgent.
Thanks in advance...........
Regards,
Chinna.

Thanks Atish....
    I have written code using BAPI_ACC_DOCUMENT_POST. But it is not posting and it is not generating Object Key...
Please go thru the code and tell the solutions....
Thanks in Advance......
REPORT  zk_fi_fb01                     .
Data: v_objkey(20) type c.
Data: Docheader type BAPIACHE09.
Data: ACCOUNTGL LIKE BAPIACGL09 occurs 0 with header line,
     ACCOUNTRECEIVABLE like BAPIACAR09,
      ACCOUNTPAYABLE like BAPIACAP09 occurs 0 with header line,
      CURRENCYAMOUNT like BAPIACCR09 occurs 0 with header line,
      RETURN like BAPIRET2 occurs 0.
Data: obj_typ like BAPIACHE09-OBJ_TYPE,
      OBJ_KEY like BAPIACHE09-OBJ_KEY,
      OBJ_SYS like BAPIACHE09-OBJ_SYS.
Data: gv_belnr type belnr_d.
Data:file_Na type String.
Data: lsys like TBDLS-LOGSYS.
*START OF SELECTION
START-OF-SELECTION.
*CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
   nr_range_nr                  = '19'
   object                       = 'RF_BELEG' "'FIAA-BELNR'
  QUANTITY                      = '1'
  SUBOBJECT                     = '7777'
  TOYEAR                        = '2007'
  IGNORE_BUFFER                = ' '
IMPORTING
  NUMBER                        = gv_belnr
QUANTITY                      =
RETURNCODE                    =
*CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
IMPORTING
  OWN_LOGICAL_SYSTEM                   = lsys
EXCEPTIONS
  OWN_LOGICAL_SYSTEM_NOT_DEFINED       = 1
  OTHERS                               = 2
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
*concatenate gv_belnr '7777' '2007' into v_objkey.
*Filling Document Header Details
*Docheader-OBJ_TYPE = 'BEBD'.
*Docheader-OBJ_key = V_objkey.
*Docheader-OBJ_SYS = lsys.
*docheader-BUS_ACT = 'RFBU'.
Docheader-USERNAME = sy-uname.
Docheader-COMP_CODE = '7777'.
Docheader-DOC_DATE   = '20070725'.
Docheader-PSTNG_DATE = '20070725'.
Docheader-FISC_YEAR = '2007'.
*DOCHEADER-OBJ_KEY_R = 'X'.
Docheader-DOC_TYPE = 'KR'.
*Item data for ACCOUNTGL
ACCOUNTGL-ITEMNO_ACC = '0000000001'.
ACCOUNTGL-GL_ACCOUNT = '0000000102'.         "99900
ACCOUNTGL-DOC_TYPE   = 'KR'.
ACCOUNTGL-COMP_CODE  = '7777'.
ACCOUNTGL-FISC_YEAR  = '2007'.
ACCOUNTGL-PSTNG_DATE = '20070725'.
ACCOUNTGL-DE_CRE_IND = 'S'.
append ACCOUNTGL.
ACCOUNTGL-ITEMNO_ACC = '0000000002'.
ACCOUNTGL-GL_ACCOUNT = '0000400002'.         "99900
ACCOUNTGL-DOC_TYPE   = 'KR'.
ACCOUNTGL-COMP_CODE  = '7777'.
ACCOUNTGL-FISC_YEAR  = '2007'.
ACCOUNTGL-PSTNG_DATE = '20070725'.
ACCOUNTGL-DE_CRE_IND = 'H'.
append ACCOUNTGL.
*Account payable
ACCOUNTPAYABLE-ITEMNO_ACC = '0000000001'.
ACCOUNTPAYABLE-GL_ACCOUNT = '0000000102'.
ACCOUNTPAYABLE-COMP_CODE  = '7777'.
append ACCOUNTPAYABLE.
ACCOUNTPAYABLE-ITEMNO_ACC = '0000000002'.
ACCOUNTPAYABLE-GL_ACCOUNT = '0000400002'.
ACCOUNTPAYABLE-COMP_CODE  = '7777'.
append ACCOUNTPAYABLE.
*Currency Amount
CURRENCYAMOUNT-ITEMNO_ACC = '0000000001'.
CURRENCYAMOUNT-CURRENCY_ISO = 'INR'.
MOVE 1000 TO CURRENCYAMOUNT-AMT_DOCCUR.
Append CURRENCYAMOUNT.
CURRENCYAMOUNT-ITEMNO_ACC = '0000000002'.
CURRENCYAMOUNT-CURRENCY_ISO = 'INR'.
MOVE '1000-' to CURRENCYAMOUNT-AMT_DOCCUR.
Append CURRENCYAMOUNT.
clear CURRENCYAMOUNT.
clear ACCOUNTGL.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
  EXPORTING
    documentheader          = Docheader
  CUSTOMERCPD             =
  CONTRACTHEADER          =
IMPORTING
   OBJ_TYPE                =  obj_typ
   OBJ_KEY                 =  obj_key
   OBJ_SYS                 =  obj_sys
  tables
   ACCOUNTGL               = ACCOUNTGL
  ACCOUNTRECEIVABLE       =
  ACCOUNTPAYABLE          = ACCOUNTPAYABLE
  ACCOUNTTAX              =
    currencyamount          = CURRENCYAMOUNT
  CRITERIA                =
  VALUEFIELD              =
  EXTENSION1              =
    return                  = return.
if sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
   WAIT          = ' '.
endif.
if sy-subrc = 0.
WRITE: / OBJ_KEY,
         OBJ_TYP,
         OBJ_SYS.
endif.

Similar Messages

  • Required BAPI for CK74N Transaction - Creating Additive Costs

    Hi Experts, Good Day.
    My functional guy has given a requirement to create BDC for transaction CK74N. But as it is an 'Enjoy' Transaction I thought to opt BAPI instead of BDC. But in the forum I did not find exact BAPI for this and also found some suggestions to develop BDC for old transaction CK74.
    So, as of now I have return BDC for CK74. Here also I have a doubt. When I am executing BDC with 'N' - No-Screen mode I am getting an error like "No batch data found for this field" for some materials. This message is raised only those materials for which Costs has not maintained even for once. In this case at one screen the BDC_CURSUR is showing in some other field instead of Pricing field. So, I am getting error. But same BDC is fine with materials for those Costs has been maintained at-least one time.
    So, I hope with BAPI I can overwrite this error. Can anyone please let me know a BAPI for creating Additive Costs (CK74N).
    Regards,
    Vijay

    Vijay
    If you will pass data to above mentioned function module the SAP standard code will make sure BDC is coded in correct way. Please try to use it..Else you will have to determine via code in your BDC whether its first time or not..if first time means a new subscreen will come.
    Nabheet

  • BAPI for FRFT_B Transaction

    Hi there,
    I would like to know the BAPIs that can be used for the transactions FRFT_B ("Fast Entry with Repetitive Codes - Bank to Bank Transfer").
    Does anybody know a BAPI for this transaction?
    Thank you,
    Janete

    hi,
    To know the BAPI's for a particular transaction generally we follow the following steps.
    1. Find out the package of the transaction.
    Start FRFT_B  go to system --> status.
    Double click on transaction
    Note Package name for that particular transaction.
    Open this package in SE80
    Open business engineering-->Business object types
    Find the BO which sounds the most appropriate
    But there are no Business Objects for FRFT_B transaction.
    There is another method to find BAPIs
    Start FRFT_B go to system-->status
    Double click transaction FRFT_B
    Double click on package
    Read the application component. (this is FI-BL-PT   Payment Transactions)
    Then open the transaction BAPI
    Financial Accounting-> Bank Accounting->Payment Request-> Start Payment
    By this you can find the BAPI for a transaction.
    Hope this would be helpful for you.
    Regards,
    Supriya.
    Edited by: Supriya.ch on Jan 30, 2012 2:34 PM

  • What is the BAPI for setting "deletion flag" in IW32?

    What is the BAPI for setting "deletion flag" in IW32? Thanks!

    Hello
    There seems to be no BAPI to set deletion flag for MO.
    Quick Approach:
    You can copy an existing BAPI module BAPI_ISUSMORDER_SETSTATUSTECHN, for example, to Y_BAPI_MORDER_SETSTATUSDEL, and then edit this copy
    change the code in the existing lines for screen 3000
    PERFORM BDC_DYNPRO USING 'SAPLCOIH'      '3000'.
    PERFORM BDC_FIELD  USING 'BDC_OKCODE'    'LVMS'. (Instead of current 'ARCH')
    It should hopefully work.
    fyi: The orders can be set with Del flag only when they are in CLSD status
    Rgds
    Kartik

  • What is the BAPI for Inspection lot change - QA02??

    Hi Guys,
    Can anyone tell me plese, What is the BAPI for Inspection lot change - QA02?
    Thanks

    Hello,
    This BAPI suppose to be able to do that for you:
    BAPI_INSPLOT_SETUSAGEDECISION
    Best regards,
    Marcin

  • What is the BAPI for creating BP account / contact ?

    Hello experts,
    what is the BAPI for creating BP account / contact ?
    Please replay me as erarly as possible. Urgent requirment.
    Thanks,
    HP

    Hi,
    I think it is for bua1.
    Below are other bapi's which migt be useful:-
    BAPI_BPCONTACT_ADD_TO_ASGN BAPI Partner Sales Activity AddToAssigned
    BAPI_BPCONTACT_CHANGE BAPI Change Partner Sales Activity
    BAPI_BPCONTACT_CREATEFROMDATA BAPI Partner Sales Activity Create from Data
    BAPI_BPCONTACT_CREATEWITHDIA BAPI Partner Sales Activity - Create from Data Dialog
    regards
    Sandipan

  • FM / BAPI for FBR2 transaction.

    can anyone tell me
    FM / BAPI for FBR2 transaction.

    Dear:
                Please check
                BAPI_ACC_DOCUMENT_REV_CHECK
                Regards

  • Is there any BAPI for FBS1 Transaction

    Hi,
    Is there any BAPI for FBS1 transaction instead of using BDC.
    Regards,
    Aravind

    Hi Aravind ,
    I'm afraid that it's not possible to do it through BAPI ( because of he specificity of this txn ), you have to use either RFBIBL00 or your own BDC.
    Hope this helps,
    Erwan

  • What is the BAPI for creating an inbound delivery without reference.

    Hi Experts,
    What is the BAPI for creating an inbound delivery without reference.
    Points will be rewarded

    BAPI_DELIVERYPROCESSING_EXEC
    cheers
    Aveek

  • BAPI for FB01

    Hi,
    I am using bapi  BAPI_ACC_DOCUMENT_POST.. for FB01 but i am not getting Two fields
    PstKy (Posting Key for the Next Line Item) and  SGL Ind (Special G/L Indicator for the Next Line Item)
    is any other bapi avilabel for this...
    or please give me sample bapi for FB01 or BAPI_ACC_DOCUMENT_POST.
    <removed by moderator>
    Thanks.
    Edited by: Mike Pokraka on Aug 4, 2008 2:40 PM

    Hi
    The posting keys are setted by the BAPI in according to the item type (customer, vendor and G/L) and the sign of amount.
    The BAPI usually uses the standard posting key: 01/11; 40/50, 21/31.
    If it needs a different posting keys it needs to assign them to a certain operation key (field KOTSL): u can do it in the table T030B.
    Anyway u should consider u can use the BTE RWBAPI01 in order to set own data into FI interfaces.
    Max
    Edited by: max bianchi on Jun 20, 2008 11:16 AM

  • Which BAPI for FB01

    Hi,
    which is BAPI for FB01 which will help me to update following fields. like
    1) Doc Date
    2) Doc Type
    3) company Code
    4)Currency Key
    5)Referen
    6)Posting Key
    7) G/L account
    8) Speical G/L indicatior
    9)Profit Center
    10)Sales Doc. with sample code.
    thanks.

    Hi,
    it may help u.
    BAPI for FB01
    Thanks,
    Sree.

  • Bapi for the transaction FBRA, FB08, FB01 anf FD02

    hi,
    can any one please help me with BAPI for the following transaction?
    FBRA - reset cleared items
    FB08 - reversal of the documents
    FB01 - post documents
    FD02 - change customer.
    regards kriti

    Hi
    Copy the below  program in se38 and execute the program and along with the transaction code you need to specify the program name to obtain the program name all you have to do is execute the t-code and go to system--> status and copy the program name from the screen and paste it in the above program.
    tables : tstc,
             tadir,
             modsapt,
             modact,
             trdir,
             tfdir,
             enlfdir,
             sxs_attrt ,
             tstct.
    data :
       jtab like tadir occurs 0 with header line.
    data : field1(30).
    data : v_devclass like tadir-devclass.
    parameters : p_tcode like tstc-tcode,
    p_pgmna like tstc-pgmna .
    data wa_tadir type tadir.
    start-of-selection.
      if not p_tcode is initial.
        select single * from tstc where tcode eq p_tcode.
      elseif not p_pgmna is initial.
        tstc-pgmna = p_pgmna.
      endif.
      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 eq enlfdir-area.
            move : tadir-devclass to v_devclass.
          endif.
        endif.
        select * from tadir into table jtab
        where pgmid = 'R3TR'
        and object in ('SMOD', 'SXSD')
        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:/(105) sy-uline.
          format color col_heading intensified on.
          * sorting the internal table
       sort jtab by object.
          data : wf_txt(60) type c,
          wf_smod type i ,
          wf_badi type i ,
          wf_object2(30) type c.
          clear : wf_smod, wf_badi , wf_object2.
          * get the total smod.
          loop at jtab into wa_tadir.
            at first.
              format color col_heading intensified on.
              write:/1 sy-vline,
              2 'Enhancement/ Business Add-in',
              41 sy-vline ,
              42 'Description',
              105 sy-vline.
              write:/(105) sy-uline.
            endat.
            clear wf_txt.
            at new object.
              if wa_tadir-object = 'SMOD'.
                wf_object2 = 'Enhancement' .
              elseif wa_tadir-object = 'SXSD'.
                wf_object2 = ' Business Add-in'.
              endif.
              format color col_group intensified on.
              write:/1 sy-vline,
              2 wf_object2,
              105 sy-vline.
            endat.
            case wa_tadir-object.
              when 'SMOD'.
                wf_smod = wf_smod + 1.
                select single modtext into wf_txt
                from modsapt
                where sprsl = sy-langu
                and name = wa_tadir-obj_name.
                format color col_normal intensified off.
              when 'SXSD'.
                * for badis
             wf_badi = wf_badi + 1 .
                select single text into wf_txt
                from sxs_attrt
                where sprsl = sy-langu
                and exit_name = wa_tadir-obj_name.
                format color col_normal intensified on.
            endcase.
            write:/1 sy-vline,
            2 wa_tadir-obj_name hotspot on,
            41 sy-vline ,
            42 wf_txt,
            105 sy-vline.
            at end of object.
              write : /(105) sy-uline.
            endat.
          endloop.
          write:/(105) sy-uline.
          skip.
          format color col_total intensified on.
          write:/ 'No.of Exits:' , wf_smod.
          write:/ 'No.of BADis:' , wf_badi.
        else.
          format color col_negative intensified on.
          write:/(105) 'No userexits or BADis exist'.
        endif.
      else.
        format color col_negative intensified on.
        write:/(105) 'Transaction does not exist'.
      endif.
    at line-selection.
      data : wf_object type tadir-object.
      clear wf_object.
      get cursor field field1.
      check field1(8) eq 'WA_TADIR'.
      read table jtab with key obj_name = sy-lisel+1(20).
      move jtab-object to wf_object.
      case wf_object.
        when 'SMOD'.
          set parameter id 'MON' field sy-lisel+1(10).
          call transaction 'SMOD' and skip first screen.
        when 'SXSD'.
          set parameter id 'EXN' field sy-lisel+1(20).
          call transaction 'SE18' and skip first screen.
      endcase.
    Regards
    Pavan

  • Bapi error for fb01  transaction

    hai friends
    iam using      *bapi_acc_document_post  *
    for posting amount inplace fb01 .
    this bapi is called in module program .
    is it write bapi for this
    or
    else can i use any other bapi for this
    if it right bapi
    how can pass the parameeters to this
    what are the maditary fields in this bapi
    hoe can i pass this values to this bapi.
    pls tell me friends
    thanks
    with regards
    srikanth vipparla

    hai friend
    its ok
    but iam not fiending the documentation for this function module
    so pls helpme the maditari parameters in this function module .
    and iam using 4.6b  .
    or just post me the documentation pls .
    thanks
    ssrikanth vipparla

  • What is d BAPI for reversal of Good Receipt Note(GRN) for movement type 102

    Hi ABAPers,
       I have got requirement like this , I have done Goods Receipt Note (GRN) based on Purchse order Number using '.BAPI_GOODSMVT_CREATE' with 101 movement type.
       But now my requirement is reversal of good receipt note(GRN) based on Material Document Number (or) Purchase Order Number with 102 movement type. what is the bapi name i need to use. and i need to give reason for the reversal of GRN.
    please tell me the field name for reason  in bapi.
    i have searched in the net, but i could not get proper answer to this isse.
    Highly appriciate who gives answer as early as possible. I need to complete this task EOD. please give replies.
    Thanks & Regards,
    Vinay Kumar.

    Hi,
    If your material document has specific movement type i.e. 101, if you cancel document using BAPI_GOODSMVT_CANCEL, it automatically picks associated movement type 102 defined in customizing setting, you don't need to pass 102 explicitly while cancelling.
    I have not seen reason code in this bapi, but it is required to pass reason code then you may try transaction code MBST using BDC.
    Thanks,
    Ashok Veer

  • Bapi for migo transaction

    i have created a bapi to upload data for MIGO transaction.. (GOODS RECEIPT-->PURCHASE ORDER)
    i am getting the error " stock posting is not possible for this material "'.
    when i create directly, it is posted.. while uploading through the program it shows the above error.
    please suggest if anyone knows....
    Thanks in advance,
    Dhivya N.

    *& Report  ZR_MIGO_UPLOAD
    *& package name : zabap
    *& transport request number : MIDK901443
    *& program to upload goods movement
    REPORT ZR_MIGO_UPLOAD.
    ***DATA DECLARATION***
    type-POOLs:  icon.
    TYPES: BEGIN OF TY_GR_PO,
            EBELN(10) TYPE c ,     "'PO NUMBEr
            EBELP(10) TYPE c,     "PO ITEM NUMBER
    *       LGOBE TYPE LGOBE,     "STORAGE LOCATION DESCRIPTION
            LGORT(10) TYPE c,     "STORAGE LOCATION
            XFELD TYPE c,     "ITEM OK
            GERNR(10) TYPE c,     "SERIALNUMBER
            END OF TY_GR_PO.
    DATA: TA_GR_PO TYPE TABLE OF TY_GR_PO,    "TABLE FOR GOODS RECEIPT PURCHASE ORDER
           WA_GR_PO TYPE TY_GR_PO.
    DATA: BLDAT TYPE BLDAT,     "DOCUMENT DATE
            BUDAT TYPE BUDAT,     "POSTING DATE
            WEVER TYPE WEVER.     "VERSION FOR PRINTING GR SLIP
    ***BAPI DECLARATION***
    DATA: BEGIN OF GM_HEAD OCCURS 0.                    "Material Document Header Data
             INCLUDE STRUCTURE BAPI2017_GM_HEAD_01.
    DATA: END OF GM_HEAD.
    DATA: BEGIN OF GM_CODE OCCURS 0.
             INCLUDE STRUCTURE BAPI2017_GM_CODE.          "Assign Code to Transaction for Goods Movement
    DATA: END OF GM_CODE.
    DATA: BEGIN OF GM_RET OCCURS 0.
             INCLUDE STRUCTURE BAPI2017_GM_HEAD_RET.       "Material Document Number/Material Document Year
    DATA: END OF GM_RET.
    DATA: BEGIN OF GM_ITEM OCCURS 0.
             INCLUDE STRUCTURE BAPI2017_GM_ITEM_CREATE.    "Material Document Items
    DATA: END OF GM_ITEM.
    DATA: BEGIN OF GM_SER OCCURS 0.
             INCLUDE STRUCTURE BAPI2017_GM_SERIALNUMBER.    "Serial Number
    DATA: END OF GM_SER.
    data: BEGIN OF ta_bapireturn OCCURS 0.
            INCLUDE STRUCTURE BAPIRET2.
    data: END OF ta_bapireturn.
    ***declaration of excel file handling table***
    FIELD-SYMBOLS: <fs> type any.    "field symbol for alsm_excel
    DATA: TA_EXCEL TYPE TABLE OF ALSMEX_TABLINE,  "table to contain excel sheet values
           WA_EXCEL TYPE ALSMEX_TABLINE.
    ***declaration of other parameters***
    data:       V_brow type i VALUE    2,    "BEGIN OF ROW
                 V_bcol type i value   1,     "BEGIN OF COL
                 V_erow type i value 65536,   "END OF ROW
                 V_ecol type i value 256.     "END OF COLUMN
    DATA:  V_sear type string,
            V_INDEX TYPE i,
            V_tabix type sy-tabix,     "current line.
            v_lines type i.          "total number of records
    DATA: DATE TYPE DATS.
    ***SELECTION SCREEN***
    ***SELECTION SCREEN DESIGN***
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP 3.
    PARAMETERS: zCODE(2) TYPE C MATCHCODE OBJECT H_T158G,
                 zrefdoc type REFDOC,
                 version type WEVER.
    SELECTION-SCREEN skip 5.
    PARAMETERS: p_file type ibipparms-path.
    SELECTION-SCREEN SKIP 3.
    SELECTION-SCREEN END OF BLOCK b1.
    ***SELECTION SCREEN VALUE REQUEST***
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
       CALL FUNCTION 'F4_FILENAME'                                    "f4 help for file name
         EXPORTING
           PROGRAM_NAME  = SYST-CPROG
           DYNPRO_NUMBER = SYST-DYNNR
           FIELD_NAME    = 'P_FILE'
         IMPORTING
           FILE_NAME     = P_FILE.
    ***SELECTION SCREEN EVENT***
    AT SELECTION-SCREEN.                                 "validation
       if p_file <> ''.
         V_sear = p_file.
         SEARCH V_sear for '.xls'.
         if sy-subrc <> 0.
           message 'please provide excel file. it is not valid' type 'E'.
         ENDIF.
       ENDIF.
    INITIALIZATION.
    *   DATE = '17.04.14'.
       GM_HEAD-PSTNG_DATE = SY-DATUM.
       GM_HEAD-DOC_DATE   = SY-DATUM.
       gm_head-pr_uname = sy-uname.
    ***START OF SELECTION***
    START-OF-SELECTION.
       gm_head-REF_DOC_NO = zrefdoc.
       gm_head-VER_GR_GI_SLIP = version.
       GM_CODE-GM_CODE = zCODE.
       PERFORM EXCEL_UPLOAD.
       PERFORM EXCEL_CONVERSION.
       PERFORM NO_RECORDS.
    END-OF-SELECTION.
       PERFORM BAPI_ASSIGNMENT.
       PERFORM BAPI_FM.
    *&      Form  EXCEL_UPLOAD
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM EXCEL_UPLOAD .
       CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
         EXPORTING
           FILENAME                = P_FILE
           I_BEGIN_COL             = V_BCOL
           I_BEGIN_ROW             = V_BROW
           I_END_COL               = V_ECOL
           I_END_ROW               = V_EROW
         TABLES
           INTERN                  = TA_EXCEL
         EXCEPTIONS
           INCONSISTENT_PARAMETERS = 1
           UPLOAD_OLE              = 2
           OTHERS                  = 3.
    ENDFORM.                    " EXCEL_UPLOAD
    *&      Form  EXCEL_CONVERSION
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM EXCEL_CONVERSION .
       if ta_excel is NOT INITIAL.
         sort ta_excel by row col.
         clear wa_excel.
         clear wa_GR_PO.
         LOOP AT ta_excel INTO wa_excel.
           move wa_excel-col to v_index.
           ASSIGN COMPONENT v_index OF STRUCTURE wa_GR_PO to <fs>.
           if sy-subrc = 0.
             move wa_excel-value to <fs>.
           ENDIF.
           at END OF row.
             append wa_GR_PO to ta_GR_PO.
             clear wa_GR_PO.
           ENDAT.
         ENDLOOP.
       else.
         MESSAGE 'no data for conversion' type 'I'.
       ENDIF.
    ENDFORM.                    " EXCEL_CONVERSION
    *&      Form  NO_RECORDS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM NO_RECORDS .
       DESCRIBE TABLE ta_GR_PO LINES v_lines.
       if v_lines = 0.
         MESSAGE 'NO RECORDS TO UPLOAD' TYPE 'E'.
       ENDIF.
    ENDFORM.                    " NO_RECORDS
    *&      Form  BAPI_ASSIGNMENT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM BAPI_ASSIGNMENT .
       IF TA_GR_PO IS NOT INITIAL.
         LOOP AT TA_GR_PO INTO WA_GR_PO.
           gm_item-PO_NUMBER = wa_gr_po-ebeln.
           GM_ITEM-STGE_LOC = WA_GR_PO-LGORT.
           GM_ITEM-PO_ITEM = WA_GR_PO-EBELP.
           GM_ITEM-NO_MORE_GR = 'X'."WA_GR_PO-XFELD'.
    *      GM_SER-SERIALNO = WA_GR_PO-GERNR.
           gm_item-NO_MORE_GR =  1.
           gm_item-ENTRY_QNT = 2.
           gm_item-MOVE_TYPE = 101.
    *      gm_item-MVT_IND = 'B'.
           gm_item-plant = 'P001'.
           gm_item-move_stloc = 'FG01'.
    *      GM_ITEM-SPEC_STOCK = 'K'.
           APPEND GM_ITEM.
           APPEND GM_SER.
         ENDLOOP.
        ELSE.
          MESSAGE 'DATA IS NOT UPLOADED' TYPE 'I'.
        ENDIF.
    ENDFORM.                    " BAPI_ASSIGNMENT
    *&      Form  BAPI_FM
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM BAPI_FM .
    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
       EXPORTING
         GOODSMVT_HEADER               = gm_head
         GOODSMVT_CODE                 = gm_code
    *   TESTRUN                       = ' '
    *   GOODSMVT_REF_EWM              =
      IMPORTING
        GOODSMVT_HEADRET              = gm_ret
    *   MATERIALDOCUMENT              =
    *   MATDOCUMENTYEAR               =
       TABLES
         GOODSMVT_ITEM                 = gm_item
        GOODSMVT_SERIALNUMBER         =  gm_ser
         RETURN                        = ta_bapireturn
    *   GOODSMVT_SERV_PART_DATA       =
    *   EXTENSIONIN                   =
    if ta_bapireturn-type = 'S'.
         write:/ icon_green_light as icon,
                 'success: Material document',gm_ret-mat_doc,  'is created for the GOODS RECEIPT- po number : ', wa_gr_po-ebeln,
               / 'reason:' , ta_bapireturn-message.
    ELSEIF ta_bapireturn-type = 'E'.
         write:/ icon_red_light as icon,
                 'error: Material document',gm_ret-mat_doc , 'is not created for the GOOD RECEIPT- po number : ', wa_gr_po-ebeln,
               / 'reason:' , ta_bapireturn-message.
    ENDIF.
    ENDFORM.                    " BAPI_FM

Maybe you are looking for

  • How to configure number of importing mail?

    hi guys,    I'm adding my yahoo mail account into Mac Mail recently, and I have got around 5000 mails in my yahoo account. When I succesffuly added the yahoo account in Mac Mail, the system imports all mails to Mac (starting from very beginining) It

  • I cannot open iPhoto and the following message appears.

    I cannot open iPhoto and the following message appears. Why is this happening and, most importantly, what can I do. Thanks. Process:         iPhoto [609] Path:            /Applications/iPhoto.app/Contents/MacOS/iPhoto Identifier:      com.apple.iPhot

  • Find out how many records are updated.

    Hello, I am executing a Update Statement in a loop from a JSP page this is working good. Suppose if there are 10 records and I update 4 records, it gets updated fine. What I now need is to find out how many records have been updated. How can I know t

  • ICloud backup questions?

    Quick question- I see a message that says my phone needs to be locked for iCloud to back up all my stuff? Is that true? or will it back up if I'm using it? I will be going to get a new iPhone very soon so I want to make sure all my data is backed up.

  • Importing Articulate into Captivate

    Hi everyone, I am trying to import Articulate Engage or Quizzes into Cp4 and am getting no where.  I followed the instructions on the blog and nothing seems to work. Does anyone have some step by step instructions to help? Would be much appreciated.