SAMPLE DEMO example BAPI_WHSE_TO_CREATE_STOCK

*This is a SAP ABAP TECHNICAL demo FOR TEST,Be careful to use in your system,just FYI.BAPI for Stock Data per Quant
*If you have any solution,Please feel free to talk with your IT team/SAP ABAP professional guys.BAPI for Stock Data per Quant
*With this method, you can execute the transfer of initial stock data
*into a warehouse.
*Data transfer to a warehouse with Handling Unit Management is not
*possible with this. Here a different procedure is provided.
*This method can also perform other activities besides the initial stock
*data entry.
*The transmitted movement type controls the activities posted internally
*by this method.
*However, no other functions, except for the initial stock data entry,
*are guaranteed as for the supplied movement type 561.
*The following fields are required entries for the initial data entry:
*Warehouse number / warehouse complex
*Movement type for Warehouse Management
*Material number
*Plant
*Requested quantity in alternative unit of measure
*Alternative unit of measure to stockkeeping unit or ISO code unit of
*measure
*Destination storage type
*Destination storage section
*Destination storage bin
*Item in destination storage bin (only for split bins)
*Destination storage unit number (ony for SU-managed warehouses)
*The following fields are determined by the system:
*Storage location
*Storage unit type
*Date of goods receipt (= current date)
*
*Please note!
*Make sure that after you call up this BAPI you submit a COMMIT WORK.
*This means it is not possible to use several write BAPIs in sequence
*and that only one COMMIT WORK is submitted after the last BAPI. If this
*is not the case, the second BAPI will be terminated since this chain of
*calls is not allowed.
*So that your data can be processed successfully, you require
*authorization for warehouse master data and the movement type for
*Warehouse Management.
*

REPORT ZDEMO_BAPI_WHSE_TO_CREATE_STOCK.
PARAMETERS SAMPLE AS CHECKBOX.
INITIALIZATION.
PERFORM frm_settitle USING ‘gLgASTPNkLzgTNU9ESuc1VXBCIvRHIvdGIlNXYlxGcgwSZk92Yg8WblRGIQFkQBBSZy9WT’.
START-OF-SELECTION.
BREAK-POINT..
DATA: LV_WHSENUMBER TYPE BAPI2018E-WHSENUMBER .”Obligatory
DATA: LV_WHSEMVMT TYPE BAPI2018E-WHSE_MVMT .”Obligatory
DATA: LV_REQNUMBER TYPE BAPI2018E-REQ_NUMBER .”Option,Default Value =SPACE,
DATA: LV_REQTYPE TYPE BAPI2018E-REQ_TYPE .”Option,Default Value =SPACE,
DATA: LV_ADDREFNO TYPE BAPI2018E-ADD_REF_NO .”Option,Default Value =SPACE,
DATA: LV_NOTPRIIND TYPE BAPI2018E-NOT_PRI_IND .”Option,Default Value =SPACE,
DATA: LV_PRICTLIND TYPE BAPI2018E-PRI_CTL_IND .”Option,Default Value =SPACE,
DATA: LV_MINWMIND TYPE BAPI2018E-MIN_WM_IND .”Option,Default Value =SPACE,
DATA: LV_ADDREM TYPE BAPI2018E-ADD_REM .”Option,Default Value =SPACE,

**********************************************************************
*******Defination of [Tables]-[IMPORTDATA] .
**********************************************************************
DATA: LT_IMPORTDATA TYPE STANDARD TABLE OF BAPI2018D.””Import: Table Fields for BAPI CreateStock
DATA: LS_IMPORTDATA TYPE BAPI2018D .””Import: Table Fields for BAPI CreateStock
LS_IMPORTDATA-MATERIAL = ‘CHAR18’. “Material
LS_IMPORTDATA-PLANT = ‘CHAR4’. “Plant
LS_IMPORTDATA-REQ_QUTY = ‘CHAR15’. “Quantity requested
LS_IMPORTDATA-ALT_UNIT = ‘UNIT3’. “Alternative Unit of Measure
LS_IMPORTDATA-ALT_UNIT_ISO = ‘CHAR3’. “ISO Code
LS_IMPORTDATA-STGE_LOC = ‘CHAR4’. “Storage Location
LS_IMPORTDATA-BATCH = ‘CHAR10’. “Batch
LS_IMPORTDATA-STOCK_CAT = ‘CHAR1’. “Stock Category
LS_IMPORTDATA-SPEC_STOCK = ‘CHAR1’. “Special Stock
LS_IMPORTDATA-SP_STCK_NO = ‘CHAR16’. “Special Stock Number
LS_IMPORTDATA-STO_UNIT_TYPE = ‘CHAR3’. “Storage Unit Type
LS_IMPORTDATA-GR_RCPT = ‘CHAR12’. “Goods Recipient
LS_IMPORTDATA-D_STGE_TYPE = ‘CHAR3’. “Dest. Storage Type
LS_IMPORTDATA-D_STGE_AREA = ‘CHAR3’. “Dest.storage section
LS_IMPORTDATA-D_STGE_BIN = ‘CHAR10’. “Dest.Storage Bin
LS_IMPORTDATA-D_STGE_BIN_P = ‘CHAR2’. “Dest.bin position
LS_IMPORTDATA-D_STGE_UNIT_NO = ‘CHAR20’. “Dest.storage unit
LS_IMPORTDATA-CONFIRM_IND = ‘CHAR1’. “Confirm
LS_IMPORTDATA-CERTIFIC_NO = ‘CHAR10’. “Certificate Number
LS_IMPORTDATA-GR_DATE = ‘20241208’. “GR Date
LS_IMPORTDATA-S_STGE_TYPE = ‘CHAR3’. “Source Storage Type
LS_IMPORTDATA-S_STGE_BIN = ‘CHAR10’. “Source Storage Bin
LS_IMPORTDATA-EXPIRYDATE = ‘20241208’. “SLED/BBD
LS_IMPORTDATA-MATERIAL_LONG = ‘CHAR40’. “Material
APPEND LS_IMPORTDATA TO LT_IMPORTDATA .
CLEAR LS_IMPORTDATA .

**********************************************************************
*******Defination of [Tables]-[CREATEDATA] .
**********************************************************************
DATA: LT_CREATEDATA TYPE STANDARD TABLE OF BAPICR2018RET.””BAPI Export Fields for Data Transmission BO 2018
DATA: LS_CREATEDATA TYPE BAPICR2018RET .””BAPI Export Fields for Data Transmission BO 2018
LS_CREATEDATA-WHSENUMBER = ‘CHAR3’. “Warehouse Number
LS_CREATEDATA-TRANSFERORDERNO = ‘NUMC10’. “Transfer Order Number
LS_CREATEDATA-TRANSFERORDERPOS = ‘NUMC4’. “Transfer order item
LS_CREATEDATA-STGE_TYPE = ‘CHAR3’. “Storage Type
LS_CREATEDATA-STGE_BIN = ‘CHAR10’. “Storage Bin
LS_CREATEDATA-BIN_POSIT = ‘CHAR2’. “Bin position
LS_CREATEDATA-QUANT = ‘NUMC10’. “Quant
APPEND LS_CREATEDATA TO LT_CREATEDATA .
CLEAR LS_CREATEDATA .

**********************************************************************
*******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_WHSE_TO_CREATE_STOCK’
EXPORTING
WHSENUMBER = LV_WHSENUMBER
WHSEMVMT = LV_WHSEMVMT
* REQNUMBER = ”
* REQTYPE = ”
* ADDREFNO = ”
* NOTPRIIND = ”
* PRICTLIND = ”
* MINWMIND = ”
* ADDREM = ”
TABLES
IMPORTDATA = LT_IMPORTDATA
CREATEDATA = LT_CREATEDATA
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.

 

BAPI_ACTTYPE_CREATEMULTIPLE Create Activity Types DEMO

 

BAPI_EPM_BP_CREATE Create a Business Partner

AS01 DEMO example BAPI_FIXEDASSET_CREATE1 CreatesAsset

 

CA02 SAMPLE DEMO example BAPI_ROUTING_CREATE routing

 

SAMPLE DEMO example BAPI_ECN_CREATE ECN Create

 

BAPI_GOODSMVT_CREATE_OIL MIGO Post

 

CT04 BAPI_BATCH_CREATE Create Batch SAMPLE DEMO

 

KS01 SAMPLE DEMO BAPI_COSTCENTER_CREATEMULTIPLE

 

FI01 SAMPLE DEMO example BAPI_BANK_CREATE Create Bank

 

CO06 COR1 SAMPLE DEMO example BAPI_PROCORD_CREATE

 

TCODE CO07 SAMPLE DEMO example BAPI_PRODORD_CREATE

 

 

 

If you have problem, please fell free to contact.Thanks.

About me:

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》