PO on Vendor A and material recd by vendor B

Hi
The PO is raised on vendor A to supply the material.
However the delivery address is of another vendor B.
The issue is how will the GR be handled in SAP only after confirmation from vendor B of receipt.
Also it is possible that the vendor B may be in a different country.
Here the issue is to handle the customs payments.
Is there a standard process to implement the above?
Thanks in advance.
Rahul

Hi
The PO is raised on vendor A to supply the material.
However the delivery address is of another vendor B.
The issue is how will the GR be handled in SAP only after confirmation from vendor B of receipt.
Also it is possible that the vendor B may be in a different country.
Here the issue is to handle the customs payments.
Is there a standard process to implement the above?
The Process is avialble in SAP .
For Vendor A create a normal PO with all the terms & Conditions, In the Delivery address of the PO item Tab maintain the Vendor Number & flag the Check box SC vendor. Once the Shipping notiifctaion is recived form VENDOR A & confirmation from Vendor B that the Goods are recived you can perform the Goods recipt.
On Vendor B you can create Subcontract PO, there is no need of issuing the goods to vendor B , as they have already been despatched by Vendor A.
So once you receive goods from the Vendor B you can perform the GR in the sytem .
The Customs & the conditions part need to be handled by the Pricing procedure which you may need to customize based on your requiremnts.
Thanks & Regards
Kishore

Similar Messages

  • How to get Vendor name and Material text in FAGLL03 transaction?

    Hello All,
    I am executing FAGLL03 report which display Vendor No and material No in item level but I want Vendor name and Material text to be display for every vendor no. and material no.
    Please let me know any approach to do this?
    Thanks in advance.
    Regards
    Steve

    Hi Raymod,
    Again I am getting the same error after executing all reports and FM.
    Internal error in ANALYZE_ACT_FIELDCAT
    Message no. MSITEM012
    Diagnosis
    An internal error has arisen in the form routine ANALYZE_ACT_FIELDCAT for program RFITEM_INC.
    This is due to inconsistencies between table T021S (special fields) and structure RFPOSEXT.
    System Response
    During the processing of special fields in the line item list, errors and even a program termination may occur.
    Procedure
    Recreate the special fields in Customizing. If the error occurs again, contact SAP.
    Can you pls check it out in your system if you can?
    It is not working here ..
    Thanks and Regards
    Steve

  • Vendor Master and Material Master

    Hi,
    How can I find out current default values needed in vendor and Material masters.
    Thanks
    John K.

    I have not seen any report that can list all mandatory fields for vendors or materials.
    The customizing of mandatory fields has several dimensions, in a material  e.g. the transaction, the industry code, the material type and the plant.
    whenever one of these fields changes it can result in a different set of mandatory fields
    And even then some fields become mandatory based on entries made in other fields.
    I think you should just go and create a material (vendor) and you just hit enter in a screen, SAP will tell you the mandatory fields for that screen, and you cant proceed to the next without making an entry.

  • Materials from Vendor A and Excise invoice from Vendor B???

    Hi experts
    Can amybody tel me  HOW TO DO???
    i have created PO for exciseable material to vendor A
    I have to do GR for the same from Vendor B (Vendor A 'll inform to Vendor B send materials and excise invoice to customer)
    How i can capture excise duty from other vendor.
    So how system will take othere vendor for excise duty capture ...??
    Thanks
    SAP-MM

    hi umakanth
    Thanks for ur response,
    I have maintained invoicing party as differeent vendor in partners tab at header level in PO.
    Even though if i maintaind invoicing party is different m buut while capturing excise duty its takeing the PO vendor only, not invoicing party vendor coed in Partners tab at header level in PO.
    So can u tel me , how we can capture excise invoice from a vendor differ from PO vendor .
    Thanks
    SAP-MM

  • Sub-Contracting material Issued to Vendor and balance to be Issud

    Hi,
    Sub-Contracting material Issued to Vendor and balance to be issued against the Sub-contracting Purchase Order.
    Please suggest T.Code for the same.  (Same Like ME2O, but PO number should be an input parameter)
    For example I have Created PO with header Material for 1 quantity which having one child item and qty say 20 numbers, and issued child material to vendor 10 numbers (541) and balance is to be issued to vendor is 10 numbers, now I want a report which gives PO number, Header item with qty, total requirement of qty for the child item with line item number, issued child item with qty and balance to be issued child item with qty.
    Thanks
    Ramesh.G

    Report MB51 is there. Here you have to input your Purchase order number and execute but, it will show only material issued to subcontractor through 541. It will not show the balance quantities.
    And there is no such standard report which will show information how much issued to subcontractor and how much is balance based on Purchase order.
    You can develop a z report with the help of abaper.

  • Vendor and material assignment

    Hi all,
    Is there any possibility to assign vendor to materials or material to vendor? our user wants that while taking drop down for vendor in ME21N screen, only vendors who sales materials, mentioned in purchase order, will be listed down.
    Any idea to do this?
    Best Regards,
    AI.

    Hi Al,
    Let me first clear that, vendor and material is possible through the Source List only in case of purchase requisitions i.e. ME51N and not in case of ME21N.
    Still it can be achieved through minor ABAP developement. We can add IF statement in the BADI related to ME21N and give the selection criteria as you desired vendor and material combination, so that same material get copied to PO once you use the particular vendor. As its almost like hard coding, this is not very advisable, but if the requirement is stringent then this is one of the possible solution.
    Moreover Vendor to material combintation is only possible and not material to vendor. As according to transaction flow one need to enter org data and vendor first before proceeding to the further data entry.
    come back in case you need to know more.
    bye,
    sachin

  • Vendor Evaluation by Material and Material Group wise

    Dear Folks,
    Customer requirement is to see subcriterion level scores of Vendor
    Evaluation according to material, Material group wise. But the
    datasource provided by SAP is providing the data according to
    Purchasing Organisation level and Vendor level (0MM_PUR_VE_01).Is it
    Possible to break the scores according to material group and material
    as TC in r/3: ME6B provides ranking based on Main Criterion level
    scores. If possible, what is the logic?
    Thanks in Advance

    Hi Anil,
    Thanks for ur reply.
    But Customer requires vendor evaluation data through Automatic route.
    0MM_PUR_VE_02 caters to semi-automatic data which needs to be configured in r/3, and customer doesn't want to do that. Is there any other solution.

  • Different Pricing Schema in PO and PIR for same vendor and material

    Dear Experts,
    I am facing an issue related to MM.
    I have a vendor and a material under a plant, purchase Org, purchase group.
    When we are creating a Purchase Info Record (PIR), it is picking one pricing schema, while when creating PO for same vendor and material, it is picking another different pricing schema.
    As per my knowledge, pricing schema in PO is picked as per pricing schema group of Vendor and I believe same applies for PIR as well. I have only one vendor pricing schema group.
    Because of this issue, I have to manually key-in condition values in PO for all condition types even though I have maintained a purchase info record.
    Please suggest, what can be reason.
    Regards,
    Praveen

    Hi,
    Thanks for clearing my doubts.
    However, I stuck-up in another issue.
    Problem is that condition type- PB00 is linked with almost all pricing schemas.
    Hence, I can't change pricing procedure  in condition type- PB00.
    Also, I can't include all J* related condition types in RM0002 as well.
    Hence, if PB00 remains as RM0002 and I maintain my pricing procedure- ZJIMPO to all J* condition types, still I am not able to create PIR for all J* conditions. Error "Condition type J1CV is not in procedure A M RM0002".
    How to handle this issue? Please suggest.
    Thanks
    Praveen

  • Vendor and Material group

    Hi Experts
    How do we transfer the Vendor and material groups from ECC to SRM
    Regards

    Hi SAP MAN,
    We do replicate vendors from backend system to SRM via transaction code BBP_GETVD, and products are replicated through middle ware settings.
    These middleware settings are maintained in both ECC and SRM systems.
    regards,
    IGA.

  • Error: Vendor and Material Import tasks fail

    Hi gurus.
    Our CLM Vendor and Material imports tasks have been working fine until recently when we experienced the error:
    Data Import Service: File: Material20150401-101647-817.xml is corrupt and cannot be imported
    We have not done changes to either CLM/PI/ERP. Please can you shed some light what's causing this error? Thanking you in advance.

    HI
    which version and service pack you are using ?
    we are using V9-SP19.
    In SP16 SAP has fix an issue with Vendor import.
    check this :
    Fix has been done to handle the processing of Payment Term field for Vendor import. Vendor XML import file should contain a field tag as
    <PAY_TERM></PAY_TERM> with desired value specified within the tag.
    this might be an issue.
    Thanks
    kanchan

  • What is procedure for creating new vendor and material master data in ABAP

    What is procedure for creating new vendor and material master data in ABAP .

    see below code which is used for creation of vendor master as well as extension...
    *& Report  ZFC_VENDOR_CREATE                                           *
    REPORT  ZFC_VENDOR_CREATE  LINE-SIZE 100
                               NO STANDARD PAGE HEADING
                               MESSAGE-ID ZZ.
                         TABLES
    TABLES : SSCRFIELDS.   " Fields on selection screens
                         CONSTANTS
    DATA : C_SPLIT TYPE C VALUE '#'.  " Used for Has Separator in GUI_UPLAOD
                         TYPES
    Int'table to hold Vendor Master Data
    TYPES : BEGIN OF TY_VENDOR_MASTER,
              FLAG  TYPE C,               " Update Flag
              LIFNR TYPE LIFNR,           " Vendor Number
              BUKRS TYPE BUKRS,           " Company Code
              KTOKK TYPE KTOKK,           " Account Group
              ANRED TYPE ANRED,           " Title
              NAME1 TYPE NAME1_GP,        " Name1
              NAME2 TYPE NAME2_GP,        " Name2
              SORTL TYPE SORTL,           " Search Term 1
              SORT2 TYPE AD_SORT2UL,      " Search Term 2
              STRAS TYPE STRAS_GP,        " Street
              PSTLZ TYPE PSTLZ,           " Postal Code
              ORT01 TYPE ORT01_GP,        " City
              REGIO TYPE REGIO,           " Region
              LAND1 TYPE LAND1_GP,        " Country
              SPRAS TYPE SPRAS,           " Language
              VBUND TYPE RASSC,           " Trading Partner
              BANKS TYPE BANKS,           " Country
              BANKL TYPE BANKK,           " Bank Key
              BANKN TYPE BANKN,           " Bank Account
              BKONT TYPE BKONT,           " Bank Control Key
              BANKA TYPE BANKA,           " Name of Bank
              AKONT TYPE AKONT,           " Reconciliation Account
              FDGRV TYPE FDGRV,           " Cash Management Group
              ZTERM TYPE DZTERM,          " Payment Terms
              REPRF TYPE REPRF,           " Check Double Invoice
              ZWELS TYPE DZWELS,          " Payment Methods
              XPORE TYPE XPORE,           " Pay all items separately
            END   OF TY_VENDOR_MASTER,
    Int'table to hold Vendor Extend Data
            BEGIN OF TY_VENDOR_EXTEND,
              FLAG  TYPE C,               " Update Flag
              LIFNR     TYPE LIFNR,           " Vendor Number
              BUKRS     TYPE BUKRS,           " Company Code
              KTOKK     TYPE KTOKK,           " Account Group
              REF_LIFNR TYPE LIFNR,           " Reference Vendor Number
              REF_BUKRS TYPE BUKRS,           " Reference Company Code
              AKONT     TYPE AKONT,           " Reconciliation Account
              FDGRV     TYPE FDGRV,           " Cash Management Group
              ZTERM     TYPE DZTERM,          " Payment Terms
              REPRF     TYPE REPRF,           " Check Double Invoice
              ZWELS     TYPE DZWELS,          " Payment Methods
              XPORE TYPE XPORE,           " Pay all items separately
            END   OF TY_VENDOR_EXTEND,
    Int'table to hold Error Records Data
            BEGIN OF TY_ERROR,
              MSG(200) TYPE C,                " To hold Message
              LIFNR    TYPE LIFNR,            " Vendor Number
              BUKRS    TYPE BUKRS,            " Company Code
            END   OF TY_ERROR.
                         DATA (Simple Fields)
    DATA : W_COUNT TYPE I,               " Variable to hold count of Records
           W_SUCC_REC TYPE I,            " No. of Success Records
           W_SUCC_REC1 TYPE I,           " No. of Updated Records
           W_ERR_REC TYPE I,             " No. of Error Records
           w_noupdate_rec type i.        " No. of Records not Changed
                         INTERNAL TABLES
    Int'table to hold uploaded data from File
    DATA : IT_VENDOR_MASTER    TYPE STANDARD TABLE OF TY_VENDOR_MASTER,
           WA_IT_VENDOR_MASTER TYPE TY_VENDOR_MASTER,
           IT_VENDOR_EXTEND    TYPE STANDARD TABLE OF TY_VENDOR_EXTEND,
           WA_IT_VENDOR_EXTEND TYPE TY_VENDOR_EXTEND,
           WA_IT_BDCDATA       TYPE BDCDATA,
           IT_BDCDATA          TYPE STANDARD TABLE OF BDCDATA,
           WA_IT_MESSTAB       TYPE BDCMSGCOLL,
           IT_MESSTAB          TYPE STANDARD TABLE OF BDCMSGCOLL,
           IT_ERROR            TYPE STANDARD TABLE OF TY_ERROR,
           WA_IT_ERROR         TYPE TY_ERROR,
           it_error_fk01       type standard table of ty_error,
           wa_it_error_fk01    type ty_error,
           it_error_fk02       type standard table of ty_error,
           wa_it_error_fk02    type ty_error,
           it_succ_rec1        type standard table of ty_error,
           wa_it_succ_rec1     type ty_error,
           it_noupdate         type standard table of ty_error,
           wa_it_noupdate      type ty_error.
                         FLAGS
    DATA : FL_FLAG1 TYPE C,          " Flag to check error upload file
           FL_FLAG2 TYPE C,          " Flag to hold value
           FL_FLAG3 TYPE C,          " Flag to hold value
           FL_FLAG4 TYPE C.          " Flag to hold value
                         SELECTION-SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN : BEGIN OF LINE,
                COMMENT 1(30) TEXT-001,
                POSITION POS_LOW.
    PARAMETERS :       P_FILE(128) DEFAULT 'C:\UPLOAD.TXT' OBLIGATORY.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE,
                COMMENT 1(30) TEXT-002,
                POSITION POS_LOW.
    PARAMETERS :       P_VENMAS RADIOBUTTON GROUP R1 DEFAULT 'X'.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE,
                COMMENT 1(30) TEXT-003,
                POSITION POS_LOW.
    PARAMETERS :       P_VENEXT RADIOBUTTON GROUP R1.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN SKIP 2.
    SELECTION-SCREEN : BEGIN OF LINE,
                COMMENT 1(30) TEXT-004,
                POSITION POS_LOW.
    PARAMETERS :       P_MODE(1) DEFAULT 'N'.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE,
                COMMENT 1(30) TEXT-005,
                POSITION POS_LOW.
    PARAMETERS :       P_GROUP(12) DEFAULT 'ZFC_VENDOR_C' OBLIGATORY.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE,
                COMMENT 1(30) TEXT-016,
                POSITION POS_LOW.
    PARAMETERS :       P_GROUP1(12) DEFAULT 'ZFC_VENDOR_U' OBLIGATORY.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN END OF BLOCK B1.
                         AT SELECTION-SCREEN ON
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    Form to get file path for upload of data
      PERFORM GET_FILE_PATH.
    AT SELECTION-SCREEN ON BLOCK B1.
    Form to Validate data specified on Selection Screen
      CHECK SSCRFIELDS-UCOMM EQ 'ONLI'.
      PERFORM VALIDATE_DATA.
                         START - OF - SELECTION
    START-OF-SELECTION.
      IF P_VENMAS = 'X'.
    Form to upload data from Presentation Server for Vendor Master
        PERFORM UPLOAD_DATA TABLES IT_VENDOR_MASTER.
        IF FL_FLAG1 NE 'X'.
          SORT IT_VENDOR_MASTER BY LIFNR BUKRS KTOKK.
          DELETE IT_VENDOR_MASTER WHERE LIFNR = ' '
                                  AND   BUKRS = ' '
                                  AND   KTOKK = ' '.
    Form to process data for Vendor Master
          PERFORM INSERT_VENDOR_MASTER_DATA.
        ENDIF.
      ELSEIF P_VENEXT = 'X'.
    Form to upload data from Presentation Server for Vendor Extend
        PERFORM UPLOAD_DATA TABLES IT_VENDOR_EXTEND.
        IF FL_FLAG1 NE 'X'.
          SORT IT_VENDOR_EXTEND BY LIFNR BUKRS KTOKK.
          DELETE IT_VENDOR_EXTEND WHERE LIFNR = ' '
                                  AND   BUKRS = ' '
                                  AND   KTOKK = ' '.
    Form to process data for Vendor Master
          PERFORM CHK_AND_INS_VENDOR_EXTEND_DATA.
        ENDIF.
      ENDIF.
                         END - OF - SELECTION
    END-OF-SELECTION.
      IF FL_FLAG1 NE 'X'.
        FORMAT COLOR 7.
        WRITE:/2 TEXT-O01.           " Total Number of records read :
        FORMAT COLOR OFF.
        WRITE:40 W_COUNT.
        FORMAT COLOR 7.
        WRITE:/2 TEXT-O02.           " Total Number of Success records :
        FORMAT COLOR OFF.
        WRITE:40 W_SUCC_REC.
        FORMAT COLOR 7.
        WRITE:/2 TEXT-O07.           " Total Number of Updated records :
        FORMAT COLOR OFF.
        WRITE:40 W_SUCC_REC1.
        FORMAT COLOR 7.
        WRITE:/2 TEXT-O08.           " Total Number of Unchanged records :
        FORMAT COLOR OFF.
        WRITE:40 W_noupdate_REC.
        FORMAT COLOR 7.
        WRITE:/2 TEXT-O03.           " Total Number of Error records :
        FORMAT COLOR OFF.
        WRITE:40 W_ERR_REC.
        if not it_succ_rec1 is initial.
          skip 1.
          perform display_changed_report.
        endif.
        if not it_noupdate is initial.
          skip 1.
          perform display_nochange_report.
        endif.
        IF NOT IT_ERROR IS INITIAL.
          SKIP 3.
    Form to display error data
          PERFORM DISPLAY_ERROR_REPORT.
        ENDIF.
        IF FL_FLAG2 = 'X'.
          SKIP 2.
          FORMAT COLOR 4.
          WRITE:/2 TEXT-O04.        " BDC Session Name for Creation (FK01) :
          FORMAT COLOR OFF.
          WRITE:40 P_GROUP.
          perform display_error_report_fk01.
        ENDIF.
        IF FL_FLAG3 = 'X'.
          SKIP 2.
          FORMAT COLOR 4.
          WRITE:/2 TEXT-O09.        " BDC Session Name for Updation (FK02) :
          FORMAT COLOR OFF.
          WRITE:40 P_GROUP1.
          perform display_error_report_fk02.
        ENDIF.
      ENDIF.
    *&      Form  GET_FILE_PATH
    This form is used to get the specified path for uploading of data from
    flat file with the help of F4 function key
    FORM GET_FILE_PATH .
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          PROGRAM_NAME  = SYST-CPROG
          DYNPRO_NUMBER = SYST-DYNNR
          FIELD_NAME    = ' '
        IMPORTING
          FILE_NAME     = P_FILE.
    ENDFORM.                    " GET_FILE_PATH
    *&      Form  VALIDATE_DATA
    This form is used to validate the data given by user on the Selection
    Screen and the appropriate message is been displayed when an wrong
    entry is inputted
    FORM VALIDATE_DATA .
      IF SY-BATCH EQ 'X'.
        CLEAR SSCRFIELDS-UCOMM.
        MESSAGE E001(ZZ) WITH TEXT-011.
        " Excel file not to be used in Batch Mode
      ENDIF.
      IF P_MODE NE 'A' AND P_MODE NE 'N' AND P_MODE NE 'E'.
        MESSAGE E001(ZZ) WITH TEXT-012.
        " Session Mode should be either A or N or E
      ENDIF.
    ENDFORM.                    " VALIDATE_DATA
    *&      Form  UPLOAD_DATA
    This form is used to upload data from Presentation Server for either
    Vendor Master or Vendor Extend
    FORM UPLOAD_DATA TABLES P_IT_VENDOR.
      DATA : L_FILENAME TYPE STRING,
             L_FILETYPE TYPE CHAR10 VALUE 'ASC',
             L_HEADER_LENGTH TYPE I VALUE 0,
             L_READ_BY_LINE TYPE CHAR01 VALUE 'X'.
      MOVE P_FILE TO L_FILENAME.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                = L_FILENAME
          FILETYPE                = L_FILETYPE
          HEADER_LENGTH           = L_HEADER_LENGTH
          READ_BY_LINE            = L_READ_BY_LINE
          HAS_FIELD_SEPARATOR     = C_SPLIT
        TABLES
          DATA_TAB                = P_IT_VENDOR
        EXCEPTIONS
          FILE_OPEN_ERROR         = 1
          FILE_READ_ERROR         = 2
          NO_BATCH                = 3
          GUI_REFUSE_FILETRANSFER = 4
          INVALID_TYPE            = 5
          NO_AUTHORITY            = 6
          UNKNOWN_ERROR           = 7
          BAD_DATA_FORMAT         = 8
          HEADER_NOT_ALLOWED      = 9
          SEPARATOR_NOT_ALLOWED   = 10
          HEADER_TOO_LONG         = 11
          UNKNOWN_DP_ERROR        = 12
          ACCESS_DENIED           = 13
          DP_OUT_OF_MEMORY        = 14
          DISK_FULL               = 15
          DP_TIMEOUT              = 16
          OTHERS                  = 17.
      IF SY-SUBRC <> 0.
       MESSAGE I001(ZZ) WITH TEXT-006 L_FILENAME.
    MESSAGE ID SY-MSGID TYPE 'I' NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        FL_FLAG1 = 'X'.
      ELSEIF P_IT_VENDOR[] IS INITIAL.
        MESSAGE I001(ZZ) WITH TEXT-014.   " Uploaded File contains no data
        FL_FLAG1 = 'X'.
      ENDIF.
    ENDFORM.                    " UPLOAD_DATA
    *&      Form  INSERT_VENDOR_MASTER_DATA
    This form is used to process BDC data for Vendor Master
    FORM INSERT_VENDOR_MASTER_DATA .
      DATA : L_LIFNR TYPE LIFNR.
      CLEAR : L_LIFNR.
      sort it_vendor_master by flag.
      LOOP AT IT_VENDOR_MASTER INTO WA_IT_VENDOR_MASTER.
        W_COUNT = W_COUNT + 1.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            INPUT  = WA_IT_VENDOR_MASTER-LIFNR
          IMPORTING
            OUTPUT = WA_IT_VENDOR_MASTER-LIFNR.
        if wa_it_vendor_master-flag = 'A'.
        SELECT SINGLE LIFNR
               FROM LFB1
               INTO L_LIFNR
               WHERE LIFNR = WA_IT_VENDOR_MASTER-LIFNR
               AND   BUKRS = WA_IT_VENDOR_MASTER-BUKRS.
        IF SY-SUBRC EQ 0.
          WA_IT_ERROR-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.
          WA_IT_ERROR-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.
          WA_IT_ERROR-MSG   = TEXT-015.
          APPEND WA_IT_ERROR TO IT_ERROR.
          W_ERR_REC = W_ERR_REC + 1.
          CLEAR : WA_IT_ERROR, L_LIFNR.
        ELSE.
          REFRESH IT_BDCDATA.
          CLEAR IT_BDCDATA.
          PERFORM POPULATE_BDC_DATA_VEN_MASTER.
          PERFORM CALL_TRANSACTION.
        ENDIF.
        CLEAR : WA_IT_VENDOR_MASTER.
        elseif wa_it_vendor_master-flag = 'C'.
          IF FL_FLAG2 = 'X' and fl_flag4 ne 'X'.
            PERFORM CLOSE_BDC_SESSION.
            fl_flag4 = 'X'.
          ENDIF.
          REFRESH IT_BDCDATA.
          CLEAR IT_BDCDATA.
          PERFORM POPULATE_BDC_DATA_VEN_MASTER.
          PERFORM CALL_TRANSACTION_FK02.
          CLEAR : WA_IT_VENDOR_MASTER.
        elseif wa_it_vendor_master-flag = 'N'.
          WA_IT_noupdate-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.
          WA_IT_noupdate-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.
          WA_IT_noupdate-MSG   = TEXT-018.
          APPEND WA_IT_noupdate TO IT_noupdate.
          W_noupdate_REC = W_noupdate_REC + 1.
          CLEAR : WA_IT_noupdate, WA_IT_VENDOR_MASTER.
        endif.
      ENDLOOP.
      IF FL_FLAG3 = 'X'.
        PERFORM CLOSE_BDC_SESSION.
      ENDIF.
    ENDFORM.                    " INSERT_VENDOR_MASTER_DATA
    *&      Form  POPULATE_BDC_DATA_VEN_MASTER
    This form is used to populate BDC data of Vendor Master
    FORM POPULATE_BDC_DATA_VEN_MASTER .
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          INPUT  = WA_IT_VENDOR_MASTER-ZTERM
        IMPORTING
          OUTPUT = WA_IT_VENDOR_MASTER-ZTERM.
      IF WA_IT_VENDOR_MASTER-REPRF = 'Y'.
        WA_IT_VENDOR_MASTER-REPRF = 'X'.
      ENDIF.
      IF WA_IT_VENDOR_MASTER-XPORE = 'Y'.
        WA_IT_VENDOR_MASTER-XPORE = 'X'.
      ENDIF.
      if wa_it_vendor_master-flag = 'A'.
      PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0105',
               BDC_FIELD  USING 'RF02K-LIFNR' WA_IT_VENDOR_MASTER-LIFNR,
               BDC_FIELD  USING 'RF02K-BUKRS' WA_IT_VENDOR_MASTER-BUKRS,
               BDC_FIELD  USING 'RF02K-KTOKK' WA_IT_VENDOR_MASTER-KTOKK,
               BDC_FIELD  USING 'BDC_OKCODE'  '/00'.
      elseif wa_it_vendor_master-flag = 'C'.
      PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0106',
               BDC_FIELD  USING 'RF02K-LIFNR' WA_IT_VENDOR_MASTER-LIFNR,
               BDC_FIELD  USING 'RF02K-BUKRS' WA_IT_VENDOR_MASTER-BUKRS,
               BDC_FIELD  USING 'BDC_OKCODE'  '=MALL',
               BDC_DYNPRO USING 'SAPMF02K' '0106',
               BDC_FIELD  USING 'RF02K-D0110' 'X',
               BDC_FIELD  USING 'RF02K-D0120' 'X',
               BDC_FIELD  USING 'RF02K-D0130' 'X',
               BDC_FIELD  USING 'RF02K-D0210' 'X',
               BDC_FIELD  USING 'RF02K-D0215' 'X',
               BDC_FIELD  USING 'RF02K-D0220' 'X',
               BDC_FIELD  USING 'BDC_OKCODE'  '/00'.
      endif.
      perform :BDC_DYNPRO USING 'SAPMF02K' '0110',
               BDC_FIELD  USING 'LFA1-ANRED'  WA_IT_VENDOR_MASTER-ANRED,
               BDC_FIELD  USING 'LFA1-NAME1'  WA_IT_VENDOR_MASTER-NAME1,
               BDC_FIELD  USING 'LFA1-NAME2'  WA_IT_VENDOR_MASTER-NAME2,
               BDC_FIELD  USING 'LFA1-SORTL'  WA_IT_VENDOR_MASTER-SORTL,
               BDC_FIELD  USING 'LFA1-STRAS'  WA_IT_VENDOR_MASTER-STRAS,
               BDC_FIELD  USING 'LFA1-ORT01'  WA_IT_VENDOR_MASTER-ORT01,
               BDC_FIELD  USING 'LFA1-PSTLZ'  WA_IT_VENDOR_MASTER-PSTLZ,
               BDC_FIELD  USING 'LFA1-LAND1'  WA_IT_VENDOR_MASTER-LAND1,
               BDC_FIELD  USING 'LFA1-REGIO'  WA_IT_VENDOR_MASTER-REGIO,
               BDC_FIELD  USING 'LFA1-SPRAS'  WA_IT_VENDOR_MASTER-SPRAS,
               BDC_FIELD  USING 'BDC_OKCODE'  '/00',
               BDC_DYNPRO USING 'SAPMF02K' '0120',
               BDC_FIELD  USING 'LFA1-VBUND'  WA_IT_VENDOR_MASTER-VBUND,
               BDC_FIELD  USING 'BDC_OKCODE'  '/00',
               BDC_DYNPRO USING 'SAPMF02K' '0130',
               BDC_FIELD  USING 'LFBK-BANKS(01)'  WA_IT_VENDOR_MASTER-BANKS,
               BDC_FIELD  USING 'LFBK-BANKL(01)'  WA_IT_VENDOR_MASTER-BANKL,
               BDC_FIELD  USING 'LFBK-BANKN(01)'  WA_IT_VENDOR_MASTER-BANKN,
               BDC_FIELD  USING 'BDC_OKCODE'  '=BANK',
               BDC_DYNPRO USING 'SAPLBANK' '0100',
               BDC_FIELD  USING 'BNKA-BANKA'  WA_IT_VENDOR_MASTER-BANKA,
               BDC_FIELD  USING 'BDC_OKCODE'  '=ENTR',
               BDC_DYNPRO USING 'SAPMF02K' '0130',
               BDC_FIELD  USING 'BDC_OKCODE'  '=ENTR',
               BDC_DYNPRO USING 'SAPMF02K' '0210',
               BDC_FIELD  USING 'LFB1-AKONT'  WA_IT_VENDOR_MASTER-AKONT,
               BDC_FIELD  USING 'LFB1-FDGRV'  WA_IT_VENDOR_MASTER-FDGRV,
               BDC_FIELD  USING 'BDC_OKCODE'  '=/00',
               BDC_DYNPRO USING 'SAPMF02K' '0215',
               BDC_FIELD  USING 'LFB1-ZTERM'  WA_IT_VENDOR_MASTER-ZTERM,
               BDC_FIELD  USING 'LFB1-REPRF'  WA_IT_VENDOR_MASTER-REPRF,
               BDC_FIELD  USING 'LFB1-ZWELS'  WA_IT_VENDOR_MASTER-ZWELS,
               BDC_FIELD  USING 'LFB1-XPORE'  WA_IT_VENDOR_MASTER-XPORE,
               BDC_FIELD  USING 'BDC_OKCODE'  '=UPDA'.
    ENDFORM.                    " POPULATE_BDC_DATA_VEN_MASTER
    *&      Form  BDC_DYNPRO
    This form is used to move data to BDCDATA int'table
    FORM BDC_DYNPRO  USING PROGRAM TYPE BDC_PROG
                           DYNPRO  TYPE BDC_DYNR.
      CLEAR WA_IT_BDCDATA.
      WA_IT_BDCDATA-PROGRAM  = PROGRAM.
      WA_IT_BDCDATA-DYNPRO   = DYNPRO.
      WA_IT_BDCDATA-DYNBEGIN = 'X'.
      APPEND WA_IT_BDCDATA TO IT_BDCDATA.
    ENDFORM.                    " BDC_DYNPRO
    *&      Form  BDC_FIELD
    This form is used to move data to BDCDATA int'table
    FORM BDC_FIELD  USING FNAM TYPE ANY
                          FVAL TYPE ANY.
      CLEAR WA_IT_BDCDATA.
      WA_IT_BDCDATA-FNAM = FNAM.
      WA_IT_BDCDATA-FVAL = FVAL.
      APPEND WA_IT_BDCDATA TO IT_BDCDATA.
    ENDFORM.                    " BDC_FIELD
    *&      Form  CALL_TRANSACTION
    This form is used to Call FK01 for processing of data either for
    Vendor Master or Vendor Extend. The error records are inserted to
    Session which can be processed using SM35
    FORM CALL_TRANSACTION .
      DATA : L_OPTION TYPE CTU_PARAMS,
             L_SUBRC TYPE SYSUBRC.
      REFRESH IT_MESSTAB.
      CLEAR IT_MESSTAB.
      L_OPTION-DEFSIZE = 'X'.
      L_OPTION-DISMODE = P_MODE.
      L_OPTION-UPDMODE = 'S'.
      CALL TRANSACTION 'FK01'
           USING IT_BDCDATA
           MESSAGES INTO IT_MESSTAB
           OPTIONS FROM L_OPTION.
      L_SUBRC = SY-SUBRC.
      IF L_SUBRC = 0.
        W_SUCC_REC = W_SUCC_REC + 1.
      ELSE.
        IF FL_FLAG2 NE 'X'.
          PERFORM OPEN_BDC_SESSION.
          FL_FLAG2 = 'X'.
        ENDIF.
        PERFORM BDC_INSERT.
        W_ERR_REC = W_ERR_REC + 1.
        PERFORM ERROR_RECORD_DATA.
      ENDIF.
    ENDFORM.                    " CALL_TRANSACTION
    *&      Form  OPEN_BDC_SESSION
    Form used to open session for Error out Records
    FORM OPEN_BDC_SESSION .
      DATA : L_USERID TYPE APQ_MAPN,      " Variable to hold user-id
             L_GROUP TYPE APQ_GRPN.       " Variable to hold value
      MOVE P_GROUP TO L_GROUP.
      MOVE SY-UNAME TO L_USERID.
      CALL FUNCTION 'BDC_OPEN_GROUP'
        EXPORTING
          CLIENT              = SY-MANDT
          GROUP               = L_GROUP
          KEEP                = SPACE
          USER                = L_USERID
        EXCEPTIONS
          CLIENT_INVALID      = 1
          DESTINATION_INVALID = 2
          GROUP_INVALID       = 3
          GROUP_IS_LOCKED     = 4
          HOLDDATE_INVALID    = 5
          INTERNAL_ERROR      = 6
          QUEUE_ERROR         = 7
          RUNNING             = 8
          SYSTEM_LOCK_ERROR   = 9
          USER_INVALID        = 10
          OTHERS              = 11.
      IF SY-SUBRC <> 0.
        WRITE:/ TEXT-008.              " Unable to open BDC Session
      ENDIF.
    ENDFORM.                    " OPEN_BDC_SESSION
    *&      Form  BDC_INSERT
    This form is used to insert error records to a Session method
    FORM BDC_INSERT .
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          TCODE            = 'FK01'
        TABLES
          DYNPROTAB        = IT_BDCDATA
        EXCEPTIONS
          INTERNAL_ERROR   = 1
          NOT_OPEN         = 2
          QUEUE_ERROR      = 3
          TCODE_INVALID    = 4
          PRINTING_INVALID = 5
          POSTING_INVALID  = 6
          OTHERS           = 7.
      IF SY-SUBRC <> 0.
        WRITE:/ TEXT-009.             " Unable to Insert Data to BDC Session
      ENDIF.
    ENDFORM.                    " BDC_INSERT
    *&      Form  ERROR_RECORD_DATA
    This form is used to process the messages for the error records which
    will be displayed on the output report
    FORM ERROR_RECORD_DATA .
      DATA : L_LINES TYPE I,
             L_MSG(200) TYPE C.
      DESCRIBE TABLE IT_MESSTAB LINES L_LINES.
      READ TABLE IT_MESSTAB INTO WA_IT_MESSTAB INDEX L_LINES.
      IF SY-SUBRC = 0.
        CLEAR L_MSG.
        CALL FUNCTION 'FORMAT_MESSAGE'
          EXPORTING
            ID        = WA_IT_MESSTAB-MSGID
            LANG      = SY-LANGU
            NO        = WA_IT_MESSTAB-MSGNR
            V1        = WA_IT_MESSTAB-MSGV1
            V2        = WA_IT_MESSTAB-MSGV2
            V3        = WA_IT_MESSTAB-MSGV3
            V4        = WA_IT_MESSTAB-MSGV4
          IMPORTING
            MSG       = L_MSG
          EXCEPTIONS
            NOT_FOUND = 1
            OTHERS    = 2.
        IF SY-SUBRC = 0.
          WA_IT_ERROR_fk01-MSG = L_MSG.
        ENDIF.
        IF P_VENMAS = 'X'.
          WA_IT_ERROR_fk01-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.
          WA_IT_ERROR_fk01-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.
        ELSEIF P_VENEXT = 'X'.
          WA_IT_ERROR_fk01-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.
          WA_IT_ERROR_fk01-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.
        ENDIF.
        APPEND WA_IT_ERROR_fk01 TO IT_ERROR_fk01.
        CLEAR WA_IT_ERROR_fk01.
      ENDIF.
    ENDFORM.                    " ERROR_RECORD_DATA
    *&      Form  CLOSE_BDC_SESSION
    Form used to close session of the Error Records
    FORM CLOSE_BDC_SESSION .
      CALL FUNCTION 'BDC_CLOSE_GROUP'
        EXCEPTIONS
          NOT_OPEN    = 1
          QUEUE_ERROR = 2
          OTHERS      = 3.
      IF SY-SUBRC <> 0.
        WRITE:/ TEXT-010.             " Unable to Close BDC Session
      ENDIF.
    ENDFORM.                    " CLOSE_BDC_SESSION
    *&      Form  CHK_AND_INS_VENDOR_EXTEND_DATA
    This form is used to process BDC data for Vendor Extend
    FORM CHK_AND_INS_VENDOR_EXTEND_DATA .
      DATA : L_LIFNR TYPE LIFNR.
      CLEAR : L_LIFNR, fl_flag4.
      sort it_vendor_extend by flag.
      LOOP AT IT_VENDOR_EXTEND INTO WA_IT_VENDOR_EXTEND.
        W_COUNT = W_COUNT + 1.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            INPUT  = WA_IT_VENDOR_EXTEND-REF_LIFNR
          IMPORTING
            OUTPUT = WA_IT_VENDOR_EXTEND-REF_LIFNR.
        if wa_it_vendor_extend-flag = 'A'.
        SELECT SINGLE LIFNR
               FROM LFB1
               INTO L_LIFNR
               WHERE LIFNR = WA_IT_VENDOR_EXTEND-REF_LIFNR
               AND   BUKRS = WA_IT_VENDOR_EXTEND-REF_BUKRS.
        IF SY-SUBRC NE 0.
          WA_IT_ERROR-LIFNR = WA_IT_VENDOR_EXTEND-REF_LIFNR.
          WA_IT_ERROR-BUKRS = WA_IT_VENDOR_EXTEND-REF_BUKRS.
          WA_IT_ERROR-MSG   = TEXT-007.
          APPEND WA_IT_ERROR TO IT_ERROR.
          W_ERR_REC = W_ERR_REC + 1.
          CLEAR : WA_IT_ERROR, L_LIFNR.
        ELSE.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              INPUT  = WA_IT_VENDOR_EXTEND-LIFNR
            IMPORTING
              OUTPUT = WA_IT_VENDOR_EXTEND-LIFNR.
          SELECT SINGLE LIFNR
                 FROM LFB1
                 INTO L_LIFNR
                 WHERE LIFNR = WA_IT_VENDOR_EXTEND-LIFNR
                 AND   BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.
          IF SY-SUBRC EQ 0.
            WA_IT_ERROR-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.
            WA_IT_ERROR-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.
            WA_IT_ERROR-MSG   = TEXT-015.
            APPEND WA_IT_ERROR TO IT_ERROR.
            W_ERR_REC = W_ERR_REC + 1.
            CLEAR : WA_IT_ERROR, L_LIFNR.
          ELSE.
            REFRESH IT_BDCDATA.
            CLEAR IT_BDCDATA.
            PERFORM POPULATE_BDC_DATA_VEN_EXTEND.
            PERFORM CALL_TRANSACTION.
          ENDIF.
        ENDIF.
        CLEAR : WA_IT_VENDOR_EXTEND.
        elseif wa_it_vendor_extend-flag = 'C'.
          IF FL_FLAG2 = 'X' and fl_flag4 ne 'X'.
            PERFORM CLOSE_BDC_SESSION.
            fl_flag4 = 'X'.
          ENDIF.
          REFRESH IT_BDCDATA.
          CLEAR IT_BDCDATA.
          PERFORM POPULATE_BDC_DATA_VEN_extend.
          PERFORM CALL_TRANSACTION_FK02.
           CLEAR : WA_IT_VENDOR_EXTEND.
        elseif wa_it_vendor_extend-flag = 'N'.
          WA_IT_noupdate-LIFNR = WA_IT_VENDOR_extend-LIFNR.
          WA_IT_noupdate-BUKRS = WA_IT_VENDOR_extend-BUKRS.
          WA_IT_noupdate-MSG   = TEXT-019.
          APPEND WA_IT_noupdate TO IT_noupdate.
          W_noupdate_REC = W_noupdate_REC + 1.
          CLEAR : WA_IT_noupdate, WA_IT_VENDOR_EXTEND.
        endif.
      ENDLOOP.
      IF FL_FLAG2 = 'X'.
        PERFORM CLOSE_BDC_SESSION.
      ENDIF.
      if fl_flag3 = 'X'.
        PERFORM CLOSE_BDC_SESSION.
      ENDIF.
    ENDFORM.                    " CHK_AND_INS_VENDOR_EXTEND_DATA
    *&      Form  POPULATE_BDC_DATA_VEN_EXTEND
    This form is used to populate BDC data of Vendor Extend
    FORM POPULATE_BDC_DATA_VEN_EXTEND .
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          INPUT  = WA_IT_VENDOR_EXTEND-ZTERM
        IMPORTING
          OUTPUT = WA_IT_VENDOR_EXTEND-ZTERM.
      IF WA_IT_VENDOR_EXTEND-REPRF = 'Y'.
        WA_IT_VENDOR_EXTEND-REPRF = 'X'.
      ENDIF.
      IF WA_IT_VENDOR_extend-XPORE = 'Y'.
        WA_IT_VENDOR_extend-XPORE = 'X'.
      ENDIF.
      if wa_it_vendor_extend-flag = 'A'.
      PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0105',
               BDC_FIELD  USING 'RF02K-LIFNR' WA_IT_VENDOR_EXTEND-LIFNR,
               BDC_FIELD  USING 'RF02K-BUKRS' WA_IT_VENDOR_EXTEND-BUKRS,
               BDC_FIELD  USING 'RF02K-KTOKK' WA_IT_VENDOR_EXTEND-KTOKK,
               BDC_FIELD  USING 'RF02K-REF_LIFNR'
                                          WA_IT_VENDOR_EXTEND-REF_LIFNR,
               BDC_FIELD  USING 'RF02K-REF_BUKRS'
                                          WA_IT_VENDOR_EXTEND-REF_BUKRS,
               BDC_FIELD  USING 'BDC_OKCODE'  '/00'.
      elseif wa_it_vendor_extend-flag = 'C'.
      PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0106',
               BDC_FIELD  USING 'RF02K-LIFNR' WA_IT_VENDOR_extend-LIFNR,
               BDC_FIELD  USING 'RF02K-BUKRS' WA_IT_VENDOR_extend-BUKRS,
               BDC_FIELD  USING 'RF02K-D0210' 'X',
               BDC_FIELD  USING 'RF02K-D0215' 'X',
               BDC_FIELD  USING 'BDC_OKCODE'  '/00'.
      endif.
      perform :BDC_DYNPRO USING 'SAPMF02K' '0210',
               BDC_FIELD  USING 'LFB1-AKONT'  WA_IT_VENDOR_EXTEND-AKONT,
               BDC_FIELD  USING 'LFB1-FDGRV'  WA_IT_VENDOR_EXTEND-FDGRV,
               BDC_FIELD  USING 'BDC_OKCODE'  '=/00',
               BDC_DYNPRO USING 'SAPMF02K' '0215',
               BDC_FIELD  USING 'LFB1-ZTERM'  WA_IT_VENDOR_EXTEND-ZTERM,
               BDC_FIELD  USING 'LFB1-REPRF'  WA_IT_VENDOR_EXTEND-REPRF,
               BDC_FIELD  USING 'LFB1-ZWELS'  WA_IT_VENDOR_EXTEND-ZWELS,
               BDC_FIELD  USING 'LFB1-XPORE'  WA_IT_VENDOR_extend-XPORE,
               BDC_FIELD  USING 'BDC_OKCODE'  '=UPDA'.
    ENDFORM.                    " POPULATE_BDC_DATA_VEN_EXTEND
    *&      Form  DISPLAY_ERROR_REPORT
    This form is used to display the error records on the output screen
    FORM DISPLAY_ERROR_REPORT .
      IF P_VENMAS = 'X'.
        WRITE:/ TEXT-O05.            " Error List for Vendor Master
      ELSEIF P_VENEXT = 'X'.
        WRITE:/ TEXT-O06.            " Error List for Vendor Master Extended
      ENDIF.
      WRITE:/ SY-ULINE(100).
      FORMAT COLOR 1.
      WRITE:/1   SY-VLINE,
             2   TEXT-H01,              " Vendor Number
             17  SY-VLINE,
             18  TEXT-H02,              " Company Code
             31  SY-VLINE,
             32  TEXT-H03,              " Error Message
             100 SY-VLINE.
      FORMAT COLOR OFF.
      WRITE:/ SY-ULINE(100).
      LOOP AT IT_ERROR INTO WA_IT_ERROR.
        FORMAT COLOR 2.
        WRITE:/1   SY-VLINE,
               2   WA_IT_ERROR-LIFNR,
               17  SY-VLINE,
               18  WA_IT_ERROR-BUKRS,
               31  SY-VLINE,
               32  WA_IT_ERROR-MSG,
               100 SY-VLINE.
        CLEAR : WA_IT_ERROR.
        FORMAT COLOR OFF.
      ENDLOOP.
      WRITE:/ SY-ULINE(100).
    ENDFORM.                    " DISPLAY_ERROR_REPORT
    *&      Form  CALL_TRANSACTION_FK02
    Form used to Call Transaction FK02
    form CALL_TRANSACTION_FK02 .
      DATA : L_OPTION TYPE CTU_PARAMS,
             L_SUBRC TYPE SYSUBRC.
      REFRESH IT_MESSTAB.
      CLEAR IT_MESSTAB.
      L_OPTION-DEFSIZE = 'X'.
      L_OPTION-DISMODE = P_MODE.
      L_OPTION-UPDMODE = 'S'.
      CALL TRANSACTION 'FK02'
           USING IT_BDCDATA
           MESSAGES INTO IT_MESSTAB
           OPTIONS FROM L_OPTION.
      L_SUBRC = SY-SUBRC.
      IF L_SUBRC = 0.
        W_SUCC_REC1 = W_SUCC_REC1 + 1.
        WA_IT_succ_rec1-MSG = Text-017.
        IF P_VENMAS = 'X'.
          WA_IT_succ_rec1-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.
          WA_IT_succ_rec1-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.
        ELSEIF P_VENEXT = 'X'.
          WA_IT_succ_rec1-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.
          WA_IT_succ_rec1-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.
        ENDIF.
        APPEND WA_IT_succ_rec1 TO IT_succ_rec1.
      ELSE.
        IF FL_FLAG3 NE 'X'.
          PERFORM OPEN_BDC_SESSION_fk02.
          FL_FLAG3 = 'X'.
        ENDIF.
        PERFORM BDC_INSERT_fk02.
        W_ERR_REC = W_ERR_REC + 1.
        PERFORM ERROR_RECORD_DATA1.
      ENDIF.
    endform.                    " CALL_TRANSACTION_FK02
    *&      Form  OPEN_BDC_SESSION_fk02
    Form used to Open session for FK02
    form OPEN_BDC_SESSION_fk02 .
      DATA : L_USERID TYPE APQ_MAPN,      " Variable to hold user-id
             L_GROUP TYPE APQ_GRPN.       " Variable to hold value
      MOVE P_GROUP1 TO L_GROUP.
      MOVE SY-UNAME TO L_USERID.
      CALL FUNCTION 'BDC_OPEN_GROUP'
        EXPORTING
          CLIENT              = SY-MANDT
          GROUP               = L_GROUP
          KEEP                = SPACE
          USER                = L_USERID
        EXCEPTIONS
          CLIENT_INVALID      = 1
          DESTINATION_INVALID = 2
          GROUP_INVALID       = 3
          GROUP_IS_LOCKED     = 4
          HOLDDATE_INVALID    = 5
          INTERNAL_ERROR      = 6
          QUEUE_ERROR         = 7
          RUNNING             = 8
          SYSTEM_LOCK_ERROR   = 9
          USER_INVALID        = 10
          OTHERS              = 11.
      IF SY-SUBRC <> 0.
        WRITE:/ TEXT-008.              " Unable to open BDC Session
      ENDIF.
    endform.                    " OPEN_BDC_SESSION_fk02
    *&      Form  BDC_INSERT_fk02
    Form used to insert data into BDC session using FK02
    form BDC_INSERT_fk02 .
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          TCODE            = 'FK02'
        TABLES
          DYNPROTAB        = IT_BDCDATA
        EXCEPTIONS
          INTERNAL_ERROR   = 1
          NOT_OPEN         = 2
          QUEUE_ERROR      = 3
          TCODE_INVALID    = 4
          PRINTING_INVALID = 5
          POSTING_INVALID  = 6
          OTHERS           = 7.
      IF SY-SUBRC <> 0.
        WRITE:/ TEXT-009.             " Unable to Insert Data to BDC Session
      ENDIF.
    endform.                    " BDC_INSERT_fk02
    *&      Form  display_changed_report
    Form to display Updated Vendor data
    form display_changed_report .
      IF P_VENMAS = 'X'.
        WRITE:/ TEXT-O10.          " Updated List for Vendor Master
      ELSEIF P_VENEXT = 'X'.
        WRITE:/ TEXT-O11.          " Updated List for Vendor Master Extended
      ENDIF.
      WRITE:/ SY-ULINE(100).
      FORMAT COLOR 1.
      WRITE:/1   SY-VLINE,
             2   TEXT-H01,              " Vendor Number
             17  SY-VLINE,
             18  TEXT-H02,              " Company Code
             31  SY-VLINE,
             32  TEXT-H04,              " Message
             100 SY-VLINE.
      FORMAT COLOR OFF.
      WRITE:/ SY-ULINE(100).
      LOOP AT IT_succ_rec1 INTO WA_IT_succ_rec1.
        FORMAT COLOR 2.
        WRITE:/1   SY-VLINE,
               2   WA_IT_succ_rec1-LIFNR,
               17  SY-VLINE,
               18  WA_IT_succ_rec1-BUKRS,
               31  SY-VLINE,
               32  WA_IT_succ_rec1-MSG,
               100 SY-VLINE.
        CLEAR : WA_IT_succ_rec1.
        FORMAT COLOR OFF.
      ENDLOOP.
      WRITE:/ SY-ULINE(100).
    endform.                    " display_changed_report
    *&      Form  display_nochange_report
    Form to display No Changed data for Vendors
    form display_nochange_report .
      IF P_VENMAS = 'X'.
        WRITE:/ TEXT-O12.       " No Changes List for Vendor Master
      ELSEIF P_VENEXT = 'X'.
        WRITE:/ TEXT-O13.       " No Changes List for Vendor Master Extended
      ENDIF.
      WRITE:/ SY-ULINE(100).
      FORMAT COLOR 1.
      WRITE:/1   SY-VLINE,
             2   TEXT-H01,              " Vendor Number
             17  SY-VLINE,
             18  TEXT-H02,              " Company Code
             31  SY-VLINE,
             32  TEXT-H04,              " Message
             100 SY-VLINE.
      FORMAT COLOR OFF.
      WRITE:/ SY-ULINE(100).
      LOOP AT IT_noupdate INTO WA_IT_noupdate.
        FORMAT COLOR 2.
        WRITE:/1   SY-VLINE,
               2   WA_IT_noupdate-LIFNR,
               17  SY-VLINE,
               18  WA_IT_noupdate-BUKRS,
               31  SY-VLINE,
               32  WA_IT_noupdate-MSG,
               100 SY-VLINE.
        CLEAR : WA_IT_noupdate.
        FORMAT COLOR OFF.
      ENDLOOP.
      WRITE:/ SY-ULINE(100).
    endform.                    " display_nochange_report
    *&      Form  ERROR_RECORD_DATA1
    Form to get Error Message for Changed Vendors
    form ERROR_RECORD_DATA1 .
      DATA : L_LINES TYPE I,
             L_MSG(200) TYPE C.
      DESCRIBE TABLE IT_MESSTAB LINES L_LINES.
      READ TABLE IT_MESSTAB INTO WA_IT_MESSTAB INDEX L_LINES.
      IF SY-SUBRC = 0.
        CLEAR L_MSG.
        CALL FUNCTION 'FORMAT_MESSAGE'
          EXPORTING
            ID        = WA_IT_MESSTAB-MSGID
            LANG      = SY-LANGU
            NO        = WA_IT_MESSTAB-MSGNR
            V1        = WA_IT_MESSTAB-MSGV1
            V2        = WA_IT_MESSTAB-MSGV2
            V3        = WA_IT_MESSTAB-MSGV3
            V4        = WA_IT_MESSTAB-MSGV4
          IMPORTING
            MSG       = L_MSG
          EXCEPTIONS
            NOT_FOUND = 1
            OTHERS    = 2.
        IF SY-SUBRC = 0.
          WA_IT_ERROR_fk02-MSG = L_MSG.
        ENDIF.
        IF P_VENMAS = 'X'.
          WA_IT_ERROR_fk02-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.
          WA_IT_ERROR_fk02-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.
        ELSEIF P_VENEXT = 'X'.
          WA_IT_ERROR_fk02-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.
          WA_IT_ERROR_fk02-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.
        ENDIF.
        APPEND WA_IT_ERROR_fk02 TO IT_ERROR_fk02.
        CLEAR WA_IT_ERROR_fk02.
      ENDIF.
    endform.                    " ERROR_RECORD_DATA1
    *&      Form  display_error_report_fk01
    Form to display Error Report for Master Vendors (FK01)
    form display_error_report_fk01 .
      IF P_VENMAS = 'X'.
        WRITE:/ TEXT-O05.     " Error List for Vendor Master (FK01)
      ELSEIF P_VENEXT = 'X'.
        WRITE:/ TEXT-O06.     " Error List for Vendor Master Extended (FK01)
      ENDIF.
      WRITE:/ SY-ULINE(100).
      FORMAT COLOR 1.
      WRITE:/1   SY-VLINE,
             2   TEXT-H01,              " Vendor Number
             17  SY-VLINE,
             18  TEXT-H02,              " Company Code
             31  SY-VLINE,
             32  TEXT-H04,              " Message
             100 SY-VLINE.
      FORMAT COLOR OFF.
      WRITE:/ SY-ULINE(100).
      LOOP AT IT_ERROR_fk01 INTO WA_IT_ERROR_fk01.
        FORMAT COLOR 2.
        WRITE:/1   SY-VLINE,
               2   WA_IT_ERROR_fk01-LIFNR,
               17  SY-VLINE,
               18  WA_IT_ERROR_fk01-BUKRS,
               31  SY-VLINE,
               32  WA_IT_ERROR_fk01-MSG,
               100 SY-VLINE.
        CLEAR : WA_IT_ERROR_fk01.
        FORMAT COLOR OFF.
      ENDLOOP.
      WRITE:/ SY-ULINE(100).
    endform.                    " display_error_report_fk01
    *&      Form  display_error_report_fk02
    Form to display Error Report for changed Vendors (FK02)
    form display_error_report_fk02 .
      IF P_VENMAS = 'X'.
        WRITE:/ TEXT-O14.     " Error List for Vendor Master (FK02)
      ELSEIF P_VENEXT = 'X'.
        WRITE:/ TEXT-O15.     " Error List for Vendor Master Extended (FK02)
      ENDIF.
      WRITE:/ SY-ULINE(100).
      FORMAT COLOR 1.
      WRITE:/1   SY-VLINE,
             2   TEXT-H01,              " Vendor Number

  • Create Vendor Inforecords and source list for material

    Hi All,
    senario:I have to create vendor Inforecords and source list for new material as copy of reference material.
    There are various FM's available to read inforecord, source list but as reuirement is to copy these things from reference materil and create same for new material.
    Can you people suggest any way to achive these functionalies through any FM, BADI or any other way...
    Looking forword for your reply..
    Regards,
    Rahul

    Hi All,
    Can we use FM MGW_COPY_INFORECORDS to create inforecords for new material.
    Just to cross check, as i m not sure about use of this FM.
    Regards,
    Rahul

  • Custom purchase requsitionto vendor open and cleared payment report

    dear all i develop report but i cant ableto show in that open amount and cleared amount of vender in that report so please see this report and feedback me for logic to show open and clear amount of vendor purchase orderwise or vendorwise
    report zpo_purchase_history no standard page heading message-id 00.
    TABLES : bsik, bsak, lfa1, lfb1, skb1, t001, bapifvdexp_vzzbepp.
    type-pools:slis,ICON.
    types :begin of ty_po,
            banfn type eban-banfn,
            "Purchase Requisition Number
            bnfpo type eban-bnfpo,
            "Item Number of Purchase Requisition
            ekgrp type eban-ekgrp,                 "Purchasing Group
            badat type eban-badat,
            "Requisition (Request) Date
            menge type eban-menge,
            KNTTP TYPE EBAN-KNTTP,
             PSTYP type eban-PSTYP,
            "Purchase Requisition Quantity
            meins type eban-meins,
            "Purchase Requisition Unit of Measure
            lifnr type ekko-lifnr,                 "Vendor Account Number
            bedat type ekko-bedat,                 "Purchasing Document Date
            ebeln type ekpo-ebeln,
            "Purchasing Document Number
            ebelp type ekpo-ebelp,
            "Item Number of Purchasing Document
            matkl type ekpo-matkl,                 "Material Group
            mtart type ekpo-mtart,                 "Material Type
            matnr type ekpo-matnr,                 "Material Number
            txz01 type ekpo-txz01,                 "Short Text
            menge1 type ekpo-menge,                "Purchase Order Quantity
            meins1 type ekpo-meins,
            "Purchase Order Unit of Measure
            balqty type ekpo-menge,                "Balance Quantity
            netpr type ekpo-netpr,
            "Net Price in Purchasing Document
            peinh type ekpo-peinh,                 "Price Unit
            mblnr type mseg-mblnr,
            "Number of Material Document
            zeile type mseg-zeile,                 "Item in Material Document
            menge2 type mseg-menge,                "GR Quantity
            meins2 type mseg-meins,                "GR Unit of Measure
            werks type mseg-werks,                 "Plant
            charg type mseg-charg,                 "Batch
            belnr type rbkp-belnr,
            "Document Number of an Invoice Document
            bldat type ekbe-bldat,                 "Document Date in Document
            belnr_b type rbkp-belnr,
            SHKZG type ekbe-SHKZG ,                "Debit/Credit Indicator
            DMBTR type   bsik-dmbtr,                "Amount in Local Currency
            DMBTR_C type   bsAk-dmbtr,                "Amount in Local Currency
            thick(10) type c,                      "Thickness
            width(10) type c,                      "Width
            length(10) type c,                     "Length
            grade(10) type c,                        "Grade
            BELNR_d type bseg-belnr,
            xblnr type bkpf-xblnr,
            awkey  type bkpf-awkey,
            RMWWR type rbkp-RMWWR,
            WMWST1 type rbkp-WMWST1,
            end of ty_po.
    types :begin of ty_ekko,
            ebeln type ekko-ebeln,
            lifnr type ekko-lifnr,
            bedat type ekko-bedat,
            end of ty_ekko.
    types:begin of ty_ekpo,
            ebeln type ekpo-ebeln,
            ebelp type ekpo-ebelp,
            matnr type ekpo-matnr,
            txz01 type ekpo-txz01,
            menge type ekpo-menge,
            meins type ekpo-meins,
            netpr type ekpo-netpr,
            peinh type ekpo-peinh,
            banfn type ekpo-banfn,
            bnfpo type ekpo-bnfpo,
            mtart type ekpo-mtart,
            end of ty_ekpo.
    types :begin of ty_eban,
            banfn type eban-banfn,
            bnfpo type eban-bnfpo,
            matnr type eban-matnr,
            menge type eban-menge,
            meins type eban-meins,
            end of ty_eban.
    types : begin of ty_ekbe,
             ebeln type ekbe-ebeln,
             ebelp type ekbe-ebelp,
             belnr type ekbe-belnr,
             bldat type ekbe-bldat,
             gjahr type ekbe-gjahr,
             buzei type ekbe-buzei,
             matnr type ekbe-matnr,
             DMBTR type ekbe-dmbtr,
             shkzg type ekbe-shkzg,
             end of ty_ekbe.
    types : begin of ty_mseg,
             mblnr type mseg-mblnr,
             mjahr type mseg-mjahr,
             zeile type mseg-zeile,
             menge type mseg-menge,
             meins type mseg-meins,
             ebeln type mseg-ebeln,
             ebelp type mseg-ebelp,
             matnr type mseg-matnr,
             werks type mseg-werks,
             charg type mseg-charg,
             end of ty_mseg.
    types : begin of ty_rbkp,
             belnr type rbkp-belnr,
             gjahr type rbkp-gjahr,
             bldat type rbkp-bldat,
             lifnr type rbkp-lifnr,
             ZUONR type rbkp-ZUONR,
             RMWWR type rbkp-RMWWR,
             WMWST1 type rbkp-WMWST1,
             end of ty_rbkp.
    types : begin of ty_bseg,
             bukrs type bseg-bukrs,
             belnr type bseg-belnr,
             gjahr type bseg-gjahr,
             buzei type bseg-buzei,
             valut type bseg-valut,
             wrbtr type bseg-wrbtr ,
             augbl type bseg-augbl,
             matnr type bseg-matnr,
             lifnr type bseg-lifnr,
             ebeln type bseg-ebeln,
             end of ty_bseg.
    types : begin of ty_rseg,
             belnr type rseg-belnr,
             gjahr type rseg-gjahr,
             ebeln type rseg-ebeln,
             ebelp type rseg-ebelp,
             matnr type rseg-matnr,
             bukrs type rseg-bukrs,
             end of ty_rseg.
    types : begin of ty_bsik,
             belnr type bsik-belnr,
              buzei type bsik-buzei,
             DMBTR type bsik-DMBTR,
             budat type bsik-budat,
             shkzg type bsik-shkzg,
             ebeln type bsik-ebeln,
             lifnr type bsik-lifnr,
             end of ty_bsik.
    types : begin of ty_bsak,
             belnr type bsak-belnr,
       lifnr type bsak-lifnr,
        ebeln type bsak-ebeln,
             DMBTR_C type bsak-DMBTR,
    ZUONR type bsak-ZUONR,
             end of ty_bsak.
    types: begin of ty_bkpf,
             BELNR type bkpf-belnr,
             xblnr type bkpf-xblnr,
             awkey  type bkpf-awkey,
           end of ty_bkpf.
    data: it_po type standard table of ty_po,
           it_ekko type standard table of ty_ekko,
           it_ekpo type standard table of ty_ekpo,
           it_eban type standard table of ty_eban,
           it_ekbe type standard table of ty_ekbe,
           it_mseg type standard table of ty_mseg,
           it_rbkp type standard table of ty_rbkp,
           it_rseg type standard table of ty_rseg,
           it_bseg type standard table of ty_bseg,
           it_bsik type STANDARD TABLE OF ty_bsik with header line,
           it_bsak type STANDARD TABLE OF ty_bsak,
           it_bkpf type standard table of ty_bkpf,
           wa_po type ty_po,
           wa_ekko type ty_ekko,
           wa_ekpo type ty_ekpo,
           wa_eban type ty_eban,
           wa_mseg type ty_mseg,
           wa_rbkp type ty_rbkp,
           wa_rseg type ty_rseg,
           wa_bseg type ty_bseg,
           wa_ekbe type ty_ekbe,
           wa_bsik type ty_bsik,
           wa_bsak type ty_bsak,
           wa_bkpf type ty_bkpf.
    data: it_fcat type slis_t_fieldcat_alv,
           it_lshead type slis_t_listheader,
           it_sort type slis_t_sortinfo_alv,
           wa_fcat type slis_fieldcat_alv,
           wa_lshead type slis_listheader,
           wa_layout type slis_layout_alv,
           wa_sort type slis_sortinfo_alv.
    data :it_cl_data like table of clobjdat,
           wa_cl_data like clobjdat.
    data: values(10) type n.
    data: value1(4) type N.
    data: c_matkl type ekpo-matkl,
           c_matnr type ekpo-matnr,
           c_ekgrp type eban-ekgrp,
           c_badat type eban-badat,
           c_index type sy-tabix,
           c_grmenge type mseg-erfmg,
           c_low(10) type c,
           c_high(10) type c,
           c_date type string,
           c_bukrs type ekko-bukrs,
           c_WERKS type eban-WERKS.
    data: gd_date(10).
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
           WA_EVENT TYPE SLIS_ALV_EVENT.
    *********Selection screen variables*********
    selection-screen:begin of block b1 with frame title text-001.
    select-options: s_bukrs for c_bukrs DEFAULT  'bmp1',
                     s_WERKS for c_WERKS,
                     s_matnr for c_matnr DEFAULT 'rm-01',
                     s_matkl for c_matkl ,
                     s_badat for c_badat ,"obligatory,
                     s_ekgrp for c_ekgrp.
    parameters: ch_bal as checkbox.
    selection-screen:end of block b1.
    *initialization.
    * PERFORM EVENT_CALL.
    *  PERFORM POPULATE_EVENT.
    start-of-selection.
         PERFORM EVENT_CALL.
       PERFORM POPULATE_EVENT.
       perform getdata.
       perform setdata.
       perform fieldcat.
       perform display.
    *&      Form  GETDATA
    form getdata .
       select a~BANFN
              a~bnfpo
              a~ekgrp
              a~badat
              a~KNTTP
              a~PSTYP
              b~ebeln
              b~ebelp
              b~matkl
              b~matnr
              b~bukrs
              into corresponding fields of table it_po
              from eban as a inner join ekpo as b
              on a~banfn = b~banfn and
                 a~bnfpo = b~bnfpo AND
                 A~KNTTP = B~KNTTP and
                 a~PSTYP = b~PSTYP
              where  a~badat in s_badat and
                     a~ekgrp in s_ekgrp and
                     a~WERKS in s_WERKS and
                     b~matnr in s_matnr and
                     b~matkl in s_matkl and
                     b~bukrs in s_bukrs and
                     b~loekz <> 'L' and
                     a~loekz <> 'X'.
       if it_po[] is not initial.
         select ebeln
                ebelp
                matnr
                txz01
                menge
                meins
                netpr
                peinh
                banfn
                bnfpo
                mtart
                from ekpo into table it_ekpo
                for all entries in it_po
                where ebeln = it_po-ebeln and
                      ebelp = it_po-ebelp and
                      loekz <> 'L'.
         select banfn
                bnfpo
                matnr
                menge
                meins
                from eban into table it_eban
                for all entries in it_po
                where banfn = it_po-banfn and
                      bnfpo = it_po-bnfpo and
                      loekz <> 'X'.
         if it_ekpo[] is not initial.
           select ebeln
                  lifnr
                  bedat
                  from ekko into table it_ekko
                  for all entries in it_ekpo
                  where ebeln = it_ekpo-ebeln.
           select ebeln
                  ebelp
                  belnr
                  bldat
                  gjahr
                  buzei
                  matnr
                  DMBTR
                  shkzg
                  from ekbe into table it_ekbe
                  for all entries in it_ekpo
                  where ebeln = it_ekpo-ebeln and
                        ebelp = it_ekpo-ebelp .
    *if it_ekbe-shkzg = 'H'.
    **ekbe-dmbtr = ekbe-dmbtr * -1.
    **ekbe-menge = ekbe-menge * -1.
    *endif.
    * select belnr
    *             gjahr
    *             ebeln
    *             ebelp
    *     from bseg into table it_bseg
    *             for all entries in it_ekpo
    *             where ebeln = it_ekpo-ebeln and
    *                   ebelp = it_ekpo-ebelp.
           select belnr
                  gjahr
                  ebeln
                  ebelp
                  matnr
                  bukrs
                  from rseg into table it_rseg
                  for all entries in it_ekpo
                  where ebeln = it_ekpo-ebeln and
                        ebelp = it_ekpo-ebelp.
         endif.
         if it_ekbe[] is not initial.
           select mblnr
                  mjahr
                  zeile
                  menge
                  meins
                  ebeln
                  ebelp
                  matnr
                  werks
                  charg
                  from mseg into table it_mseg
                  for all entries in it_ekbe
                  where mblnr = it_ekbe-belnr and
                        mjahr = it_ekbe-gjahr and
                        zeile = it_ekbe-buzei and
                        bwart = '101'.
         endif.
         if it_rseg[] is not initial.
           select belnr
                  gjahr
                  bldat
                  lifnr
                  ZUONR
                  RMWWR
                  WMWST1
                  from rbkp into table it_rbkp
                  for all entries in it_rseg
                  where belnr = it_rseg-belnr.
         endif.
    *if it_rseg[] is not initial.
    *      SELECT bukrs
    *              belnr
    *              gjahr
    *              buzei
    *              valut
    *              wrbtr
    *              augbl
    *              matnr
    *              lifnr
    *              ebeln
    *        INTO TABLE it_bseg
    *          FROM bseg
    *          FOR ALL ENTRIES IN it_rseg
    *          WHERE bukrs = it_rseg-bukrs and ebeln = it_rseg-ebeln and mwskz = ''.
    *endif.
    *loop at it_BKPF into wa_BKPF.
    *  values = wa_rbkp-belnr.
    *  value1 = wa_rbkp-gjahr.
       data: aekey_1 type string .
    *CONCATENATE values value1 into aekey_1.
    *  if it_BSEG[] is not initial.
    *MESSAGE aekey_1 type 'I'.
           SELECT single belnr xblnr awkey into wa_bkpf
             from bkpf
             where awkey = aekey_1.
    SELECT SINGLe belnr
    buzei
    dmbtr
    budat
       shkzg
       ebeln
       lifnr
       FROM bsik
    INTO CORRESPONDING FIELDS OF  wa_bsik
    *FOR ALL ENTRIES IN it_bseg
    WHERE
        bukrs in s_bukrs and
        lifnr = wa_rbkp-lifnr
    and
    *AND gjahr = it_bseg-gjahr
    * AND
        belnr = wa_bkpf-belnr.
    insert wa_bsik into table it_bsik.
    CLEAR wa_bsik.
    CLEAR it_bsik.
    *endloop.
    * and ebeln = it_bseg-ebeln .
    *    select BELNR
    **           SHKZG
    **           DMBTR
    *           from bkpf into table it_bkpf
    *            for ALL ENTRIES IN it_rbkp
    *            where belnr = it_rbkp-belnr.
    *        ENDif.
    IF IT_bseg[] IS NOT INITIAL.
           select belnr
             LIFNR
             ebeln
                  DMBTR
              ZUONR
                  from bsik into table it_bsik
                  for all entries in it_bseg
                  where belnr = it_bseg-belnr.
           select belnr
             LIFNR
             ebeln
                  DMBTR
              ZUONR
                  from bsak into table it_bsak
                  for all entries in it_bseg
                  where belnr = it_bseg-belnr.
    ENDIF.
       else.
         message s002.
         leave list-processing.
       endif.
    endform.                    " GETDATA
    *&      Form  SETDATA
    form setdata .
       clear wa_po.
       loop at it_po into wa_po.
         c_index = sy-tabix.
    ********Calculate PR Quantity**********
         clear wa_eban.
         read table it_eban into wa_eban
                    with key banfn = wa_po-banfn
                             bnfpo = wa_po-bnfpo.
         if sy-subrc eq 0.
           move:wa_eban-menge to wa_po-menge,
                wa_eban-meins to wa_po-meins.
         endif.
    ********Calculate PO Quantity**********
         clear wa_ekpo.
         read table it_ekpo into wa_ekpo
                    with key banfn = wa_po-banfn
                             bnfpo = wa_po-bnfpo .
         if sy-subrc eq 0.
           move:wa_ekpo-txz01 to wa_po-txz01,
                wa_ekpo-netpr to wa_po-netpr,
                wa_ekpo-peinh to wa_po-peinh,
                wa_ekpo-mtart to wa_po-mtart,
                wa_ekpo-menge to wa_po-menge1,
                wa_ekpo-meins to wa_po-meins1.
         endif.
    ********Calculate Balance Quantity******
         clear wa_mseg.
         loop at it_mseg into wa_mseg
                where ebeln = wa_po-ebeln and
                      ebelp = wa_po-ebelp.
           c_grmenge = c_grmenge + wa_mseg-menge.
         endloop.
         move:wa_mseg-mblnr to wa_po-mblnr,
              c_grmenge to wa_po-menge2,
              wa_mseg-meins to wa_po-meins2,
              wa_mseg-werks to wa_po-werks,
              wa_mseg-charg to wa_po-charg.
         wa_po-balqty = wa_eban-menge - c_grmenge.
         clear : wa_rseg,wa_rbkp.
         read table it_rseg into wa_rseg with key
                        ebeln = wa_mseg-ebeln
                        ebelp = wa_mseg-ebelp.
         read table it_rbkp into wa_rbkp
                    with key belnr = wa_rseg-belnr
                             gjahr = wa_rseg-gjahr.
         if sy-subrc eq 0.
           move : wa_rbkp-belnr to wa_po-belnr,
                  wa_rbkp-bldat to wa_po-bldat,
                  wa_rbkp-RMWWR to wa_po-RMWWR,
                  WA_RBKP-WMWST1 TO WA_PO-WMWST1.
         endif.
           read table it_bseg into wa_bseg with key
                         ebeln = wa_rseg-ebeln
                         bukrs = wa_rseg-bukrs.
           if sy-subrc eq 0.
             move wa_bseg-belnr to wa_po-belnr_d.
           endif.
    *    read table it_bkpf into wa_bkpf
    *    with key belnr = wa_ekbe-belnr.
    *    read table it_bseg into wa_bseg
    *    with key belnr = wa_bkpf-belnr.
    CLEAR wa_bsik.
    clear it_bsik.
         read table it_bsik into wa_bsik
         with key belnr = wa_bkpf-belnr.
    *    if wa_bsik-shkzg = 'H'.
    *     wa_bsik-DMBTR = wa_bsik-DMBTR * 1.
    *     endif.
           if sy-subrc eq 0.
             move : wa_bsik-belnr to wa_po-belnr,
                     wa_bsik-DMBTR to wa_po-DMBTR.
            endif.
    *    clear wa_bsik.
    *    read table it_bsik into wa_bsik
    *               with key  belnr = wa_bseg-belnr.
    *    if sy-subrc eq 0.
    *        move : wa_bsik-DMBTR to wa_po-DMBTR.
    *    endif.
    *clear wa_bsak.
    *    read table it_bsak into wa_bsak
    *               with key  belnr = wa_bseg-belnr.
    *    if sy-subrc eq 0.
    *        move : wa_bsak-DMBTR_C to wa_po-DMBTR_C.
    *    endif.
    *clear : wa_rbkp.
    *loop at it_bsik into wa_bsik.
    *read table it_bsik into wa_bsik with key belnr = wa_rbkp-belnr.
    *if sy-subrc eq 0.
    *  move : wa_bsik-DMBTR to wa_po-DMBTR.
    *    endif.
    *endloop.
    *********Assign Vendor,PO Date*********
         clear wa_ekko.
         read table it_ekko into wa_ekko
                    with key ebeln = wa_po-ebeln.
         if sy-subrc eq 0.
           move:wa_ekko-lifnr to wa_po-lifnr,
                wa_ekko-bedat to wa_po-bedat.
         endif.
    *clear wa_ekko.
    *read table it_ekko into wa_ekko
    *with key lifnr = wa_po-lifnr.
    *if sy-subrc eq 0.
    *  move: wa_bsik-DMBTR to wa_po-DMBTR.
    *  endif.
    *    call function 'ZSD_BATCH_CLASSIFICATION_DATA'
    *      exporting
    **        ch_charg                   = wa_po-charg
    *        ch_matnr                   = wa_po-matnr
    *        ch_werks                   = wa_po-werks
    *      tables
    *        cl_data                    = it_cl_data
    **       I_SEL_CHARACTERISTIC       =
         loop at it_cl_data into wa_cl_data.
           if wa_cl_data-ausp1 ne '?'.
             if wa_cl_data-atnam eq 'THICKNESS'.
               move wa_cl_data-ausp1 to wa_po-thick.
             elseif wa_cl_data-atnam eq 'LENGTH'.
               move wa_cl_data-ausp1 to wa_po-length.
             elseif wa_cl_data-atnam eq 'WIDTH'.
               move wa_cl_data-ausp1 to wa_po-width.
             elseif wa_cl_data-atnam eq 'GRADE'.
               move wa_cl_data-ausp1 to wa_po-grade.
             endif.
           endif.
         endloop.
         modify it_po from wa_po index c_index.
         clear :c_grmenge,wa_po,wa_ekpo,wa_mseg,c_index.
       endloop.
    endform.                    " SETDATA
    *&      Form  FIELDCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form fieldcat .
       perform buildfields using '1' 'BANFN'  'IT_PO' 'PR Number' '' ''.
    *  perform buildfields using '2' 'BNFPO'  'IT_PO' 'PR Item Number' '' ''.
       perform  buildfields using '2' 'KNTTP' 'IT_PO' 'A/c Assignment Cat' '' ''.
       perform  buildfields using '2' 'PSTYP' 'IT_PO' 'Item Cat' '' ''.
       perform buildfields using '3' 'EKGRP'  'IT_PO' 'Purchase Group' '' ''.
       perform buildfields using '4' 'BADAT'  'IT_PO' 'Request Date' '' ''.
       perform buildfields using '5' 'MENGE'  'IT_PO' 'PR Quantity'  'X' ''.
       perform buildfields using '6' 'MEINS'  'IT_PO' 'PR Unit' '' ''.
       perform buildfields using '7' 'LIFNR'  'IT_PO' 'Vendor Number' '' ''.
       perform buildfields using '8' 'EBELN'  'IT_PO' 'Purchasing Doc No' '' ''  .
       perform buildfields using '9' 'BEDAT'  'IT_PO' 'PO Date' '' ''.
       perform buildfields using '10' 'MTART' 'IT_PO' 'Material Type' '' ''.
       perform buildfields using '11' 'MATKL' 'IT_PO' 'Material Group' '' ''.
       perform buildfields using '12' 'MATNR' 'IT_PO' 'Material Number' '' ''.
       perform buildfields using '13' 'TXZ01' 'IT_PO' 'Material Desc' '' ''.
       perform buildfields using '18' 'MENGE1' 'IT_PO' 'PO Quantity' 'X' ''.
       perform buildfields using '19' 'MEINS' 'IT_PO' 'PO Unit' '' ''.
       perform buildfields using '20' 'NETPR' 'IT_PO' 'Net Price' '' ''.
       perform buildfields using '21' 'PEINH' 'IT_PO' 'Price Unit' '' ''.
       perform buildfields using '22' 'MBLNR' 'IT_PO' 'GR Number' '' ''.
       perform buildfields using '23' 'MENGE2' 'IT_PO' 'GR Quantity' 'X' ''.
       perform buildfields using '24' 'MEINS2' 'IT_PO' 'GR Unit' '' ''.
       perform buildfields using '25' 'BELNR' 'IT_PO' 'Invoice doc. number' '' ''.
       perform buildfields using '26' 'BLDAT' 'IT_PO' 'Invoice Date' '' ''.
    *  perform buildfields using '26' 'BELNR_D' 'IT_POP' 'A/C Doc. No.' '' ''.
    *  perform buildfields using '26' 'AUGBL' 'IT_PO' 'Clearing Doc No.' '' ''.
       perform buildfields using '26' 'DMBTR' 'IT_PO' 'OPEN AMOUNT' '' ''.
      perform buildfields using '26' 'DMBTR' 'IT_PO' 'clear AMOUNT' '' ''.
    *  perform buildfields using '26' 'DMBTR_C' 'IT_PO' 'Clear balance' '' ''.
       if ch_bal = 'X'.
         perform buildfields using '27' 'BALQTY' 'IT_PO' 'Balance Quantity'
         'X' ''.
       endif.
       perform buildfields using '26' 'WMWST1' 'IT_PO' 'TOTAL TAX ADDED' 'X' ''.
       perform buildfields using '26' 'RMWWR' 'IT_PO' 'TOTAL AMOUNT IN INVOICE' 'X' ''.
    endform.                    " FIELDCAT
    *&      Form  BUILDFIELDS
    *       text
    *      -->P_0449   text
    *      -->P_0450   text
    *      -->P_0451   text
    *      -->P_0452   text
    form buildfields  using    value(p_col_pos) like sy-cucol
                                value(p_fldname) type slis_fieldname
                                value(p_tabname) type slis_tabname
                                value(p_reptext) like dd03p-reptext
                                value(p_do_sum) type char1
                                value(hotspot) type char1.
       wa_fcat-col_pos = p_col_pos.
       wa_fcat-fieldname = p_fldname.
       wa_fcat-tabname = p_tabname.
       wa_fcat-reptext_ddic = p_reptext.
       wa_fcat-do_sum = p_do_sum.
       wa_fcat-hotspot = hotspot.
       append wa_fcat to it_fcat.
       clear wa_fcat.
    endform.                    " BUILDFIELDS
    *&      Form  DISPLAY
    form display .
       clear wa_layout.
       wa_layout-zebra = 'X'.
       wa_layout-colwidth_optimize = 'X'.
    * wa_layout-box_fieldname     = 'SEL'.
    * wa_layout-edit = 'X'.
       perform build_sort using 'BANFN' '1' 'X'.
       call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          i_callback_program               = sy-cprog
    *   I_CALLBACK_PF_STATUS_SET          = ' '
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND '
          i_callback_top_of_page           = 'TOP_OF_PAGE'
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
    *   I_STRUCTURE_NAME                  =
        i_background_id                   = 'ALV_BACKGROUND'
    *   I_GRID_TITLE                      =
    *   I_GRID_SETTINGS                   =
          is_layout                        = wa_layout
          it_fieldcat                      = it_fcat
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
         it_sort                           = it_sort
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
        I_SAVE                            = 'A'
    *   IS_VARIANT                        =
    *   IT_EVENTS                         =
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   I_HTML_HEIGHT_TOP                 = 0
    *   I_HTML_HEIGHT_END                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   IR_SALV_FULLSCREEN_ADAPTER        =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
         tables
           t_outtab                          = it_po[]
      exceptions
        program_error                     = 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.
    endform.                    " DISPLAY
    *&      Form  top_of_page
    *       text
    form top_of_page.                                           "#EC *
    **********Create report header*********
       refresh it_lshead.
       clear wa_lshead.
    **********To display date in header*********
    *  write: s_badat-low to c_low dd/mm/yyyy,s_badat-high to c_high
    *  dd/mm/yyyy.
    *  if s_badat-high is initial.
    *    concatenate 'Dated on' c_low into c_date separated by space.
    *  else.
    *    concatenate 'Dated between' c_low 'and' c_high into c_date separated
    *    by space.
    *  endif.
       wa_lshead-typ = 'H'.
       wa_lshead-info = 'PR To Payment History'.
    *  'Pending Indents History -

    We had a requirement to retrieve "aging of receiveables" by customer. Basically, it goes thru each record and depending on the due date places the amounts in the following buckets (example). 0-30 day Overdue, 31-60 days Overdue, 61-90 days overdue, 30+ days overdue, 60+ days overdue) etc all the way to 6+ years overdue.
    There are also cooresponding buckets for coming due analysis. For example, what is: 0-30 days coming due, 31-60 days coming due, 30+ days coming due, etc...
    To do this, first I needed to be able be able to produce an open items statement at any given time in the past. Now, this seems impossible because of how the items go from open to cleared all the time. And an item that was open one month ago, may not be open anymore.
    What I did was first remove any selections on item status. Then compare the posting date with teh key date in the past, if the posting date is less than or equal to the key date, keep the record.
    Then compare the clearing date with the key date. First, keep all that are #. (This keeps all records still open from that posting date/key date)
    Then, add another check for all items that were cleared after the key date (GT Key Date). This gives you the open items on that date.
    Hope that makes sense. Let me know if you want clarification.
    /smw

  • From which table I'll get vendor based on material

    Hi Experts,
    I have to develop a Report for the procurement extraction should consist of following data fields:
    Material (MARA)
    Material Description (MAKT)
    Vendor
    Vendor Name
    Product Hierarchy
    Qty
    Date Product received at warehouse
    What are tables required for this?

    Hi
    Please use the table EKBE,EKKO,LFA1 and MARA
    You can take fields
    Material - EKBE - MATNR
    Material Description (MAKT)
    Vendor- EKKO -LIFNR
    Vendor Name-LFA1-NAME1
    Product Hierarchy-MARA-PRDHA
    Qty-EKBE- MENGE
    Date Product received at warehouse -EKBE-BUDAT
    Hope this suits you
    Regards,
    Sasi

  • Z report for materials that are lying as rejected material - sent to vendor

    Dear All,
    i have to create a report where my client is suppose to generate a report of :
    scenario:  all materials that are rejected in quality inspection is to be sent back  to vendor. now what happens is sometimes 50 materials are rejected in one month and 100 in second month. so total 150 materials should be sent but due to human error 75 materials are not sent. So a complete report of the same of which material were sent and which not .
    pl discuss....

    Dear Ritesh,
    lets simplify,  just my client want to see a report of list of materioals that have been rejected and not sent to vendor. I real time scenarios materials get rejected in Q- inspection. Now the rejected materials are sent back to the vendor. What happens is due to human error they kept lying in the plant premises for quite a long time that were supposed to be sent back. So ex:  x kg of materials were rejected in the month of june.That means X kg has to ben sent back to the vendor to be rectified. Now if y kg was sent where x>y , that means x-y should be lying in the plant that is not sent . A report for the same.
    pl discuss

Maybe you are looking for

  • Create new logical component

    Hello, I am facing an issue when creating a new logical component, which I have to do, to be able to get maintenance optimizer to give me an option to download enhancement packages. In order to do so I follow SAP Note 1022072. When I come to step 12

  • My Thinkpad L540 restarts immediatly after shutting down!

    My new Thinkpad L540 is working correctly, except that the only way to shut it down seems to be holding the power button for four seconds. In particular, If I turn the laptop off normally from my OS (by pressing the power button or entering some comm

  • When I try to install CS3 Design Standard from disc I get these errors:

    Main_File_Version Product_Registry_Parent Product_Registry_Key Can anyone help me? I just bought this two days ago! And I desperately need it working! Thanks, Lea

  • I can not start up my I mac

    I can start iMac

  • Delta Extraction for Custom Table

    Hi All, I have a Custom Table in R/3 with several fields and only one date field ( Creation Date ). I need to Create a data source(Function Module extractor) and delta enable it. Since i have no field *change date* on this table, is there a procedure