Module pool to create goods mvt by using Bapi
Hi can any one help me to develop a module pool program to create goods movement by using BAPI. Pls give me guidelines to proceed further...
i should be grateful to you people for proving help...
thank you
with regards
bheem
Why do you want to develop a module pool to do this? There are standard transactions to do goods movement (MB01, MB1A, MB1B, MIGO, etc.)
Not sure why you want to development something that is already there. Granted, if you are interfacing to an external system.
Albert
Similar Messages
-
Sale Order Item Quantity Not Populating When Create A Sale Order Using BAPI
I am having a problem when creating a sale order using BAPI
BAPI_SALESORDER_CREATEFROMDAT2
Problem is that sale order item quantity field is not populating
code is as follows
ORDER_ITEMS_IN-ITM_NUMBER = '0010'.
ORDER_ITEMS_IN-MATERIAL = '000000000010000262'.
ORDER_ITEMS_IN-TARGET_QU = 'LB'.
ORDER_ITEMS_IN-TARGET_QTY = 1.Hi,
Try populating ORDER_SCHEDULES_IN table in the bapi field REQ_QTY.
Regds,
Rudra -
How to create the sales order using BAPI's ....?
Hi Guru's,
could you please provide how to create the sales order using BAPI's .....i need step by step process and please provide the details from scratch....basically i don't have basic knowledge on this....please provide required inputs ....:)
thanks in advance
Srinivas......Hi Guru's thanks for your inouts and your valuble time...
please find the program logic below...
*& Report ZAREPAS30
REPORT zarepas30.
DATA : gs_vbeln TYPE vbak-vbeln,
gs_order_header_in TYPE bapisdhd1,
gs_order_header_inx TYPE bapisdhd1x,
gt_order_items_in TYPE STANDARD TABLE OF bapisditm,
gwa_itab1 TYPE bapisditm,
gt_order_items_inx TYPE STANDARD TABLE OF bapisditmx,
gwa_itab2 TYPE bapisditmx,
gt_order_partners TYPE STANDARD TABLE OF bapiparnr,
gwa_itab3 TYPE bapiparnr,
gt_return TYPE STANDARD TABLE OF bapiret2,
gwa_itab4 TYPE bapiret2.
Sales document type
PARAMETERS: p_auart TYPE auart OBLIGATORY.
Sales organization
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
Distribution channel
PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
Division.
PARAMETERS: p_spart TYPE spart OBLIGATORY.
Requested Delivery Date
PARAMETERS: p_edatu TYPE edatu OBLIGATORY.
Sold-to
PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
Ship-to
PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
Material
PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
Quantity.
PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
Plant
PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
Start-of-selection.
START-OF-SELECTION.
Header data
Sales document type
gs_order_header_in-doc_type = p_auart.
gs_order_header_inx-doc_type = 'X'.
Sales organization
gs_order_header_in-sales_org = p_vkorg.
gs_order_header_inx-sales_org = 'X'.
Distribution channel
gs_order_header_in-distr_chan = p_vtweg.
gs_order_header_inx-distr_chan = 'X'.
Division
gs_order_header_in-division = p_spart.
gs_order_header_inx-division = 'X'.
Reguested Delivery Date
gs_order_header_in-req_date_h = p_edatu.
gs_order_header_inx-req_date_h = 'X'.
gs_order_header_inx-updateflag = 'I'.
Partner data
Sold to
gwa_itab3-partn_role = 'AG'.
gwa_itab3-partn_numb = p_sold.
APPEND gwa_itab3 TO gt_order_partners .
ship to
gwa_itab3-partn_role = 'WE'.
gwa_itab3-partn_numb = p_ship.
APPEND gwa_itab3 TO gt_order_partners .
ITEM DATA
gwa_itab2-updateflag = 'I'.
Line item number.
gwa_itab1-itm_number = '000010'.
gwa_itab2-itm_number = 'X'.
Material
gwa_itab1-material = p_matnr.
gwa_itab2-material = 'X'.
Plant
gwa_itab1-plant = p_plant.
gwa_itab2-plant = 'X'.
Quantity
gwa_itab1-target_qty = p_menge.
gwa_itab2-target_qty = 'X'.
APPEND gwa_itab1 TO gt_order_items_in.
APPEND gwa_itab2 TO gt_order_items_inx.
Line item number.
gwa_itab1-itm_number = '000020'.
gwa_itab2-itm_number = 'X'.
Material
gwa_itab1-material = p_matnr.
gwa_itab2-material = 'X'.
Plant
gwa_itab1-plant = p_plant.
gwa_itab2-plant = 'X'.
Quantity
gwa_itab1-target_qty = p_menge.
gwa_itab2-target_qty = 'X'.
APPEND gwa_itab1 TO gt_order_items_in.
APPEND gwa_itab2 TO gt_order_items_inx.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = gs_order_header_in
ORDER_HEADER_INX = gs_order_header_inx
IMPORTING
SALESDOCUMENT = gs_vbeln
tables
RETURN = gt_return
ORDER_ITEMS_IN = gt_order_items_in
ORDER_ITEMS_INX = gt_order_items_inx
order_partners = gt_order_partners.
Check the return table.
LOOP AT gt_return into gwa_itab4 WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'Error occured while creating sales order '.
ELSE.
Commit the work.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
WRITE: / 'Document ', gs_vbeln, ' created'.
ENDIF. -
Create a Puchase order using Bapi
Hi all,
I have requirent to create a PO by using Bapi based on text file sent from
interface system here with the file layout.
1.plant (ekko-werks)
2. material EKPO-MATNR
3. pur.group EKKO-EKGRP
4.vendor EKKO-LIFNR
5.shiping ins EKPO-EVERS
6.quantity EKPO-MENGE
please some one help me step setp coding using by bapi.
i know using BDC but no idea how to use BAPI.Hello,
U can make use of the
BAPI_PO_CREATE1 Create purchase order
BAPI_PO_CREATE Create purchase order
BAPI_PO_GETDETAIL Display Purchase Order Details
BAPI_PO_GETITEMS List Purchase Order Items
BAPI_PO_GETITEMSREL List Purchase Orders for Release (Approval): New as of 4.0A
BAPI_PO_GETRELINFO Display Detailed Release (Approval) Information on Purchase Order
BAPI_PO_GET_LIST List Purchase Orders - Only up to 4.0A
Regards,
Vasanth -
Create Service entry sheet using BAPI in SAP
Hi
Experts,
Scenario : SES will be created in third party system , once it created, txt file will be generated and placed in their server.We will be writing a program
to pick that file and post SES in ECC using BAPI ( Idoc is not available to create SES i believe).
I will be using BAPI_ENTRYSHEET_CREATE to create SES sheet but we dont have service masters and creating unplanned service entry sheet.
I will be checking by passing the values manually in BAPI to create SES.
I am passing PO no, line no and qty, value and other details to create SES.
It is creating SES with only header data. it is not updating line item details.
I am missing some parameters to be passed to create SES using BAPI I feel.
I need your help to create SES using BAPI.
What are the details to be passed to create SES in SAP using BAPI.
Regards,
Suresh.ADid you not search? Google has 3600 hits for BAPI_ENTRYSHEET_CREATE
the second hit is a wiki from SCN with sample coding
the third hit has a link to a OSS note with a promising title 420334 - BAPI_ENTRYSHEET_CREATE: Model for creation -
Creating a sales document using BAPI in web dynpro by uploading a file
Hi ALL,
Can some one help me how to create a sales document using BAPI by uploading a file as input...Can someone provide me a sample program....
Thanks n Regards,
Praveenn.
Edited by: praveenn on Aug 23, 2011 12:42 PMHi Sri,
Thx for the response...
Here is the code that i followed for creating a BAPI_SALESORDER_CREATE1 by uploading a text file as input.
Just create a Attribute in the VIEW CONTEXT of type String.
method ONACTIONCREATE_SO .
types : Begin of ty_data,
sales_org type vkorg,
doc_type type AUART,
DISTR_CHAN type VTWEG,
DIVISION type spart,
material type matnr,
partn_role type PARVW,
PARTN_NUMB type kunnr,
end of ty_data.
DATA :it_table TYPE TABLE OF ty_data,
i_data TYPE TABLE OF string,
l_string TYPE string,
wa_table TYPE ty_Data,
l_xstring TYPE xstring,
fields TYPE string_table,
lv_field TYPE string.
DATA: wa_order_header_in TYPE BAPISDHD1,
it_order_items_in TYPE TABLE OF BAPISDITM,
wa_order_items_in TYPE BAPISDITM,
it_order_partners TYPE TABLE OF BAPIPARNR,
wa_order_partners TYPE BAPIPARNR,
it_return TYPE TABLE OF BAPIRET2,
wa_return TYPE BAPIRET2.
DATA : sales_doc type bapivbeln-vbeln.
DATA:
node_zfinal_node TYPE REF TO if_wd_context_node,
elem_zfinal_node TYPE REF TO if_wd_context_element,
stru_zfinal_node TYPE if_main_view=>element_zfinal_node .
get single attribute
wd_context->get_attribute(
EXPORTING
name = 'DATASOURCE'
IMPORTING
value = l_xstring ).
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
in_xstring = l_xstring
IMPORTING
out_string = l_string.
SPLIT l_string AT cl_abap_char_utilities=>newline INTO TABLE i_data.
LOOP AT i_data INTO l_string.
SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
READ TABLE fields INTO lv_field INDEX 1.
wa_table-sales_org = lv_field.
READ TABLE fields INTO lv_field INDEX 2.
wa_table-doc_type = lv_field.
READ TABLE fields INTO lv_field INDEX 3.
wa_table-DISTR_CHAN = lv_field.
READ TABLE fields INTO lv_field INDEX 4.
wa_table-DIVISION = lv_field.
READ TABLE fields INTO lv_field INDEX 5.
wa_table-material = lv_field.
READ TABLE fields INTO lv_field INDEX 6.
wa_table-partn_role = lv_field.
READ TABLE fields INTO lv_field INDEX 7.
wa_table-partn_numb = lv_field.
APPEND wa_table TO it_table.
ENDLOOP.
loop at it_table into wa_table.
clear : wa_order_header_in.
wa_order_header_in-sales_org = wa_table-sales_org.
wa_order_header_in-doc_type = wa_table-doc_type.
wa_order_header_in-distr_chan = wa_table-distr_chan.
wa_order_header_in-division = wa_table-division.
clear : wa_order_items_in.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_table-material
IMPORTING
OUTPUT = wa_order_items_in-material.
*wa_order_items_in-req_qty = wa_table-req_qty.
append wa_order_items_in to it_order_items_in.
clear : wa_order_partners.
wa_order_partners-partn_role = wa_table-partn_role.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_table-partn_numb
IMPORTING
OUTPUT = wa_order_partners-partn_numb
*wa_order_partners-partn_numb = wa_table-partn_numb.
append wa_order_partners to it_order_partners.
endloop.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN =
order_header_in = wa_order_header_in
ORDER_HEADER_INX =
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
SALESDOCUMENT = sales_doc
tables
RETURN = it_return
ORDER_ITEMS_IN = it_order_items_in
ORDER_ITEMS_INX =
order_partners = it_order_partners.
ORDER_SCHEDULES_IN =
get message manager
DATA: l_current_controller TYPE REF TO if_wd_controller,
l_message_manager TYPE REF TO if_wd_message_manager.
l_current_controller ?= wd_this->wd_get_api( ).
DATA: v_message_text TYPE string.
When Sales Order is created commit the data
IF NOT sales_doc IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING wait = 'X'.
CONCATENATE 'Sales Document' sales_doc 'has been created.' INTO v_message_text SEPARATED BY space.
Report Success message
CALL METHOD l_message_manager->report_success
EXPORTING
message_text = v_message_text.
ELSE.
v_message_text = 'Error Creating Sales Order'.
Report Error message
CALL METHOD l_message_manager->report_error_message
EXPORTING
message_text = v_message_text.
ENDIF.
endmethod.
Edited by: praveenn on Aug 30, 2011 2:41 PM -
How to create a sales order using bapi
hi
i need to create a sales order using bapi.
can any one help meDo NOT USE BAPI_SALESORDER_CREATEFROMDATA, that FM is obsolete!
Use BAPI_SALESORDER_CREATEFROMDAT1 .
To build a reference to your contract you have to supply ORDER_HEADER_IN.
Here´s a sample:
MOVE:
gs_vbak-vbeln TO ls_bapisdhd1-refobjkey,
gs_vbak-vbeln TO ls_bapisdhd1-ref_doc,
gs_vbak-vbtyp TO ls_bapisdhd1-refdoc_cat,
gs_vbak-auart TO ls_bapisdhd1-refdoctype.
also gothrouh the links
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2b-%2bsimple%2bprogram%2bto%2bcreate%2bsales%2border%2busing%2bbapi -
Creating Service entry sheet using bapi BAPI_ENTRYSHEET_CREATE
Hello Guys,
I am trying to create a service entry sheet for single line item only using bapi BAPI_ENTRYSHEET_CREATE.
its is creating Service entry document but not populating the line item for me (here only one line item for me).
If you guys have sample code (how the poupulate the internal tables) could you please send it across?.
Thanks in Advance..
SteevanHi,
Creating Service entry sheet using bapi BAPI_ENTRYSHEET_CREATE
For creating service entry sheet follow below link and it helps to you.
http://wiki.sdn.sap.com/wiki/display/ABAP/CreatingServiceEntrySheetusing+BAPI
Regards,
Sekhar -
Module pool to create input field dynamically.
Hi All,
I have a requirement in module pool programming,
Where I have one input field,based on the value given in this input I have to get the
input fields dynamically in the screen.
Is it possible to achieve this?
If yes, please do tell me the solution to approach this requirement.
With Regards,
S.Asha.Hi,
You can use IMPORT DYNPRO / EXPORT DYNPRO.
Please check this URL: [Import/Export dynpro not working|Import/Export dynpro not working]
[EXPORT DYNPRO or GENERATE DYNPRO|EXPORT DYNPRO or GENERATE DYNPRO]
Cheers, -
How to create Incoming Email Activity using BAPI or Function module
To create an Incoming Email Activity using BAPI 'BAPI_ACTIVITYCRM_CREATEMULTI' or using 'CRM_ORDER_MAINTAIN' . what parameters i need to pass to a bapi.
Suggest me with a solution.
Regards,
SanjaniFor activity you must fill the following structures of 'CRM_ORDER_MAINTAIN'...
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_activity_h = t_activity_h
iv_collect_exceptions = ''
CHANGING
ct_orderadm_h = t_orderadm_h
ct_input_fields = t_input_fields
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5.
And at the end you must use also 'CRM_ORDER_SAVE' to performe the save.
Regards. -
Creating sale order by using BAPI
Hi,
My requirement is to create a inquiry(VA11), By using the Inquiry no as a input in report, i should create a salesorder using BAPI in which the datas should be flowed from inquiry to sale order. i did almost everything except the Pricing Condition.
I am fetching the pricing condition values from table KONV-KSCHL and passing the value via BAPI_SALESORDER_CREATEFROMDAT2 it creates saleorder. In the created salesorder, there are two same pricing conditions but different rate 1.) the price of the MATNR which is maintained 2.) the changed MATNR price in inquiry level,
i need the value which is changed in inquiry level that is 2nd value.
can anyone help me in this...REPORT ZSALESORDER.
<< Cut and paste without attribution from
create sales order using BAPI
removed >>
Edited by: Rob Burbank on Feb 24, 2009 10:43 AM -
Problem while creating credit memo request using BAPI
HI,
I am trying to create credit memo request using the BAPI_SALESDOCU_CREATEFROMDATA1..
I am getting the error as " No customer master data is available for the customer". But the customer exists in the KNA1 table. What is the mistake i hv done.. this s my code..
REPORT ZSV_CREDITMEMO_TEST1.
Data declarations.
DATA: v_vbeln LIKE vbak-vbeln.
DATA: header LIKE bapisdhead1.
DATA: headerx LIKE bapisdhead1x.
DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
WITH HEADER LINE.
DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
WITH HEADER LINE.
DATA: lt_schedules_ink TYPE STANDARD TABLE OF bapisdhead1
WITH HEADER LINE.
START-OF-SELECTION.
Header data
Sales document type
header-doc_type = 'G2'.
headerx-doc_type = 'X'.
Sales organization
header-sales_org = '0001'.
headerx-sales_org = 'X'.
Distribution channel
header-distr_chan = ''.
headerx-distr_chan = 'X'.
Division
header-division = ''.
headerx-division = 'X'.
headerx-updateflag = 'I'.
*Complete delivery
header-COMPL_DLV = ''.
header-COMPL_DLV = 'X'.
Partner data
Sold to
partner-partn_role = 'AG'.
partner-partn_numb = '0000C10130'.
APPEND partner.
Ship to
partner-partn_role = 'WE'.
partner-partn_numb = ''.
APPEND partner.
ITEM DATA
itemx-updateflag = 'I'.
Line item number.
item-itm_number = '000010'.
itemx-itm_number = 'X'.
Material
item-material = 'C20011'.
itemx-material = 'X'.
Plant
item-plant = ''.
itemx-plant = 'X'.
Quantity
item-target_qty = '10000'.
itemx-target_qty = 'X'.
item category
itemx-ITEM_CATEG = 'X'.
APPEND item.
APPEND itemx.
Fill schedule lines
lt_schedules_in-itm_number = '000010'.
lt_schedules_in-sched_line = '0001'.
lt_schedules_in-req_qty = '10000'.
APPEND lt_schedules_in.
Fill schedule line flags
lt_schedules_inx-itm_number = '000010'.
lt_schedules_inx-sched_line = '0001'.
lt_schedules_inx-updateflag = 'X'.
lt_schedules_inx-req_qty = 'X'.
APPEND lt_schedules_inx.
Call the BAPI to create the sales order.
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = v_vbeln
TABLES
return = return
sales_items_in = item
sales_items_inx = itemx
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_partners = partner.
Check the return table.
LOOP AT return WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'Error in creating document'.
ELSE.
Commit the work.
COMMIT WORK AND WAIT.
WRITE: / 'Document ', v_vbeln, ' created'.
ENDIF.
can anyone tell what the error is.?Hi
please look at code below code this succefully creating credit memo may some help to you
header-doc_type = 'ZS4'.
PERFORM get_plant.
headerx-doc_type = 'X'.
header-sales_org = wa_temp1-vkorg.
headerx-sales_org = 'X'.
header-purch_no = wa_temp1-bstnk.
header-distr_chan = wa_temp1-vtweg.
headerx-distr_chan = 'X'.
header-division = wa_temp1-spart.
header-purch_no_s = wa_temp1-bstnk.
headerx-division = 'X'.
wa_partner-partn_role = 'AG'.
wa_partner-partn_numb = wa_temp1-kunnr.
APPEND wa_partner TO it_partner.
wa_partner-partn_role = 'WE'.
wa_partner-partn_numb = wa_temp1-kunnr.
APPEND wa_partner TO it_partner.
CLEAR: wa_partner.
LOOP AT lt_temp2 INTO wa_temp2 WHERE kunnr = wa_temp1-kunnr.
"AND matnr = wa_temp1-matnr.
*wa_item-itm_number = wa_temp2-posnr .
wa_item-material = wa_temp2-matnr.
wa_item-plant = wa_temp2-werks.
wa_item-req_qty = wa_temp2-fkimg * 1000.
wa_item-target_qty = wa_temp2-fkimg * 1000.
APPEND wa_item TO it_item.
ENDLOOP.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
EXPORTING
order_header_in = header
* WITHOUT_COMMIT = ' '
* CONVERT_PARVW_AUART = ' '
IMPORTING
salesdocument = v_vbeln
* SOLD_TO_PARTY =
* SHIP_TO_PARTY =
* BILLING_PARTY =
return = return
TABLES
order_items_in = it_item
order_partners = it_partner.
IF v_vbeln <> space.
wa_vbeln-vbeln = v_vbeln.
APPEND wa_vbeln TO lt_vbeln.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
HIDE wa_vbeln-vbeln.
CLEAR: wa_partner,header,v_vbeln, wa_temp2.
REFRESH: it_partner,it_item.
ELSE.
* LOOP AT return .
it_error-srno = idx.
it_error-err_msg = return-message.
APPEND it_error.
* ENDLOOP.
ENDIF.
idx = idx + 1.
ENDLOOP.
Regards -
How to create service PO while using BAPI
Dear Experts
I am getting error while creating Service PO using BAPI
E 518
No account assignment exists for service line 0000000010
E 518
No account assignment exists for service line 0000000010
TYPES : BEGIN OF ty_header,
po_no(10) TYPE n,
purch_org TYPE bapimepoheader-purch_org,
pur_group TYPE bapimepoheader-pur_group,
doc_type TYPE bapimepoheader-doc_type,
vendor TYPE bapimepoheader-vendor,
doc_date TYPE bapimepoheader-doc_date,
currency TYPE bapimepoheader-currency,
comp_code TYPE bapimepoheader-comp_code,
END OF ty_header,
BEGIN OF ty_item,
po_no(10) TYPE n, " Internal Use
po_item TYPE bapimepoitem-po_item,
acctasscat TYPE bapimepoitem-acctasscat,
short_text TYPE bapimepoitem-short_text,
plant TYPE bapimepoitem-plant,
pckg_no TYPE bapimepoitem-pckg_no,
stge_loc TYPE bapimepoitem-stge_loc,
quantity TYPE bapimepoitem-quantity,
po_unit TYPE bapimepoitem-po_unit,
po_price TYPE bapimepoitem-po_price,
net_price TYPE bapimepoitem-net_price,
price_unit TYPE bapimepoitem-price_unit,
orderpr_un TYPE bapimepoitem-orderpr_un,
delivery_date TYPE bapimeposchedule-delivery_date, " bapimeposchedule
matl_group TYPE bapimepoitem-matl_group,
tax_code TYPE bapimepoitem-tax_code,
END OF ty_item,
BEGIN OF ty_service,
po_no(10) TYPE n, " Internal Use
po_item TYPE bapimepoitem-po_item, " Internal Use
pckg_no TYPE bapiesllc-pckg_no,
line_no TYPE bapiesllc-line_no,
ext_line TYPE bapiesllc-ext_line,
outl_ind TYPE bapiesllc-outl_ind,
subpckg_no TYPE bapiesllc-subpckg_no,
serial_no TYPE bapiesklc-serial_no, " bapiesklc
short_text TYPE bapiesllc-short_text,
quantity TYPE bapiesllc-quantity,
base_uom TYPE bapiesllc-base_uom,
gr_price TYPE bapiesllc-gr_price,
matl_group TYPE bapiesllc-matl_group,
END OF ty_service,
BEGIN OF ty_poaccount,
po_no(10) TYPE n, " Internal Use
po_item TYPE bapimepoaccount-po_item,
serial_no TYPE bapimepoaccount-serial_no,
gl_account TYPE bapimepoaccount-gl_account,
costcenter TYPE bapimepoaccount-costcenter,
asset_no TYPE bapimepoaccount-asset_no,
orderid TYPE bapimepoaccount-orderid,
END OF ty_poaccount.
DATA : it_header TYPE TABLE OF ty_header,
wa_header TYPE ty_header,
it_item TYPE TABLE OF ty_item,
wa_item TYPE ty_item,
it_service TYPE TABLE OF ty_service,
wa_service TYPE ty_service,
it_account TYPE TABLE OF ty_poaccount,
wa_account TYPE ty_poaccount.
DATA : it_excel1 TYPE TABLE OF alsmex_tabline,
wa_excel1 TYPE alsmex_tabline,
it_excel2 TYPE TABLE OF alsmex_tabline,
wa_excel2 TYPE alsmex_tabline,
it_excel3 TYPE TABLE OF alsmex_tabline,
wa_excel3 TYPE alsmex_tabline,
it_excel4 TYPE TABLE OF alsmex_tabline,
wa_excel4 TYPE alsmex_tabline.
DATA : number TYPE string,
number1 TYPE string.
********** BAPI**************
CONSTANTS : c_x VALUE 'X'.
*Structures to hold PO header data
DATA : header LIKE bapimepoheader ,
headerx LIKE bapimepoheaderx .
*Internal Tables to hold PO ITEM DATA
DATA : item LIKE bapimepoitem OCCURS 0 WITH HEADER LINE,
itemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
*Structures to hold PO schedule data
DATA : itemschedule LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE ,
itemschedulex LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE .
*Structures to hold PO services data
DATA : services LIKE bapiesllc OCCURS 0 WITH HEADER LINE .
*Structures to hold PO (distrib.imputac.lín.servicios) data
DATA : posrvaccessvalues LIKE bapiesklc OCCURS 0 WITH HEADER LINE .
*Structures to hold PO account data
DATA : account LIKE bapimepoaccount OCCURS 0 WITH HEADER LINE ,
accountx LIKE bapimepoaccountx OCCURS 0 WITH HEADER LINE .
*Internal table to hold messages from BAPI call
DATA : return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
purchaseorder LIKE bapimepoheader-po_number.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_file1 TYPE rlgrap-filename OBLIGATORY,
p_brow1 TYPE i,
p_erow1 TYPE i.
SELECTION-SCREEN : END OF BLOCK b1.
SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS : p_file2 TYPE rlgrap-filename OBLIGATORY,
p_brow2 TYPE i,
p_erow2 TYPE i.
SELECTION-SCREEN : END OF BLOCK b2.
SELECTION-SCREEN : BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETERS : p_file3 TYPE rlgrap-filename OBLIGATORY,
p_brow3 TYPE i,
p_erow3 TYPE i.
SELECTION-SCREEN : END OF BLOCK b3.
SELECTION-SCREEN : BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
PARAMETERS : p_file4 TYPE rlgrap-filename OBLIGATORY,
p_brow4 TYPE i,
p_erow4 TYPE i.
SELECTION-SCREEN : END OF BLOCK b4.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_file1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file2.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_file2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file3.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_file3.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file4.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_file4.
START-OF-SELECTION.
PERFORM excel_to_itab.
PERFORM get_final.
*& Form excel_to_itab
* text
* --> p1 text
* <-- p2 text
FORM excel_to_itab .
************** Excel 1
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file1
i_begin_col = '1'
i_begin_row = p_brow1
i_end_col = '08'
i_end_row = p_erow1
TABLES
intern = it_excel1
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_excel1 INTO wa_excel1.
CASE wa_excel1-col.
WHEN '0001'.
wa_header-po_no = wa_excel1-value.
WHEN '0002'.
wa_header-purch_org = wa_excel1-value.
WHEN '0003'.
wa_header-pur_group = wa_excel1-value.
WHEN '0004'.
wa_header-doc_type = wa_excel1-value.
WHEN '0005'.
wa_header-vendor = wa_excel1-value.
WHEN '0006'.
wa_header-doc_date = wa_excel1-value.
WHEN '0007'.
wa_header-currency = wa_excel1-value.
WHEN '0008'.
wa_header-comp_code = wa_excel1-value.
ENDCASE.
AT END OF row.
APPEND wa_header TO it_header.
CLEAR wa_header.
ENDAT.
ENDLOOP.
************** Excel 2
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file2
i_begin_col = '1'
i_begin_row = p_brow2
i_end_col = '16'
i_end_row = p_erow2
TABLES
intern = it_excel2
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_excel2 INTO wa_excel2.
CASE wa_excel2-col.
WHEN '0001'.
wa_item-po_no = wa_excel2-value.
WHEN '0002'.
wa_item-po_item = wa_excel2-value.
WHEN '0003'.
wa_item-acctasscat = wa_excel2-value.
WHEN '0004'.
wa_item-short_text = wa_excel2-value.
WHEN '0005'.
wa_item-plant = wa_excel2-value.
WHEN '0006'.
wa_item-pckg_no = wa_excel2-value.
WHEN '0007'.
wa_item-stge_loc = wa_excel2-value.
WHEN '0008'.
wa_item-quantity = wa_excel2-value.
WHEN '0009'.
wa_item-po_unit = wa_excel2-value.
WHEN '0010'.
wa_item-po_price = wa_excel2-value.
WHEN '0011'.
wa_item-net_price = wa_excel2-value.
WHEN '0012'.
wa_item-price_unit = wa_excel2-value.
WHEN '0013'.
wa_item-orderpr_un = wa_excel2-value.
WHEN '0014'.
wa_item-delivery_date = wa_excel2-value.
WHEN '0015'.
wa_item-matl_group = wa_excel2-value.
WHEN '0016'.
wa_item-tax_code = wa_excel2-value.
ENDCASE.
AT END OF row.
APPEND wa_item TO it_item.
CLEAR wa_item.
ENDAT.
ENDLOOP.
************** Excel 3
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file3
i_begin_col = '1'
i_begin_row = p_brow3
i_end_col = '13'
i_end_row = p_erow3
TABLES
intern = it_excel3
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_excel3 INTO wa_excel3.
CASE wa_excel3-col.
WHEN '0001'.
wa_service-po_no = wa_excel3-value.
WHEN '0002'.
wa_service-po_item = wa_excel3-value.
WHEN '0003'.
wa_service-pckg_no = wa_excel3-value.
WHEN '0004'.
wa_service-line_no = wa_excel3-value.
WHEN '0005'.
wa_service-ext_line = wa_excel3-value.
WHEN '0006'.
wa_service-outl_ind = wa_excel3-value.
WHEN '0007'.
wa_service-subpckg_no = wa_excel3-value.
WHEN '0008'.
wa_service-serial_no = wa_excel3-value.
WHEN '0009'.
wa_service-short_text = wa_excel3-value.
WHEN '0010'.
wa_service-quantity = wa_excel3-value.
WHEN '0011'.
wa_service-base_uom = wa_excel3-value.
WHEN '0012'.
wa_service-gr_price = wa_excel3-value.
WHEN '0013'.
wa_service-matl_group = wa_excel3-value.
ENDCASE.
AT END OF row.
APPEND wa_service TO it_service.
CLEAR wa_service.
ENDAT.
ENDLOOP.
************** Excel 3
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file4
i_begin_col = '1'
i_begin_row = p_brow4
i_end_col = '07'
i_end_row = p_erow4
TABLES
intern = it_excel4
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_excel4 INTO wa_excel4.
CASE wa_excel4-col.
WHEN '0001'.
wa_account-po_no = wa_excel4-value.
WHEN '0002'.
wa_account-po_item = wa_excel4-value.
WHEN '0003'.
wa_account-serial_no = wa_excel4-value.
WHEN '0004'.
wa_account-gl_account = wa_excel4-value.
WHEN '0005'.
wa_account-costcenter = wa_excel4-value.
WHEN '0006'.
wa_account-asset_no = wa_excel4-value.
WHEN '0007'.
wa_account-orderid = wa_excel4-value.
ENDCASE.
AT END OF row.
APPEND wa_account TO it_account.
CLEAR wa_account.
ENDAT.
ENDLOOP.
ENDFORM. " excel_to_itab
*& Form GET_FINAL
* text
* --> p1 text
* <-- p2 text
FORM get_final .
LOOP AT it_header INTO wa_header.
* BAPI HEADER
header-purch_org = wa_header-purch_org.
header-pur_group = wa_header-pur_group.
header-doc_type = wa_header-doc_type.
header-vendor = wa_header-vendor.
header-doc_date = wa_header-doc_date.
header-currency = wa_header-currency.
header-comp_code = wa_header-comp_code.
* BAPI HEADERX
headerx-comp_code = c_x.
headerx-doc_type = c_x.
headerx-vendor = c_x.
headerx-creat_date = c_x.
headerx-created_by = c_x.
headerx-purch_org = c_x.
headerx-pur_group = c_x.
headerx-langu = c_x.
headerx-sales_pers = c_x.
headerx-currency = c_x.
headerx-doc_date = c_x. " Added
LOOP AT it_item INTO wa_item WHERE po_no = wa_header-po_no.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'SERVICE'
* quantity = '1'
* SUBOBJECT = ' '
* TOYEAR = '0000'
* IGNORE_BUFFER = ' '
IMPORTING
number = number
* QUANTITY =
* RETURNCODE =
* EXCEPTIONS
* INTERVAL_NOT_FOUND = 1
* NUMBER_RANGE_NOT_INTERN = 2
* OBJECT_NOT_FOUND = 3
* QUANTITY_IS_0 = 4
* QUANTITY_IS_NOT_1 = 5
* INTERVAL_OVERFLOW = 6
* BUFFER_OVERFLOW = 7
* OTHERS = 8
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
item-po_item = wa_item-po_item.
item-acctasscat = wa_item-acctasscat.
item-item_cat = '9'.
item-short_text = wa_item-short_text.
item-plant = wa_item-plant.
item-pckg_no = number.
item-stge_loc = wa_item-stge_loc.
item-quantity = wa_item-quantity.
item-po_unit = wa_item-po_unit.
item-po_price = wa_item-po_price.
item-net_price = wa_item-net_price.
item-price_unit = wa_item-price_unit.
item-orderpr_un = wa_item-orderpr_un.
item-matl_group = wa_item-matl_group.
item-tax_code = wa_item-tax_code.
APPEND item.
CLEAR item.
itemx-po_item = wa_item-po_item.
itemx-item_cat = c_x.
itemx-po_itemx = c_x.
itemx-short_text = c_x.
itemx-quantity = c_x.
itemx-tax_code = c_x.
itemx-acctasscat = c_x.
itemx-item_cat = c_x.
itemx-matl_group = c_x.
itemx-plant = c_x.
itemx-trackingno = c_x.
itemx-agreement = c_x.
itemx-agmt_item = c_x.
itemx-stge_loc = c_x.
itemx-quantity = c_x.
itemx-po_unit = c_x.
itemx-conv_num1 = c_x.
itemx-conv_den1 = c_x.
itemx-net_price = c_x.
itemx-price_unit = c_x.
itemx-gr_pr_time = c_x.
itemx-prnt_price = c_x.
itemx-unlimited_dlv = c_x.
itemx-gr_ind = c_x .
itemx-ir_ind = c_x .
itemx-gr_basediv = c_x .
itemx-pckg_no = c_x.
itemx-po_price = c_x. " Added
itemx-orderpr_un = c_x. " Added
APPEND itemx.
CLEAR itemx.
itemschedule-po_item = wa_item-po_item.
itemschedule-del_datcat_ext = 'D'.
itemschedule-delivery_date = wa_item-delivery_date.
APPEND itemschedule.
CLEAR itemschedule.
itemschedulex-po_item = wa_item-po_item.
itemschedulex-po_itemx = c_x .
itemschedulex-del_datcat_ext = c_x.
itemschedulex-delivery_date = c_x .
APPEND itemschedulex.
CLEAR itemschedulex.
LOOP AT it_service INTO wa_service WHERE po_no = wa_item-po_no AND po_item = wa_item-po_item.
IF wa_service-outl_ind IS INITIAL.
IF number1 IS INITIAL.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'SERVICE'
* quantity = '1'
* SUBOBJECT = ' '
* TOYEAR = '0000'
* IGNORE_BUFFER = ' '
IMPORTING
number = number1
* QUANTITY =
* RETURNCODE =
* EXCEPTIONS
* INTERVAL_NOT_FOUND = 1
* NUMBER_RANGE_NOT_INTERN = 2
* OBJECT_NOT_FOUND = 3
* QUANTITY_IS_0 = 4
* QUANTITY_IS_NOT_1 = 5
* INTERVAL_OVERFLOW = 6
* BUFFER_OVERFLOW = 7
* OTHERS = 8
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
services-pckg_no = number.
services-line_no = '1'.
services-ext_line = '0'.
services-outl_ind = 'X'.
services-subpckg_no = number1.
* services-short_text = wa_service-short_text.
* services-quantity = wa_service-quantity.
* services-base_uom = wa_service-base_uom.
* services-gr_price = wa_service-gr_price.
* services-matl_group = wa_service-matl_group.
APPEND services.
CLEAR services.
ENDIF.
* ELSE.
services-pckg_no = number1.
services-line_no = wa_service-line_no.
services-ext_line = wa_service-ext_line.
* services-outl_ind = wa_service-outl_ind.
services-subpckg_no = '0'.
services-short_text = wa_service-short_text.
services-quantity = wa_service-quantity.
services-base_uom = wa_service-base_uom.
services-gr_price = wa_service-gr_price.
services-matl_group = wa_service-matl_group.
APPEND services.
CLEAR services.
ENDIF.
IF wa_service-outl_ind IS INITIAL.
posrvaccessvalues-pckg_no = number1.
posrvaccessvalues-line_no = wa_service-line_no.
posrvaccessvalues-serno_line = '01'.
posrvaccessvalues-serial_no = wa_service-serial_no.
* posrvaccessvalues-percentage = '100'.
APPEND posrvaccessvalues . CLEAR posrvaccessvalues.
ENDIF.
ENDLOOP.
LOOP AT it_account INTO wa_account WHERE po_no = wa_item-po_no AND po_item = wa_item-po_item.
account-po_item = wa_account-po_item.
account-serial_no = wa_account-serial_no.
account-gl_account = wa_account-gl_account.
account-costcenter = wa_account-costcenter.
account-asset_no = wa_account-asset_no.
account-orderid = wa_account-orderid.
APPEND account.
CLEAR account.
accountx-po_item = wa_account-po_item.
accountx-po_itemx = c_x .
accountx-serial_no = wa_account-serial_no.
accountx-serial_nox = c_x .
* accountx-creat_date = c_x .
accountx-costcenter = c_x .
accountx-gl_account = c_x .
* accountx-co_area = c_x .
* accountx-tax_code = c_x .
* accountx-asset_no = c_x . " Added
* accountx-orderid = c_x . " Added
APPEND accountx. CLEAR accountx.
ENDLOOP.
ENDLOOP.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = header
poheaderx = headerx
* POADDRVENDOR =
* TESTRUN =
IMPORTING
exppurchaseorder = purchaseorder
* EXPHEADER =
* EXPPOEXPIMPHEADER =
TABLES
return = return
poitem = item
poitemx = itemx
poschedule = itemschedule
poschedulex = itemschedulex
poaccount = account
poaccountx = accountx
poservices = services.
posrvaccessvalues = posrvaccessvalues.
IF purchaseorder IS NOT INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
LOOP AT return.
WRITE : / return-type, return-number, return-message.
ENDLOOP.
ENDLOOP.
ENDFORM. " GET_FINALHi ganesh,
Please look at the SAP note 376424 - BAPI_PO_CREATE1: Error messages for parked POs.
Sap recommends to install the support service pack. Take a look at the note for detailed understanding.
Also take a look at SAP NOte
767284 - SE518 occurs although account assignment is supplied to BAPI (this requires Note 552114 must be applied as a prerequisite)
Consider contacting basis team after your analysis about the issue.
Regards,
Sivaganesh -
Problem with creating Process order confirmation using BAPI
Hello,
While creating Process Order confirmation using BAPI_PROCORDCONF_CREATE_TT, material document is getting created. But a line item is inserted in the table AFRU without material document number. When it is created manually using the transaction COR6, the table is getting updated with material doc in the line item. Can anyone let me know what other attributes to be passed in order the update the same?
Thanks in Advance.
Regards, Senthil G.Hello , I am working with the same Bapi, can you please send me the code to fill the parameters, if I find the same error like you, I will send you the solution if I correct that.
Thanks for your help.
[email protected]
Guatemala, Cempro ADATSA -
Problem while creating serivce call ..using bapi
Hi
I am trying to create a service call using a BAPI(BAPI_FLIGHT_GETLIST) as given in the example...
while creating the service call in the step Adapt Context i can see Airline Destination from ,Destination to and max rows,
i am not getting any choice to select dest from and to...
and when it is finished.. the node bapi_flights_getlist doesnt have any subnodes like cityfrom country from ... flight list.. as shown in the example...
Can anyone send me the screenshts of creating a service call specially the step Adapt context...to [email protected]
points will be given..
Regards,
KiranHI
Pricing will be carried basing on the pricing
procedure.
Case1: Prices will be carried out automatically if
necessary condition records are maintained for the
condition type.
For this you can go to Sales Order-> Item Conditions
In the screen you can click on command button Analysis,
which gives you the list of condition types associated
to the pricing procedure. By clicking on the condition
type you can know the action that has taken place.
Case2: Manually forcing prices for Items.
To do this, you have to populate ORDER_CONDITIONS_IN &
ORDER_CONDITIONS_INX. Also note to identify the item
numbers, you manually pass the item number for each item
in the sales order, use the same item number for
populating conditions.
Parameters required:
ORDER_CONDITIONS_IN:
ITM_NUMBER, COND_TYPE, COND_VALUE, CURRENCY
ORDER_CONDITIONS_INX:
ITM_NUMBER, COND_TYPE, UPDATEFLAG, COND_VALUE,CURRENCY.
Hope the above info helps you. Do revert back if you
need more info.
Kind Regards
Eswar
Maybe you are looking for
-
Add bookmarks to pdf file using Excel VBA
Good morning - I have, through internet searches, created an Excel macro that prints numerous workbooks to pdf, combines them into one file and prints that file. I have been searching for the last piece, which is adding bookmarks, but have not had a
-
Why wont my password be accepted on applemail?
Why won't my password be accepted on Apple mail? I've just got my macbook pro and I don't know what to do? can anyone help me please?
-
Slideshow Background Music Adjusting Slide Where Music Starts?
I've been trying to make a slideshow with music attached and can't find a solution to this problem anywhere. The problem is as follows. I have imported all my pictures and I've imported 5 music tracks, everything okay so far. However, I want to start
-
Do I need Internet Security Software for IPONE 5S?
Does anybody know if it is recommended to use additional Internet Security Software to protect my Iphone?
-
BEX Query to ABAP Transaction Code
Hi, RRI from BEX Query to ABAP Transaction Code When I Right clivk and select GOTO on my Delivery order say 120012 It shd directly go into tht particular DO The transaction code is vl33n but when i give ABAP Transaction as reciever object it only goe