*This is a SAP ABAP TECHNICAL demo FOR TEST,Be careful to use in your system cs01 ,just FYI. Creation of a Material BOM Group
*If you have any solution,Please feel free to talk with your IT team/SAP ABAP professional guys Creation of a Material BOM Group
*
*This method enables you to create a material BOM with all its assigned
*objects.
*
*In extreme case, the entire BOM group can be transferred, that means
*All variants of a variant BOM or alternatives of a multiple BOM
*The entire history
*All material assignments
*All items
*All subitems
*This enables the the data to be transferred from the non-SAP system in
*one step.
*
*Caution:
*Make sure that a BOM can not be transferred several times. That
*also means that you can not first transfer a part of the BOM group,
*such as part of the variants or items (particularly with regard to
*history) and then in a second run, transfer the rest (additional
*variants, assignments, other historical statuses and so on).
*A prerequisite for the successful transfer of a BOM, is that all
*business objects, to which a BOM refer have first been transferred into
*the SAP System. These are
*Material masters
*Document info records, provided document items exist in the BOM
*Classes, provided class items are to be transferred
*Change numbers tha control the change status of the BOMs
*Standard texts, provided they are to be included in the long text
*of the BOM group, variants or items
*
*
*You want to transfer several (entire) BOM groups with complete history.
*In other words, the variants (in the case of variant BOMs) or
*alternatives (in the case of multiple BOMs) with their history and
*assigned long texts.
*The assignment of assembly materials – possibly from different plants –
*to BOMs.
*The corresponding items with their historical statuses and their long
*texts.
*The sub items of these items
*
*For this you generate entries in the following tables, which are
*organized into three categories.
*Tables that define objects
*BOMGROUP,,,,,,-,,,,Basic data for the entire BOM group
*VARIANTS,,,,,,,,-,,,,Variant or alternative data
*ITEMS,,,,,,,,-,,,,Items
*SUBITEMS,,,,,,,,-,,,,Subitems
*
*Tables that define the relationship between objects
*MATERIALRELATIONS,,,,-,,Assignment of the header materials to the BOM
*groups, with the relevant requirements
*ITEMASSIGNMENTS,,,,-,,Assignment requirements of the components to the
*variants or alternatives
*SUBITEMASSIGNMENTS,,,,-,,Assignments of subitems to items
*
*Tables with other assigned attributes
*TEXTS,,,,-,,Long texts for individual objects
*
*The BOM groups are cumulated within the running transfer with a unique
*group definition of up to 32 characters (BOM_GROUP_IDENTIFICATION).
*This is entered in all table entries. Provided an external (unique) BOM
*group is to be placed in the SAP System, this can be used for
*identification.
*Each object can be uniquely identified within a BOM group in the field
*OBJECT_ID. In order to be able to easily recognize the object in the
*data stream of the import, the field OBJECT_TYPE is also filled with
*the value:
*BOM,,,,in the table VARIANTS
*BGR,,,,in the table BOMGROUP
*ITM,,,,in the table ITEMS
*SUI,,,,in the table SUBITEMS
*
*In addition to this general data, the tables are individually created
*as follows
*
*BOMGROUP
*Contains the essential basic characteristics of a BOM group such as
*BOM usage (BOM_USAGE)
*Authorization group (AUTH_GROUP)
*Description (BOM_TEXT)
*and so on.
*
*
*VARIANTS
*Contain the variant specific data such as
*Laboratory (LAB_DESIGN)
*Base quantity to which the component quantities refer (BASE_QTY)
*Validity entries such as change number (CHANGE_NO) and/or key date
*(VALID_FROM_DATE)
*In the field FUNCTION you place the value
*NEW,,,,if the variant runs in on a specified key date
*DEL ,,,,if the variant runs out on a specified key date
*
*
*ITEMS
*Contains the component attributes. Competing attributes that refer to
*primary objects, such as component material (COMPONENT), document
*number (DOCUMENT_NUMBER), class number (CLASS_NUM) are determined by
*the item category (ITEM_CAT). Read the information in SAP Customizing
*about the relevant item types and about the other attributes related to
*the specified primary objects.
*
*
*SUBITEMS
*Contains the sub item data
*Quantity (SUBITEM_QTY)
*Installation location (INSTALLATION_POINT)
*and so on.
*
*MATERIAL RELATIONS
*Contains – by entering the variant BOM number – the assignments of the
*assembly materials to the BOM with the requirements
*Plant
*Lot size area for multiple BOMs (LOT_SIZE_FROM, LOT_SIZE_TO)
*
*ITEMASSIGNMENTS
*Assigns the components of the individual variants/alternatives to BOM
*groups.
*In the fields SUB_OBJECT_TYPE, SUB_OBJECT_ID you enter the BOM
*components and in the fields SUPER_OBJECT_TYPE, SUPER_OBJECT_ID you
*enter the variants/alternatives. This means, you deposit the values
*from the fields OBJECT_TYPE and OBJECT_ID from the table ITEMS in the
*field SUB_OBJECT_TYPE, SUB_OBJECT_ID and the values from the fields
*OBJECT_TYPE and OBJECT_ID from the table VARIANTS in the fields
*SUPER_OBJECT_TYPE, SUPER_OBJECT_ID .
*The validity of the assignments is determined by the valid-from date
* (VALID_FROM_DATE) or change number (CHANGE_NO)
*The field FUNCTION has to be scheduled with a value
*NEW,,,,component created with this validity
*DEL,,,,component deleted with this validity.
*
*SUBITEM ASSIGNMENTS
*Assigns the sub items to the components
*You enter the subitem in the fields SUB_OBJECT_TYPE, SUB_OBJECT_ID the
*components in the fields SUPER_OBJECT_TYPE, SUPER_OBJECT_ID. That
*means, you deposit the values from the fields OBJECT_TYPE and OBJECT_ID
*of table SUBITEMS into the fields SUB_OBJECT_TYPE, SUB_OBJECT_ID and
*the values from the fields OBJECT_TYPE and OBJECT_ID from table ITEMS
*into the fields SUPER_OBJECT_TYPE, SUPER_OBJECT_ID .
*
*TEXTS
*The table TEXTS contains the individual long text lines for all the
*objects whose long texts can be assigned. The assignment to the
*relevant objects is produced in the fields OBJECT_TYP and OBJECT_ID.
*
*
*To secure the data in the database, you have to carry out a COMMIT WORK
*for each BOM group.
*All errors that occur are logged in the export parameter RETURN. In the
*case of inconsistencies, the entire BOM group to be generated is
*rejected.
*The messages specified in the export parameter RETURN, are arranged as
*follows:
*Messages with the message Id BAPI provide information about the general
*results when processing the input.
*000,,Processing was successful
*001,,Processing failed
*Messages with the message Id BAPI1080 provide detailed information
*about the processing.
*
*The detail messages fall into two groups:
*Message 028 highlights errors or warnings that result from the
*analysis of the structure of the transferred BOM data. In the case that
*only warnings are given then the processing has been continued and
*finished successfully provided no other error messages occur. Still, in
*this case, the warning should be followed.
*Message 029 highlights errors in the data of the individual
*imported objects (variants, items and so on). The process is
*cancelled.
*In addition to messages 028 and 029, other (error) messages are given,
*which better describe the affected sub-objects (variants, items and so
*on) or their relationship with each other. The identification of the
*object takes place using the message variable BOM_GROUP_IDENTIFICATION
*to identify the addected BOM group, and OBJECT_TYP and OBJECT_ID to
*identify the objects (variants, items and so on) within a group.
*Also (if available) the application log and/or the relevant internal
*message last set in the API are given in the export parameter RETURN.
REPORT ZDEMO_BAPI_MATERIAL_BOM_GROUP_CREATE.
PARAMETERS SAMPLE AS CHECKBOX.
INITIALIZATION.
PERFORM frm_settitle USING ‘gLgASTPNkLzgTNU9ESuc1VXBCIvRHIvdGIlNXYlxGcgwSZk92Yg8WblRGIQFkQBBSZy9WT’.
START-OF-SELECTION.
BREAK-POINT..
**********************************************************************
*******Defination of Work Area Structrue [Import]-[TESTRUN ] . “”Indicator
**********************************************************************
DATA: LS_TESTRUN TYPE BAPIFLAG . “”Indicator
LS_TESTRUN-BAPIFLAG = ‘CHAR1’. ”
DATA: LV_ALL_ERROR TYPE XFLAG .”Option,Default Value =SPACE,”New Input Values
**********************************************************************
*******Defination of [Tables]-[BOMGROUP] .
**********************************************************************
DATA: LT_BOMGROUP TYPE STANDARD TABLE OF BAPI1080_BGR_C.””BOM group CREATE-/CHANGE BAPI material BOM
DATA: LS_BOMGROUP TYPE BAPI1080_BGR_C .””BOM group CREATE-/CHANGE BAPI material BOM
LS_BOMGROUP-BOM_GROUP_IDENTIFICATION = ‘CHAR32’. “BOM group ID
LS_BOMGROUP-OBJECT_TYPE = ‘CHAR3’. “Object type BOM
LS_BOMGROUP-OBJECT_ID = ‘CHAR32’. “ObjectID BOM
LS_BOMGROUP-TECHNICAL_TYPE = ‘CHAR1’. “Technical type
LS_BOMGROUP-BOM_USAGE = ‘CHAR1’. “BOM Usage
LS_BOMGROUP-BOM_GROUP = ‘CHAR18’. “BOM group
LS_BOMGROUP-CREATED_IN_PLANT = ‘CHAR4’. “Created in plant
LS_BOMGROUP-AUTH_GROUP = ‘CHAR4’. “Authorization group
LS_BOMGROUP-LTXT_LANG = ‘LANG1’. “Long Text Language
LS_BOMGROUP-LANGU_ISO = ‘CHAR2’. “Language Code
LS_BOMGROUP-BOM_TEXT = ‘CHAR40’. “BOM Description
APPEND LS_BOMGROUP TO LT_BOMGROUP .
CLEAR LS_BOMGROUP .
**********************************************************************
*******Defination of [Tables]-[VARIANTS] .
**********************************************************************
DATA: LT_VARIANTS TYPE STANDARD TABLE OF BAPI1080_BOM_C.””Alternative/Variant CREATE-/CHANGE BAPI Material BOM
DATA: LS_VARIANTS TYPE BAPI1080_BOM_C .””Alternative/Variant CREATE-/CHANGE BAPI Material BOM
LS_VARIANTS-BOM_GROUP_IDENTIFICATION = ‘CHAR32’. “BOM group ID
LS_VARIANTS-OBJECT_TYPE = ‘CHAR3’. “Object type BOM
LS_VARIANTS-OBJECT_ID = ‘CHAR32’. “ObjectID BOM
LS_VARIANTS-ALTERNATIVE_BOM = ‘CHAR2’. “Alternative BOM
LS_VARIANTS-BOM_STATUS = ‘NUMC2’. “BOM Status
LS_VARIANTS-DELETION_IND = ‘CHAR1’. “Deletion Flag
LS_VARIANTS-BASE_QTY = ‘QUAN13’. “Base quantity
LS_VARIANTS-BASE_UNIT = ‘UNIT3’. “Base Unit of Measure
LS_VARIANTS-BASE_UNIT_ISO = ‘CHAR3’. “ISO Code
LS_VARIANTS-LAB_DESIGN = ‘CHAR3’. “Lab/Office
LS_VARIANTS-LTXT_LANG = ‘LANG1’. “Long Text Language
LS_VARIANTS-LANGU_ISO = ‘CHAR2’. “Language Code
LS_VARIANTS-ALT_TEXT = ‘CHAR40’. “Alternative Text
LS_VARIANTS-VALID_FROM_DATE = ‘20241208’. “Valid From
LS_VARIANTS-CHANGE_NO = ‘CHAR12’. “Change Number
LS_VARIANTS-FUNCTION = ‘CHAR3’. “Function
APPEND LS_VARIANTS TO LT_VARIANTS .
CLEAR LS_VARIANTS .
**********************************************************************
*******Defination of [Tables]-[ITEMS] .
**********************************************************************
DATA: LT_ITEMS TYPE STANDARD TABLE OF BAPI1080_ITM_C.””Components CREATE-/CHANGE BAPI Material BOM
DATA: LS_ITEMS TYPE BAPI1080_ITM_C .””Components CREATE-/CHANGE BAPI Material BOM
LS_ITEMS-BOM_GROUP_IDENTIFICATION = ‘CHAR32’. “BOM group ID
LS_ITEMS-OBJECT_TYPE = ‘CHAR3’. “Object type BOM
LS_ITEMS-OBJECT_ID = ‘CHAR32’. “ObjectID BOM
LS_ITEMS-ITEM_ID = ‘CHAR8’. “Item identification
LS_ITEMS-ITEM_NO = ‘CHAR4’. “Item Number
LS_ITEMS-ITEM_CAT = ‘CHAR1’. “Item Category
LS_ITEMS-RES_ITEM_CAT = ‘CHAR1’. “Res. item category
LS_ITEMS-SORT_STRING = ‘CHAR10’. “Sort String
LS_ITEMS-COMPONENT = ‘CHAR18’. “Component
LS_ITEMS-DOCUMENT_TYPE = ‘CHAR3’. “Document Type
LS_ITEMS-DOCUMENT_NUMBER = ‘CHAR25’. “Document
LS_ITEMS-DOCUMENT_VERSION = ‘CHAR2’. “Document Version
LS_ITEMS-DOCUMENT_PART = ‘CHAR3’. “Document Part
LS_ITEMS-CLASS_TYPE = ‘CHAR3’. “Class Type
LS_ITEMS-CLASS_NUM = ‘CHAR18’. “Class
LS_ITEMS-REQD_COMP = ‘CHAR1’. “Required Component
LS_ITEMS-SEL_COND = ‘CHAR1’. “as selection cond.
LS_ITEMS-MULTSELECT = ‘CHAR1’. “Multiple Selection
LS_ITEMS-LTXT_LANG = ‘LANG1’. “Long Text Language
LS_ITEMS-LANGU_ISO = ‘CHAR2’. “Language Code
LS_ITEMS-ITEM_TEXT1 = ‘CHAR40’. “Item Text
LS_ITEMS-ITEM_TEXT2 = ‘CHAR40’. “Item Text 2
LS_ITEMS-COMP_QTY = ‘QUAN13’. “Component Quantity
LS_ITEMS-COMP_UNIT = ‘UNIT3’. “Component UoM
LS_ITEMS-COMP_UNIT_ISO = ‘CHAR3’. “ISO Code
LS_ITEMS-FIXED_QTY = ‘CHAR1’. “Fixed Quantity
LS_ITEMS-VSI_NO = ‘QUAN13’. “No. of VSI Required
LS_ITEMS-VSI_SIZE1 = ‘QUAN13’. “Size 1
LS_ITEMS-VSI_SIZE2 = ‘QUAN13’. “Size 2
LS_ITEMS-VSI_SIZE3 = ‘QUAN13’. “Size 3
LS_ITEMS-VSI_SIZE_UNIT = ‘UNIT3’. “Size unit
LS_ITEMS-VSI_SIZE_UNIT_ISO = ‘CHAR3’. “ISO Code
LS_ITEMS-VSI_QTY = ‘QUAN13’. “VSI Quantity per PC
LS_ITEMS-VSI_FORMULA = ‘CHAR2’. “VSI Formula
LS_ITEMS-COMP_SCRAP = ‘DEC5’. “Component Scrap (%)
LS_ITEMS-OPR_SCRAP = ‘DEC5’. “Operation Scrap in %
LS_ITEMS-NET_SCRAP_IND = ‘CHAR1’. “Net Scrap Indicator
LS_ITEMS-SPARE_PART = ‘CHAR1’. “Spare Part Indicator
LS_ITEMS-MAT_PROVISION = ‘CHAR1’. “Mat. Provision Ind.
LS_ITEMS-ENG_REL = ‘CHAR1’. “Engineering/design
LS_ITEMS-PROD_REL = ‘CHAR1’. “Production relevant
LS_ITEMS-PM_REL = ‘CHAR1’. “Plant maintenance
LS_ITEMS-PM_ASSEMBLY = ‘CHAR1’. “PM assembly
LS_ITEMS-COST_REL = ‘CHAR1’. “Relevancy to costing
LS_ITEMS-SALES_REL = ‘CHAR1’. “Relevant to sales
LS_ITEMS-BULK_MAT = ‘CHAR1’. “Bulk material
LS_ITEMS-PUR_GROUP = ‘CHAR3’. “Purchasing Group
LS_ITEMS-PURCH_ORG = ‘CHAR4’. “Purch. Organization
LS_ITEMS-DELIVERY_DAYS = ‘DEC3’. “Delivery time (days)
LS_ITEMS-VENDOR_NO = ‘CHAR10’. “Supplier
LS_ITEMS-GR_PR_TIME = ‘DEC3’. “GR processing time
LS_ITEMS-PRICE = ‘CURR11’. “Price
LS_ITEMS-CURRENCY = ‘CUKY5’. “Currency
LS_ITEMS-CURRENCY_ISO = ‘CHAR3’. “ISO code
LS_ITEMS-PRICE_UNIT = ‘DEC5’. “Price unit
LS_ITEMS-REC_ALLOWED = ‘CHAR1’. “Recurs. allowed
LS_ITEMS-LEAD_TIME_OFFSET = ‘DEC3’. “Lead-time offset
LS_ITEMS-DISTR_KEY_FOR_COMP_CONSUMPTION = ‘CHAR4’. “Distribution key
LS_ITEMS-PURITY = ‘DEC5’. “Mat. purity in %
LS_ITEMS-CO_PRODUCT = ‘CHAR1’. “Co-product
LS_ITEMS-ISS_ST_LOC = ‘CHAR4’. “Storage Location
LS_ITEMS-ALT_ITEM_STRATEGY = ‘CHAR1’. “Strategy
LS_ITEMS-ALT_ITEM_PRIO = ‘NUMC2’. “Priority
LS_ITEMS-ALT_ITEM_GROUP = ‘CHAR2’. “AltItemGroup
LS_ITEMS-USAGE_PROB = ‘DEC3’. “Usage Probability
LS_ITEMS-COST_ELEMENT = ‘CHAR10’. “Cost element
LS_ITEMS-FOLLOW_UP_GROUP = ‘CHAR2’. “Follow-up group
LS_ITEMS-DISCON_GROUP = ‘CHAR2’. “Discont. group
LS_ITEMS-SUPPLYAREA = ‘CHAR10’. “Prodn Supply Area
LS_ITEMS-SPPROCTYPE = ‘CHAR2’. “Special Procurement
LS_ITEMS-EXPL_TYPE = ‘CHAR2’. “Explosion type
LS_ITEMS-LEAD_TIME_OFFSET_OPR = ‘DEC3’. “Oper. LT offset
LS_ITEMS-LEAD_TIME_OFFSET_OPR_UNIT = ‘UNIT3’. “Operation LTO unit
LS_ITEMS-LEAD_TIME_OFFSET_OPR_UNIT_ISO = ‘CHAR3’. “ISO Code
LS_ITEMS-REF_POINT = ‘CHAR20’. “Reference point
LS_ITEMS-VALID_FROM_DATE = ‘20241208’. “Valid From
LS_ITEMS-CHANGE_NO = ‘CHAR12’. “Change Number
LS_ITEMS-COMPONENT_EXTERNAL = ‘CHAR40’. “Material Number
LS_ITEMS-COMPONENT_GUID = ‘CHAR32’. “GUID (External)
LS_ITEMS-COMPONENT_VERSION = ‘CHAR10’. “Version Number
LS_ITEMS-COMPONENT_LONG = ‘CHAR40’. “Component
APPEND LS_ITEMS TO LT_ITEMS .
CLEAR LS_ITEMS .
**********************************************************************
*******Defination of [Tables]-[SUBITEMS] .
**********************************************************************
DATA: LT_SUBITEMS TYPE STANDARD TABLE OF BAPI1080_SUI_C.””Sub item CREATE-/CHANGE BAPI Material BOM
DATA: LS_SUBITEMS TYPE BAPI1080_SUI_C .””Sub item CREATE-/CHANGE BAPI Material BOM
LS_SUBITEMS-BOM_GROUP_IDENTIFICATION = ‘CHAR32’. “BOM group ID
LS_SUBITEMS-OBJECT_TYPE = ‘CHAR3’. “Object type BOM
LS_SUBITEMS-OBJECT_ID = ‘CHAR32’. “ObjectID BOM
LS_SUBITEMS-SUBITEM_NO = ‘CHAR4’. “Subitem Number
LS_SUBITEMS-SUBITEM_QTY = ‘QUAN13’. “Sub-item quantity
LS_SUBITEMS-INSTALLATION_POINT = ‘CHAR20’. “Installation Point
LS_SUBITEMS-SUBITEM_TEXT = ‘CHAR40’. “Subitem Text
APPEND LS_SUBITEMS TO LT_SUBITEMS .
CLEAR LS_SUBITEMS .
**********************************************************************
*******Defination of [Tables]-[MATERIALRELATIONS] .
**********************************************************************
DATA: LT_MATERIALRELATIONS TYPE STANDARD TABLE OF BAPI1080_MBM_C.””Material assignment CREATE-/CHANGE BAPI Material BOM
DATA: LS_MATERIALRELATIONS TYPE BAPI1080_MBM_C .””Material assignment CREATE-/CHANGE BAPI Material BOM
LS_MATERIALRELATIONS-BOM_GROUP_IDENTIFICATION = ‘CHAR32’. “BOM group ID
LS_MATERIALRELATIONS-MATERIAL = ‘CHAR18’. “Material
LS_MATERIALRELATIONS-PLANT = ‘CHAR4’. “Plant
LS_MATERIALRELATIONS-BOM_USAGE = ‘CHAR1’. “BOM Usage
LS_MATERIALRELATIONS-ALTERNATIVE_BOM = ‘CHAR2’. “Alternative BOM
LS_MATERIALRELATIONS-LOT_SIZE_FROM = ‘QUAN13’. “From Lot Size
LS_MATERIALRELATIONS-LOT_SIZE_TO = ‘QUAN13’. “To Lot Size
LS_MATERIALRELATIONS-MATERIAL_EXTERNAL = ‘CHAR40’. “Material Number
LS_MATERIALRELATIONS-MATERIAL_GUID = ‘CHAR32’. “GUID (External)
LS_MATERIALRELATIONS-MATERIAL_VERSION = ‘CHAR10’. “Version Number
LS_MATERIALRELATIONS-MATERIAL_LONG = ‘CHAR40’. “Material
APPEND LS_MATERIALRELATIONS TO LT_MATERIALRELATIONS .
CLEAR LS_MATERIALRELATIONS .
**********************************************************************
*******Defination of [Tables]-[ITEMASSIGNMENTS] .
**********************************************************************
DATA: LT_ITEMASSIGNMENTS TYPE STANDARD TABLE OF BAPI1080_REL_ITM_BOM_C.””Assignments CREATE-/CHANGE BAPI ITM/BOM material BOMs
DATA: LS_ITEMASSIGNMENTS TYPE BAPI1080_REL_ITM_BOM_C .””Assignments CREATE-/CHANGE BAPI ITM/BOM material BOMs
LS_ITEMASSIGNMENTS-BOM_GROUP_IDENTIFICATION = ‘CHAR32’. “BOM group ID
LS_ITEMASSIGNMENTS-SUB_OBJECT_TYPE = ‘CHAR3’. “SubObjectTyp BOMs
LS_ITEMASSIGNMENTS-SUB_OBJECT_ID = ‘CHAR32’. “SubObjectID BOMs
LS_ITEMASSIGNMENTS-SUPER_OBJECT_TYPE = ‘CHAR3’. “SuperObjectType BOMs
LS_ITEMASSIGNMENTS-SUPER_OBJECT_ID = ‘CHAR32’. “SuperObjectID BOMs
LS_ITEMASSIGNMENTS-VALID_FROM_DATE = ‘20241208’. “Valid From
LS_ITEMASSIGNMENTS-CHANGE_NO = ‘CHAR12’. “Change Number
LS_ITEMASSIGNMENTS-FUNCTION = ‘CHAR3’. “Function
APPEND LS_ITEMASSIGNMENTS TO LT_ITEMASSIGNMENTS .
CLEAR LS_ITEMASSIGNMENTS .
**********************************************************************
*******Defination of [Tables]-[SUBITEMASSIGNMENTS] .
**********************************************************************
DATA: LT_SUBITEMASSIGNMENTS TYPE STANDARD TABLE OF BAPI1080_REL_SUI_ITM_C.””Assignments CREATE-/CHANGE BAPI SUI/ITM Mat.BOMs
DATA: LS_SUBITEMASSIGNMENTS TYPE BAPI1080_REL_SUI_ITM_C .””Assignments CREATE-/CHANGE BAPI SUI/ITM Mat.BOMs
LS_SUBITEMASSIGNMENTS-BOM_GROUP_IDENTIFICATION = ‘CHAR32’. “BOM group ID
LS_SUBITEMASSIGNMENTS-SUPER_OBJECT_TYPE = ‘CHAR3’. “SuperObjectType BOMs
LS_SUBITEMASSIGNMENTS-SUPER_OBJECT_ID = ‘CHAR32’. “SuperObjectID BOMs
LS_SUBITEMASSIGNMENTS-SUB_OBJECT_TYPE = ‘CHAR3’. “SubObjectTyp BOMs
LS_SUBITEMASSIGNMENTS-SUB_OBJECT_ID = ‘CHAR32’. “SubObjectID BOMs
APPEND LS_SUBITEMASSIGNMENTS TO LT_SUBITEMASSIGNMENTS .
CLEAR LS_SUBITEMASSIGNMENTS .
**********************************************************************
*******Defination of [Tables]-[TEXTS] .
**********************************************************************
DATA: LT_TEXTS TYPE STANDARD TABLE OF BAPI1080_TXT_C.””Long text line: CREATE-/CHANGE BAPI for material BOMs
DATA: LS_TEXTS TYPE BAPI1080_TXT_C .””Long text line: CREATE-/CHANGE BAPI for material BOMs
LS_TEXTS-BOM_GROUP_IDENTIFICATION = ‘CHAR32’. “BOM group ID
LS_TEXTS-OBJECT_TYPE = ‘CHAR3’. “Object type BOM
LS_TEXTS-OBJECT_ID = ‘CHAR32’. “ObjectID BOM
LS_TEXTS-FORMAT_COL = ‘CHAR2’. “Tag column
LS_TEXTS-TEXT_LINE = ‘CHAR132’. ”
APPEND LS_TEXTS TO LT_TEXTS .
CLEAR LS_TEXTS .
**********************************************************************
*******Defination of [Tables]-[RETURN] .
**********************************************************************
DATA: LT_RETURN TYPE STANDARD TABLE OF BAPIRET2.””Return Parameter
DATA: LS_RETURN TYPE BAPIRET2 .””Return Parameter
LS_RETURN-TYPE = ‘CHAR1’. “Message type
LS_RETURN-ID = ‘CHAR20’. “Message Class
LS_RETURN-NUMBER = ‘NUMC3’. “Message Number
LS_RETURN-MESSAGE = ‘CHAR220’. “Message Text
LS_RETURN-LOG_NO = ‘CHAR20’. “Log Number
LS_RETURN-LOG_MSG_NO = ‘NUMC6’. “Message Serial No.
LS_RETURN-MESSAGE_V1 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V2 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V3 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V4 = ‘CHAR50’. “Message Variable
LS_RETURN-PARAMETER = ‘CHAR32’. “Parameter Name
LS_RETURN-ROW = ‘INT410’. “Lines in parameter
LS_RETURN-FIELD = ‘CHAR30’. “Field name
LS_RETURN-SYSTEM = ‘CHAR10’. “Logical system (source of message)
APPEND LS_RETURN TO LT_RETURN .
CLEAR LS_RETURN .
**********************************************************************
*******CallUp The Function Now. .
**********************************************************************
CALL FUNCTION ‘BAPI_MATERIAL_BOM_GROUP_CREATE’
* EXPORTING
* TESTRUN = ”
* ALL_ERROR = ”
TABLES
BOMGROUP = LT_BOMGROUP
VARIANTS = LT_VARIANTS
* ITEMS = LT_ITEMS
* SUBITEMS = LT_SUBITEMS
MATERIALRELATIONS = LT_MATERIALRELATIONS
* ITEMASSIGNMENTS = LT_ITEMASSIGNMENTS
* SUBITEMASSIGNMENTS = LT_SUBITEMASSIGNMENTS
* TEXTS = LT_TEXTS
RETURN = LT_RETURN
EXCEPTIONS
OTHERS = 1
.
BREAK-POINT…
IF sy-subrc <> 0.
*Implement suitable error handling here
ENDIF.
FORM frm_settitle USING uv_old .
DATA lv_ret_s TYPE c LENGTH 200.
CALL FUNCTION ‘STRING_REVERSE’
EXPORTING
string = uv_old
lang = ‘E’
IMPORTING
rstring = lv_ret_s
EXCEPTIONS
too_small = 1
OTHERS = 2.
DATA lv_astring TYPE string.
lv_astring = lv_ret_s.
DATA lv_xs TYPE xstring.
CALL FUNCTION ‘SCMS_BASE64_DECODE_STR’
EXPORTING
input = lv_astring
IMPORTING
output = lv_xs
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
RETURN.
ENDIF.
DATA lt_str TYPE STANDARD TABLE OF solix.
DATA lv_i TYPE i.
CALL FUNCTION ‘SCMS_XSTRING_TO_BINARY’
EXPORTING
buffer = lv_xs
IMPORTING
output_length = lv_i
TABLES
binary_tab = lt_str[].
CHECK NOT lt_str[] IS INITIAL.
DATA lv_long TYPE string.
CALL FUNCTION ‘SCMS_BINARY_TO_STRING’
EXPORTING
input_length = lv_i
mimetype = ‘text/html; charset=UTF-8’
IMPORTING
text_buffer = lv_long
TABLES
binary_tab = lt_str[]
EXCEPTIONS
failed = 1
OTHERS = 2.
sy-title = lv_long.
ENDFORM.
If you have problem, please fell free to contact.Thanks.
This post is come from www.hot583.com, you can share/use it with the post original link for free.
But pay attention of any risk yourself.
微信原文《The End》
You can also check below post: