Changing the quantity of Schedule line for an product runtime
Hi CRM friends,
When I am saving the Order after changing the quantity (say from <b>5 to 10</b>); Now base on some conditions, quantity must be reverted back to the original quantity (i.e to 5). This has to be done while saving the order in a Call back function module. I have the following parameters:
1. Item Guid
2. Old Value (i.e 5)
3. Header Guid
I have tried using FM CRM_SCHEDLIN_I_MAINTAIN_OW using the following code:
DATA: LS_FIELDS TYPE CRMT_INPUT_FIELD,
LT_FIELDS TYPE CRMT_INPUT_FIELD_TAB,
LS_QTY TYPE CRMT_SCHEDLIN_EXTD,
LS_SCHEDLIN TYPE CRMT_SCHEDLIN_I_COM,
LT_SCHEDLIN TYPE CRMT_SCHEDLIN_I_COMT.
LS_FIELD_NAMES-FIELDNAME = 'QUANTITY'.
LS_FIELD_NAMES-CHANGEABLE = 'X'.
INSERT LS_FIELD_NAMES INTO TABLE LS_FIELDS-FIELD_NAMES.
LS_FIELDS-REF_HANDLE = 1.
LS_FIELDS-REF_GUID = IV_OBJECT_GUID. A88DE289D91D464C81052646DB6856BB
LS_FIELDS-REF_KIND = 'B'.
LS_FIELDS-OBJECTNAME = 'SCHEDLIN_I'.
INSERT LS_FIELDS INTO TABLE LT_FIELDS.
LS_QTY-GUID = ls_schedlin_i_new-GUID. A88DE289D91D464C81052646DB6856BB / 1D72D133BF86FC4F81BC8F0F88438136(From table CRMD_SCHEDLIN passing the item guid )
LS_QTY-ITEM_GUID = IV_OBJECT_GUID. A88DE289D91D464C81052646DB6856BB
LS_QTY-QUANTITY = lV_OLD_ORDER_QTY.
LS_QTY-MODE = 'B'.
LS_QTY-EVENT_TYPE_APPL = 'CRMS'.
LS_QTY-EVENT_TYPE = 'ORDER'.
LS_QTY-SCHED_NO_EXT = '0001'.
LS_SCHEDLIN-REF_GUID = IV_OBJECT_GUID.
LS_SCHEDLIN-REF_HANDLE = 1.
LS_SCHEDLIN-MODE = 'B'.
INSERT LS_QTY INTO TABLE LS_SCHEDLIN-SCHEDLINES.
CALL FUNCTION 'CRM_SCHEDLIN_I_MAINTAIN_OW'
CHANGING
CS_SCHEDLIN_I_COM = LS_SCHEDLIN
CT_INPUT_FIELDS = LT_FIELDS.
The code is executing fine, but the quantity changes to new one (i.e. <b>10</b>) Please tell me whether there is a mistake in passing the parameters. For LS_QTY-guid I have tried passing with item guid as well as schedule line guid from the table CRMD_SCHEDLIN.
Also tell me there is any other way.
Regards
Naveen.
hi use this code in
order_save-prepare method
The refrence code is from FM 'CRM_COMP_PROD_INS_AS_SUBITEMS' and include LCRM_COMP_PROD_UIF13
It does work. I am copying the main line item in sub line item and changing the quantity.
regards
M
cs_schedlin_i-ref_handle = iv_handle.
fill input_field
ls_input_field-ref_handle = iv_handle.
ls_input_field-ref_kind = gc_object_ref_kind-orderadm_i.
ls_input_field-objectname = gc_object_name-schedlin.
get handle
CALL FUNCTION 'CRM_INTLAY_GET_HANDLE'
IMPORTING
ev_handle = ls_schedlines-handle.
ls_schedlines-mode = gc_mode-create.
ls_schedlines-parent_sdln_guid = iv_own_item_guid.
ls_schedlines-logical_key = ls_schedlines-handle.
ls_schedlines-quantity = 1.
INSERT ls_schedlines INTO TABLE cs_schedlin_i-schedlines.
ls_input_field_names-fieldname = gc_fld_schedlin-handle.
INSERT ls_input_field_names INTO
TABLE ls_input_field-field_names.
ls_input_field_names-fieldname = gc_fld_schedlin-parent_sdln_guid.
INSERT ls_input_field_names INTO
TABLE ls_input_field-field_names.
ls_input_field_names-fieldname = gc_fld_schedlin-logical_key.
INSERT ls_input_field_names INTO
TABLE ls_input_field-field_names.
ls_input_field_names-fieldname = gc_fld_schedlin-quantity.
INSERT ls_input_field_names INTO
TABLE ls_input_field-field_names.
ls_input_field-logical_key = ls_schedlines-handle.
INSERT ls_input_field INTO TABLE ct_input_field.
Similar Messages
-
Changes in quantity in schedule lines
Hi,
We are making a sales order with reference to a quotation.The quantities in quotation is getting copied to sales order.Now when we go to the schedule lines of the item in sales order and put the quantities based on delivery date and if the quantity some how increases then the sales order value increases.
e.g
Quotaion qty-10 pcs
10 pcs gets copied to SO.
We go to schedule line and put the qty as:-
10.2.2008-2 qty
12.2.2008-5qty
14.3.2008-3 qty
if we put another schedule line like:
15.3.2008-2 qty
then the so qty gets increased from 10 to 12 with a warning message.I want the system not to allow this.It should nopt allow me to change the qty more than the copied qty.Kindly guide how to do it.
Is there any message control at sales order level.
Regards
SomnathHi
Spmnath
Go to Quotation Item Catagory ( Tcode VOV7 ) go to Business data tab there u put 'C' in Completion rule field.
Please try new quation after necessary changes. This changes will not be appllicable for old Sales Documents.
I am sure u will get the answer.
Thx. -
How to create multiple schedule lines for configurable products
Hi -
We have enabled variant configuration and would like to have multiple scheudule lines created , but it seems that only one line is avaialble, is there any way to configure the use of multiple schedule lines?
Note - we are not using KMAT material types, rather triggering a unique kit compoments within Sales BOM.
We have been able to make the necessary adjustments to allow the creation of the Scheduling agreement and have the BOM explode correctly, but just am not able to trigger multiple sched lines.
thanks
BillYour context node shall contain all these fields like country,city,etc as different attributes.so in your view configuration,add all these fields whatever you require from the AVAILABLE FIELDS section to the DISPLAYED FIELDS section.NOw all these attributes would be added in diff rows.What you need to do is,select the first attribute,lets say COUNTRY,click on this attribute and then on the buttn SHOW FIELD PROPERTIES.Thsi will show you the label name etc.Here you change the label name to NATIONALITY.Also ,it will show you the row no,cloumn span of the field and column span of the label.You need to reduce the column span of the field value.Ie if the column span is from D TO H,reduce it from D TO F.Now goto the next attribute eg CITY and in the same way,goto the attribute properties.Here ,There is a check box SHOW LABEL,uncheck this,and now goto the row no and the cloumn span.Make the row no same as that of the COUNTRY FIELD.The column span should howevrbe statring from where the column span of country field ended.Ie Teh column apsn of counrty field ended at F .So for CITY,the column span should start from G to amybe H.Now this is how you need to accomodate the other fields also in the same row,by changing the row no and column span in the field properties.
Suvidha -
Where / How to change the Em Alert schedule time for a target ?
Hi,
We have a cron tab say running on 30 20 * * 1-5 on our production. And in EM it was set to 30 20 * * 0-4 earlier, so we r getting alert on Sunday. So I want to change in EM also to 30 20 * * 1-5 so that we ll not get the EM alert on Sunday night. Where or how in EM to change this ?
Thanks in Advance.
Edited by: Kuldip on Jul 8, 2010 2:43 AMI am afraid that using Blackouts is the only way to avoid OEM GC generating alerts.
Note that I am revering to the Alerts that will be shown in the OEM Console.
If you want to influence the moment a Notification will result in an E-mail, you might want to take a look at the Notification Schedule, that allows you to do a-mail notification based on date and time to different mailboxes.
Regards
Rob -
How to link Invoice Quantity and Confirmed quantity in schedule line
Hello,
I'm working for a report in BW. The user want to compare the invoice quantity to the confirmed quantity in schedule line for a sales order.
I can't find any table linking these two fields.
Could you help?
Thanks a lot
JeannieAshish,
When we link these two tables by Sales Order Number / Item, we would take following result:
Sales Order / Itme / Schedule line / confirmed quantity / actual billed quantity
1 / 10 / 1 / 3 / 5
1 / 10 / 2 / 2 / 5
But in fact, for Sales order/itm 1/10, we have only 5 PC billed, not 10.
When billed 5 PC, I want to despatch it to the Schedule line as 3, 2.
Regards,
Jeannie -
How to change the Quantity in the Credit Memo using BAPI
Hi All,
I have a requirement in which i need to change the Quantity Value field available in the Credit Memo using BAPI.
Can anyone help me out to get any available BAPI to perform this action or any Solution to change the Quantity in the Credit Memo ?.
Regards,
Muruganand.KHi,
Try using BAPI_SALESORDER_CHANGE.
DATA: s_order_header_in LIKE bapisdh1.
DATA: s_order_header_inx LIKE bapisdh1x.
DATA: BEGIN OF i_order_item_in OCCURS 0.
INCLUDE STRUCTURE bapisditm.
DATA: END OF i_order_item_in.
DATA: BEGIN OF i_order_item_inx OCCURS 0.
INCLUDE STRUCTURE bapisditmx.
DATA: END OF i_order_item_inx.
DATA: BEGIN OF it_return OCCURS 0.
INCLUDE STRUCTURE bapiret2.
DATA: END OF it_return.
DATA: BEGIN OF i_sched OCCURS 10.
INCLUDE STRUCTURE bapischdl.
DATA: END OF i_sched.
DATA: BEGIN OF i_schedx OCCURS 10.
INCLUDE STRUCTURE bapischdlx.
DATA: END OF i_schedx.
s_order_header_inx-updateflag = 'U'.
i_order_item_in-itm_number = vbap-posnr.
i_order_item_in-TARGET_QTY = rv45a-zzqty.
i_order_item_inx-updateflag = 'U'.
i_order_item_inx-itm_number = vbap-posnr.
i_order_item_inx-TARGET_QTY = 'X'.
APPEND: i_order_item_in, i_order_item_inx.
i_sched-itm_number = vbap-posnr.
i_sched-sched_line = '0002'.
i_sched-req_qty = rv45a-zzqty.
APPEND i_sched.
i_schedx-itm_number = vbap-posnr.
i_schedx-sched_line = '0002'.
i_schedx-updateflag = 'U'.
i_schedx-req_qty = 'X'.
APPEND i_schedx.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = xvbap-vbeln
order_header_in = s_order_header_in
order_header_inx = s_order_header_inx
behave_when_error = 'P'
TABLES
return = it_return
order_item_in = i_order_item_in
order_item_inx = i_order_item_inx
schedule_lines = i_sched
schedule_linesx = i_schedx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
Change the fields as per your logic before populating orders item and schedule line data.
You have to pass the quantity in schedule line items as well in case you want to change quanity in order.
KR Jaideep,
Edited by: Jaideep Sharma on Jun 22, 2009 7:35 PM -
'BAPI_SALESORDER_CHANGE - Want to change the Quantity on Line Item in SO
Hi
I am facing a problem. The requirement is to change the Sales Order Item Quantity. I basically planned to update the quantity of Schedule Item which needs to be changed. When I run the below code, it works and says the Sales Order changed succesfully. However I get an express message saying the Database update failure. I don't get any sort of technical information.
Appreciate if you could help me finding the error.
Thanks
regards
girish
Note --> I am trying to change the Quantity for 2 line item in SO '56' to 40 Units.
REPORT ZBAPI_SALESORD_CHANGE.
data : zBAPISDHD type /AFS/BAPISDHD,
zORDER_HEADER_INX TYPE /AFS/BAPISDHDX,
zSALESDOCUMENT type BAPIVBELN-VBELN.
data : zORDER_ITEMS_IN like /AFS/BAPISDITM occurs 0 with header line,
zORDER_ITEM_INX like /AFS/BAPISDITMX occurs 0 with header line,
zORDER_SCHEDULES_IN like /AFS/BAPISDSCHD occurs 0 with header line,
ZSCHEDULE_LINESX LIKE /AFS/BAPISDSCHDX occurs 0 with header line,
zORDER_PARTNERS like BAPIPARNR occurs 0 with header line,
zRETURN like BAPIRET2 occurs 0 with header line,
so_no type BAPIVBELN-VBELN,
zPARTNERCHANGES like BAPIPARNRC occurs 0 with header line.
data : l_comp_qty like zORDER_ITEMS_IN-COMP_QUANT.
data : g_qty like /AFS/BAPISDSCHD-REQ_QTY.
g_qty = 40.
l_comp_qty = 40.
clear : zBAPISDHD.
so_no = '0000000056'.
zBAPISDHD-REFOBJTYPE = '/AFS/ORDER'.
zBAPISDHD-SALES_ORG = 'BP01'.
zBAPISDHD-DISTR_CHAN = '02'.
zBAPISDHD-DIVISION = '01'.
zBAPISDHD-PMNTTRMS = '0001'.
zORDER_HEADER_INX-UPDATEFLAG = 'U'.
zORDER_HEADER_INX-SALES_ORG = 'X'.
zORDER_HEADER_INX-DISTR_CHAN = 'X'.
zORDER_HEADER_INX-DIVISION = 'X'.
zORDER_HEADER_INX-PMNTTRMS = 'X'.
**********ITEM ***************************************
zORDER_ITEMS_IN-ITM_NUMBER = '00020'.
zORDER_ITEMS_IN-MATERIAL = 'F1202'.
zORDER_ITEMS_IN-PLANT = 'BP01'.
zORDER_ITEMS_IN-ITEM_CATEG = 'TAS'.
zORDER_ITEMS_IN-SHIP_POINT = 'BP01'.
zORDER_ITEMS_IN-COMP_QUANT = l_comp_qty.
zORDER_ITEMS_IN-TARGET_QTY = l_comp_qty.
zORDER_ITEMS_IN-TARGET_QU = 'ST'.
append zORDER_ITEMS_IN.
zORDER_ITEM_INX-ITM_NUMBER = '00020'.
zORDER_ITEM_INX-UPDATEFLAG = 'U'.
zORDER_ITEM_INX-MATERIAL = 'X'.
zORDER_ITEM_INX-PLANT = 'X'.
zORDER_ITEM_INX-ITEM_CATEG = 'X'.
zORDER_ITEM_INX-SHIP_POINT = 'X'.
zORDER_ITEM_INX-COMP_QUANT = 'X'.
zORDER_ITEM_INX-TARGET_QTY = 'X'.
zORDER_ITEM_INX-TARGET_QU = 'X'.
append zORDER_ITEM_INX.
*********SCHEDULE LINE******************************
refresh zORDER_SCHEDULES_IN.
clear zORDER_SCHEDULES_IN.
zORDER_SCHEDULES_IN-ITM_NUMBER = '000020'.
zORDER_SCHEDULES_IN-SCHED_LINE = '0001'.
zORDER_SCHEDULES_IN-REQ_DATE = '20070525'.
zORDER_SCHEDULES_IN-DATE_TYPE = '1'.
zORDER_SCHEDULES_IN-SCHED_TYPE = 'CS'.
zORDER_SCHEDULES_IN-GRID_VALUE = 'BLK2728'.
zORDER_SCHEDULES_IN-REQ_CATEGORY = '1DE'.
zORDER_SCHEDULES_IN-REFOBJTYPE = '/AFS/ORDER'.
zORDER_SCHEDULES_IN-REQ_QTY = g_qty.
append zORDER_SCHEDULES_IN.
refresh ZSCHEDULE_LINESX.
clear ZSCHEDULE_LINESX.
ZSCHEDULE_LINESX-ITM_NUMBER = '000020'.
ZSCHEDULE_LINESX-SCHED_LINE = '0001'.
ZSCHEDULE_LINESX-UPDATEFLAG = 'U'.
ZSCHEDULE_LINESX-REQ_DATE = 'X'.
ZSCHEDULE_LINESX-DATE_TYPE = 'X'.
ZSCHEDULE_LINESX-SCHED_TYPE = 'X'.
ZSCHEDULE_LINESX-GRID_VALUE = 'X'.
ZSCHEDULE_LINESX-REQ_CATEGORY = 'X'.
ZSCHEDULE_LINESX-REFOBJTYPE = 'X'.
ZSCHEDULE_LINESX-REQ_QTY = 'X'.
append ZSCHEDULE_LINESX.
CALL FUNCTION '/AFS/BAPI_SALESORD_CHANGE'
EXPORTING
SALESDOCUMENT = so_no
ORDER_HEADER_IN = zBAPISDHD
ORDER_HEADER_INX = zORDER_HEADER_INX
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
TABLES
RETURN = zRETURN
ORDER_ITEM_IN = zORDER_ITEMS_IN
ORDER_ITEM_INX = zORDER_ITEM_INX
ORDER_SCHEDULE_LINES = zORDER_SCHEDULES_IN
ORDER_SCHEDULE_LINESX = ZSCHEDULE_LINESX.
PARTNERS =
PARTNERCHANGES = zPARTNERCHANGES
PARTNERADDRESSES =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
ORDER_TEXT =
ORDER_KEYS =
CONDITIONS_IN =
CONDITIONS_INX =
EXTENSIONIN =
*CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = so_no
ORDER_HEADER_IN = zBAPISDHD
ORDER_HEADER_INX = zORDER_HEADER_INX
TABLES
RETURN = zRETURN
ORDER_ITEM_IN = zORDER_ITEMS_IN
ORDER_ITEM_INX = zORDER_ITEM_INX
PARTNERS = zORDER_PARTNERS
PARTNERCHANGES = zPARTNERCHANGES
PARTNERADDRESSES =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
SCHEDULE_LINES = zORDER_SCHEDULES_IN
SCHEDULE_LINESX = ZSCHEDULE_LINESX.
ORDER_TEXT =
ORDER_KEYS =
CONDITIONS_IN =
CONDITIONS_INX =
EXTENSIONIN =
data : s_BAPIRET2 like BAPIRET2.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
importing
return = s_bapiret2.Hi,
Refer this code: Marked in bold
Get Line Item Details which are to be deleted
The line items fetched but not matching with ALV data
are the one which are copied from Reference Order
and should be deleted from our Sales Order
PERFORM get_line_item_details.
To get all the uploaded data
i_upload_2[] = i_upload[].
This is to be executed only if the SALES ORDER
IS CREATED WITH REFERENCE & User has selected
the record in ALV for Order Creation
LOOP AT i_upload INTO wa_upload_1
WHERE chkbx = 'X'
AND vbeln NE space.
MOVE wa_upload_1 TO wa_upload.
Clear Work Area/Local variables & Internal tables
CLEAR : l_sales_no,
l_item_number,
wa_header_in,
wa_header_inx,
wa_curr,
l_currency,
l_count,
l_counter.
REFRESH : i_cond,
i_cond_inx,
i_sch_in,
i_sch_inx,
i_items_in,
i_items_inx,
i_return,
i_partner_inx.
AT NEW seqno.
Get the Sales Order Number for corresponding record
READ TABLE i_result_all INTO wa_result_all WITH KEY
ref_no = wa_upload-vbeln
seqno = wa_upload-seqno.
IF sy-subrc EQ 0.
IF NOT wa_result_all-vbeln IS INITIAL.
l_sales_no = wa_result_all-vbeln.
ENDIF.
ELSE.
CONTINUE.
ENDIF.
READ TABLE i_curr INTO wa_curr
WITH KEY vbeln = l_sales_no.
Header Data
CLEAR wa_header_in.
wa_header_in-sales_org = wa_upload-vkorg.
wa_header_in-distr_chan = wa_upload-vtweg.
wa_header_in-division = wa_upload-spart.
wa_header_in-ref_doc = wa_upload-vbeln.
wa_header_in-ref_doc_l = wa_upload-vbeln.
wa_header_in-purch_no_c = wa_upload-bstnk.
CLEAR : wa_header_inx.
wa_header_inx-updateflag = 'U'.
wa_header_inx-sales_org = 'X'.
wa_header_inx-distr_chan = 'X'.
wa_header_inx-division = 'X'.
wa_header_inx-purch_no_c = 'X'.
Check Business Object
CLEAR : l_bus_object.
IF wa_upload-auart = 'ZY01' OR
wa_upload-auart = 'ZY07' OR
wa_upload-auart = 'ZY08' OR
wa_upload-auart = 'ZY09' OR
wa_upload-auart = 'ZY18' OR
wa_upload-auart = 'ZY94' .
l_bus_object = 'BUS2032'.
ELSEIF
wa_upload-auart = 'ZY10' OR
wa_upload-auart = 'ZY11' OR
wa_upload-auart = 'ZY27' OR
wa_upload-auart = 'ZY28' OR
wa_upload-auart = 'ZY92' OR
wa_upload-auart = 'ZY93'.
l_bus_object = 'BUS2102'.
ELSEIF
wa_upload-auart = 'ZY16' OR
wa_upload-auart = 'ZY30'.
l_bus_object = 'BUS2094'.
ELSEIF
wa_upload-auart = 'ZY17' OR
wa_upload-auart = 'ZY31'.
l_bus_object = 'BUS2096'.
ELSEIF
wa_upload-auart = 'ZY06' OR
wa_upload-auart = 'ZY26'.
l_bus_object = 'BUS2032'.
ENDIF.
*Populate Ship-to-party
IF NOT wa_upload-scode IS INITIAL.
CLEAR wa_partner_inx.
wa_partner_inx-document = l_sales_no.
wa_partner_inx-itm_number = '000000'.
wa_partner_inx-updateflag = 'U'.
wa_partner_inx-partn_role = c_we.
wa_partner_inx-p_numb_new = wa_upload-scode.
wa_partner_inx-refobjtype = l_bus_object.
APPEND wa_partner_inx TO i_partner_inx.
ENDIF.
Bill to Party
IF NOT wa_upload-bparty IS INITIAL.
CLEAR wa_partner_inx.
wa_partner_inx-document = l_sales_no.
wa_partner_inx-itm_number = '000000'.
wa_partner_inx-updateflag = 'U'.
wa_partner_inx-partn_role = c_re.
wa_partner_inx-p_numb_new = wa_upload-bparty.
wa_partner_inx-refobjtype = l_bus_object.
APPEND wa_partner_inx TO i_partner_inx.
ENDIF.
Payer
IF NOT wa_upload-payer IS INITIAL.
CLEAR wa_partner_inx.
wa_partner_inx-document = l_sales_no.
wa_partner_inx-itm_number = '000000'.
wa_partner_inx-updateflag = 'U'.
wa_partner_inx-partn_role = c_rg.
wa_partner_inx-p_numb_new = wa_upload-payer.
wa_partner_inx-refobjtype = l_bus_object.
APPEND wa_partner_inx TO i_partner_inx.
ENDIF.
Sales Rep
IF NOT wa_upload-salesrep IS INITIAL.
CLEAR wa_partner_inx.
wa_partner_inx-document = l_sales_no.
wa_partner_inx-itm_number = '000000'.
wa_partner_inx-updateflag = 'U'.
wa_partner_inx-partn_role = c_ys.
wa_partner_inx-p_numb_new = wa_upload-salesrep.
wa_partner_inx-refobjtype = l_bus_object.
APPEND wa_partner_inx TO i_partner_inx.
ENDIF.
Check condition type & unit price
For the following Document Types,
Condition Type & Unit Price are mandatory
CLEAR : l_item_number,
wa_upload_2.
LOOP AT i_upload_2 INTO wa_upload_2
WHERE seqno = wa_upload-seqno
AND chkbx = 'X'.
CLEAR : wa_cond,
wa_result.
Get the POSNR
PERFORM conv_alpha_input USING wa_upload_2-matnr
CHANGING wa_upload_2-matnr.
CLEAR : wa_items.
READ TABLE i_items INTO wa_items
WITH KEY vbeln = l_sales_no
matnr = wa_upload_2-matnr.
Check condition types
IF wa_upload_2-auart = 'ZY16' OR
wa_upload_2-auart = 'ZY17' OR
wa_upload_2-auart = 'ZY30' OR
wa_upload_2-auart = 'ZY31'.
If error, then update the output table
IF wa_upload_2-kschl IS INITIAL OR
wa_upload_2-kbetr IS INITIAL.
CLEAR : wa_result_all.
READ TABLE i_result_all INTO wa_result_all WITH KEY
ref_no = wa_upload_2-vbeln
mat_no = wa_upload_2-matnr
kwmeng = wa_upload_2-kwmeng
charg = wa_upload_2-charg
seqno = wa_upload_2-seqno
vbeln = l_sales_no.
IF sy-subrc EQ 0.
wa_result_all-status = 'E'. " E
wa_result_all-remarks = text-007. " Condition Type & Unit
Price is mandatory
MODIFY i_result_all FROM wa_result_all INDEX sy-tabix.
ENDIF.
CLEAR : wa_result_all.
CONTINUE.
Else update the condition type & unit price
ELSE.
wa_cond-itm_number = wa_items-posnr. " ITEM NO.
wa_cond-cond_type = wa_upload_2-kschl. " CNDTION TYPE
wa_cond-cond_value = wa_upload_2-kbetr. " UNIT PRICE
wa_cond-currency = wa_curr-waerk. " Currency
APPEND wa_cond TO i_cond.
CLEAR : wa_cond,
wa_upload_2.
ENDIF.
ELSE.
For other document type, fill Condition type & Unit Price
wa_cond-itm_number = wa_items-posnr. " ITEM NO.
wa_cond-cond_type = wa_upload_2-kschl. " CNDTION TYPE
wa_cond-cond_value = wa_upload_2-kbetr. " UNIT PRICE
wa_cond-currency = wa_curr-waerk.
APPEND wa_cond TO i_cond.
CLEAR : wa_cond,
wa_upload_2.
ENDIF.
CLEAR : wa_cond_inx.
wa_cond_inx-itm_number = wa_items-posnr.
wa_cond_inx-cond_type = wa_upload_2-kschl.
wa_cond_inx-cond_value = 'X'.
wa_cond_inx-currency = 'X'.
APPEND wa_cond_inx TO i_cond_inx.
CLEAR : wa_upload_2.
ENDLOOP.
DELETE Item Data from VBAP which has no matching entires in ALV
if SAME Material occurs more than once in ALV for same key then
count the no. of times the material occurs
CLEAR : wa_upload_3,
l_counter.
l_counter = 0.
LOOP AT i_upload_2 INTO wa_upload_3
WHERE seqno = wa_upload-seqno
AND chkbx = 'X'
AND matnr = wa_upload-matnr.
l_counter = l_counter + 1.
CLEAR : wa_upload_3.
ENDLOOP.
PERFORM conv_alpha_input USING wa_upload-matnr
CHANGING wa_upload-matnr.
check the corresponding no. of line items
for the above material
CLEAR : l_count,
wa_items.
LOOP AT i_items INTO wa_items
WHERE matnr = wa_upload-matnr
AND vbeln = l_sales_no.
CLEAR : wa_items_in,
wa_items_inx.
IF l_count GE l_counter.
wa_items_in-itm_number = wa_items-posnr.
wa_items_in-material = wa_items-matnr.
APPEND wa_items_in TO i_items_in.
CLEAR wa_items_inx.
wa_items_inx-itm_number = wa_items-posnr.
wa_items_inx-updateflag = 'D'. " Delete Record
wa_items_inx-material = 'X'.
APPEND wa_items_inx TO i_items_inx.
ENDIF.
l_count = l_count + 1.
ENDLOOP.
Convert material nos. to 18 digit no.
REFRESH : i_upload_3.
CLEAR : wa_upload_3.
i_upload_3[] = i_upload_2[].
LOOP AT i_upload_3 INTO wa_upload_3
WHERE seqno = wa_upload-seqno
AND chkbx = c_x.
PERFORM conv_alpha_input USING wa_upload_3-matnr
CHANGING wa_upload_3-matnr.
MODIFY i_upload_3 FROM wa_upload_3.
CLEAR : wa_upload_3.
ENDLOOP.
Delete materials which are not in ALV but are in line items
for that sales order
CLEAR : wa_upload_3,
wa_items_in,
wa_items.
LOOP AT i_items INTO wa_items WHERE vbeln = l_sales_no.
PERFORM conv_alpha_input USING wa_items-matnr
CHANGING wa_items-matnr.
READ TABLE i_upload_3 INTO wa_upload_3
WITH KEY matnr = wa_items-matnr.
IF sy-subrc NE 0.
wa_items_in-itm_number = wa_items-posnr.
wa_items_in-material = wa_items-matnr.
APPEND wa_items_in TO i_items_in.
CLEAR wa_items_inx.
wa_items_inx-itm_number = wa_items-posnr.
wa_items_inx-updateflag = 'D'. " Delete Record
wa_items_inx-material = 'X'.
APPEND wa_items_inx TO i_items_inx.
ENDIF.
CLEAR : wa_items,
wa_items_in,
wa_items_inx,
wa_upload_3.
ENDLOOP.
UPDATE Item Data RECORDS
CLEAR : wa_upload_2,
wa_items_in,
wa_items,
wa_items_inx,
wa_sch_in,
wa_sch_inx,
l_item_number.
LOOP AT i_upload_2 INTO wa_upload_2 WHERE
seqno = wa_upload-seqno
AND chkbx = 'X'.
Read the Material no. from ALV & check whether the
corresponding material exists in VBAP, if YES, then
Update the line item data
PERFORM conv_alpha_input USING wa_upload_2-matnr
CHANGING wa_items_in-material.
POPULATE ITEM NO -- Update the record
If line item has same material twice,
then appropriate POSNR should be assigned
READ TABLE i_items INTO wa_items
WITH KEY vbeln = l_sales_no
matnr = wa_items_in-material.
IF sy-subrc EQ 0.
If Reference is not contract then the process to assign
POSNR is as follows :- Check the corresponding material
from ALV with data from ITEMS, the record which matches
the data is selected & POSNR is assigned to it
IF wa_upload_2-oreason NE 'C'.
CLEAR : wa_items_in1.
READ TABLE i_items_in INTO wa_items_in1
WITH KEY material = wa_items_in-material
itm_number = wa_items-posnr.
IF sy-subrc EQ 0.
CLEAR : wa_items1.
LOOP AT i_items INTO wa_items1
WHERE vbeln = l_sales_no
AND matnr = wa_items_in-material.
IF wa_items1-posnr GT wa_items-posnr.
wa_items-posnr = wa_items1-posnr.
CLEAR : wa_items_in1.
READ TABLE i_items_in INTO wa_items_in1
WITH KEY material = wa_items_in-material
itm_number = wa_items-posnr.
IF sy-subrc NE 0.
EXIT.
ENDIF.
ENDIF.
CLEAR : wa_items1.
ENDLOOP.
ENDIF.
ELSE.
If Reference is CONTRACT then the process to assign
POSNR is different. Here if ALV has same material
twice & ITEMS has it once, then the second occurrence
of material of ALV is assigned a new POSNR
CLEAR : wa_items_in1,
l_insert.
READ TABLE i_items_in INTO wa_items_in1
WITH KEY material = wa_items_in-material
itm_number = wa_items-posnr.
IF sy-subrc EQ 0.
CLEAR : l_lines,
l_insert,
wa_items_in1.
DESCRIBE TABLE i_items_in LINES l_lines.
READ TABLE i_items_in INTO wa_items_in1 INDEX l_lines.
wa_items-posnr = wa_items_in1-itm_number + 10.
l_insert = 'X'.
CLEAR : wa_items_in1.
ENDIF.
ENDIF.
<b> wa_items_in-itm_number = wa_items-posnr.
wa_items_in-target_qty = wa_upload_2-kwmeng.
wa_items_in-target_qu = wa_items-zieme.
wa_items_in-store_loc = wa_upload_2-lgort.
wa_items_in-plant = wa_upload_2-werks.
wa_items_in-batch = wa_upload_2-charg.
wa_items_in-route = wa_upload_2-route.
wa_items_in-sales_unit = wa_upload_2-vrkme.
wa_items_in-short_text = wa_upload_2-maktx.
APPEND wa_items_in TO i_items_in.</b>
CLEAR wa_items_inx.
wa_items_inx-itm_number = wa_items-posnr.
IF l_insert EQ c_x.
wa_items_inx-updateflag = c_i. " Insert Record
ELSE.
wa_items_inx-updateflag = 'U'. " Update Record
ENDIF.
wa_items_inx-material = 'X'.
wa_items_inx-target_qty = 'X'.
wa_items_in-target_qu = 'X'.
wa_items_inx-store_loc = 'X'.
wa_items_inx-plant = 'X'.
wa_items_inx-batch = 'X'.
wa_items_inx-route = 'X'.
wa_items_inx-short_text = 'X'.
APPEND wa_items_inx TO i_items_inx.
ENDIF.
*Populate Ship-to-party
IF NOT wa_upload_2-scode IS INITIAL
AND l_insert IS INITIAL.
CLEAR wa_partner_inx.
wa_partner_inx-document = l_sales_no.
wa_partner_inx-itm_number = wa_items-posnr.
wa_partner_inx-updateflag = 'U'.
wa_partner_inx-partn_role = c_we.
wa_partner_inx-p_numb_new = wa_upload_2-scode.
wa_partner_inx-refobjtype = l_bus_object.
APPEND wa_partner_inx TO i_partner_inx.
ENDIF.
Bill to Party
IF NOT wa_upload_2-bparty IS INITIAL
AND l_insert IS INITIAL.
CLEAR wa_partner_inx.
wa_partner_inx-document = l_sales_no.
wa_partner_inx-itm_number = wa_items-posnr.
wa_partner_inx-updateflag = 'U'.
wa_partner_inx-partn_role = c_re.
wa_partner_inx-p_numb_new = wa_upload_2-bparty.
wa_partner_inx-refobjtype = l_bus_object.
APPEND wa_partner_inx TO i_partner_inx.
ENDIF.
Payer
IF NOT wa_upload_2-payer IS INITIAL
AND l_insert IS INITIAL.
CLEAR wa_partner_inx.
wa_partner_inx-document = l_sales_no.
wa_partner_inx-itm_number = wa_items-posnr.
wa_partner_inx-updateflag = 'U'.
wa_partner_inx-partn_role = c_rg.
wa_partner_inx-p_numb_new = wa_upload_2-payer.
wa_partner_inx-refobjtype = l_bus_object.
APPEND wa_partner_inx TO i_partner_inx.
ENDIF.
Sales Rep
IF NOT wa_upload_2-salesrep IS INITIAL
AND l_insert IS INITIAL.
CLEAR wa_partner_inx.
wa_partner_inx-document = l_sales_no.
wa_partner_inx-itm_number = wa_items-posnr.
wa_partner_inx-updateflag = 'U'.
wa_partner_inx-partn_role = c_ys.
wa_partner_inx-p_numb_new = wa_upload_2-salesrep.
wa_partner_inx-refobjtype = l_bus_object.
APPEND wa_partner_inx TO i_partner_inx.
ENDIF.
Populate schedule Line
CLEAR : l_datum,
wa_sch_in.
For following condition types, schedule lines not required
IF wa_upload_2-auart EQ 'ZY16' OR
wa_upload_2-auart EQ 'ZY17' OR
wa_upload_2-auart EQ 'ZY30' OR
wa_upload_2-auart EQ 'ZY31'.
ELSE.
wa_sch_in-itm_number = wa_items-posnr.
wa_sch_in-sched_line = '0001'.
wa_sch_in-req_qty = wa_upload_2-kwmeng.
IF NOT wa_upload_2-vdatu IS INITIAL.
REPLACE ALL OCCURRENCES OF '.' IN wa_upload_2-vdatu WITH ' '.
CONDENSE wa_upload_2-vdatu NO-GAPS.
CLEAR : l_datum.
l_datum = wa_upload_2-vdatu.
wa_sch_in-req_date = l_datum.
ENDIF.
APPEND wa_sch_in TO i_sch_in.
CLEAR wa_sch_inx.
wa_sch_inx-itm_number = wa_items-posnr.
wa_sch_inx-sched_line = '0001'.
IF wa_upload_2-oreason = 'C'.
wa_sch_inx-updateflag = c_i.
ELSE.
wa_sch_inx-updateflag = 'U'.
ENDIF.
wa_sch_inx-req_qty = 'X'.
wa_sch_inx-req_date = 'X'.
APPEND wa_sch_inx TO i_sch_inx.
ENDIF.
CLEAR : wa_upload_2,
wa_items_in,
wa_items,
wa_items_inx,
wa_sch_in,
wa_sch_inx.
ENDLOOP. "LOOP AT i_upload to wa_UPLOAD_2
Change Sales Order
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = l_sales_no
order_header_in = wa_header_in
order_header_inx = wa_header_inx
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
TABLES
return = i_return
order_item_in = i_items_in
order_item_inx = i_items_inx
partners = i_partner
partnerchanges = i_partner_inx
PARTNERADDRESSES =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
schedule_lines = i_sch_in
schedule_linesx = i_sch_inx
ORDER_TEXT =
ORDER_KEYS =
conditions_in = i_cond
conditions_inx = i_cond_inx
EXTENSIONIN =
COMMIT
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = ' '
IMPORTING
return = wa_commit.
WAIT UP TO 5 SECONDS.
Best regards,
Prashant -
My CS3/PS has started to change the cursor into a line of three VERY small icons when dragged over a picture or menu. Thus it is VERY difficult for instance to drag a layer in the layer list to the wastebasket - the cursor simply is too big for the waistebasket icon. Even all other exact work is impossible. Of course I have checked all the cursor presets but nothing seems to help. My OS is Windows7.
Have you tried resetting Preferences?
A logical next step would be to reset your Preferences.
To reset Preferences:
If Photoshop is already open on your screen, close it (Quit). Then hold down Shift+Ctrl+Alt (Win) / Shift+Command+Option (Mac) on your keyboard and start Photoshop.
A dialog box will pop up asking if you want to delete the existing Preferences file (the "Settings"). Click Yes in the dialog box. The existing Preferences file will be scrapped and a new one will be created. -
SA Schedule lines for requirements within PTF
Hello Gurus,
I have a question that you can surely help me with.
I have setup a scheduling agreement for a material, and with the source list setup the MRP now successfully generates schedule lines for all requirements that are outside of the planning time fence. However, if I put a requirement inside the planning time fence, then MRP does not create a schedule line just outside the PTF to cover that requirement, instead it creates a planned order just outside the PTF (or a purchase requisition if I change the "Create Purch. req." MRP control parameter).
Why does it not create a delivery schedule line? The validity of agreement is set to 1st of april, so it is defined will in the past. The target quantity on the scheduling agreement is well above the current scheduled quantity.
Thank you for any suggestions on this issue. I am sure it is just me who is being an MRP ignorant.Check the validity date of your Source List. It may be that it is outside the time frame of your requirements.
Try setting it up to say, January 1st of this year, see what happens.
Award points if useful. -
Manually Enter the Sales Order Schedule Line
Dear All,
I have a requirement where Sales Order will be created by Customer Service with Quantity and customer requested delivery date. Subsequently Planning department will go to the sales order schedule lines and enter manually the delivery date and confirmed quantity (multiple schedule lines) based on the stock/availability. They also need to do some changes in the shedule line if required. But when I try, the manually entered schedule lines are disappeared. Could any one advice how to set this up?
Thanks,
Regards,
VenkatHi Venkat
A schedule line gets grade out because this has been determined . through schedule line determination. . Now in the shipping data tab you can change the schedule line tab if you want . manually you can change the request delivery date also.
But it is not advisable to change the schedule line because again the affect of availability check will vary.
But can we know for what purpose you want to change the schedule line when you create the sales order. Any reason .For what purpose you are going for that customization ?For what purpose?
Regards
Srinath -
How to put schedule lines for one year in a schedule line agreement
dear all
thanks for the support till now from the forum
now i need some seetings by which the scheduling agreement will autoumatically take the schedule line for one year automatically
in my client we are getting open PO so
we have to make one agreement acording to that PO and thats for one year
and this one yr will have same quantity to be produced everyday
means 12nos of material every day for 12 month and this will be for every day
and as per that it should generate a sales order.i need to put schedule line automatically not mannually one by one for each date.so wat is the settingand how to reffer this scheduling agreement we can produce sales order.
please help
subrat
Message was edited by:
subrat pandaDear Subrat,
you cannot create a yearly schedule line in the scheduling agreement. It is not possible due to format restrictions of the date field. But what you can do is the follows (it is the modification, but it should work with the help of user-exits):
1. You can split the year schedule line to the monthly schedule lines. There are two ways to do it. If you apply the DELINS IDOC, then you can do it already during transfer of the data to the application (itr is the best way). Here you can use, for example, user-exit USEREXIT_ZUORDNEN_IDOCS (include LVED4FZZ) or customer function EXIT_SAPLVED4_002, called from the subroutine USEREXIT_DYNPRO (Include LVED4F0U). Alternatively, you can use the user-exit USEREXIT_MOVE_FIELD_TO_VBEP (Include MV45AFZZ) within the call transaction, then it will work also in the dialog case.
2. After getting the monthly schedule lines, you can create a planning delivery schedule, where you can split mothly schedule lines automatically to daily schedule lines according to the customer factory calender.The settings for generation of planning delivery schedules can be found under:
Customizing SPRO: Sales and Distribution => Sales => Sales Documents => Scheduling Agreements with Delivery schedules => Maintain Planning Delivery Sched. Instruct./Splitting Rules
It is the only ways, how you can reach your aim. I hope, this information will help you further.
Kind Regards,
Akmal Vakhidov
Development Support SD, SAP, Walldorf/Germany -
Schedule Lines for Sales BoM Material
Hi All,
When i trying to maintain the multiples schedule lines for the Sales BoM Material(Both Header and Item), system is not allowing to maintain it.Please guide me how to achieve this?Hi,
"Schedule Line allowed" is enabled at Item category. The Requirement is If we have multiple schedule lines for BoM Line Item, we are not able to maintain. Suppose the Order Quantity is 50 Units and we need schedule line of 10 Quantity each month. We are not able to maintain. System takes the complete 50 quantity and do the availability check and proposes the availablity Date. We are not able to maintain different schedules manually. -
I know that by default, schedule lines are not active for TATX (text) items in sales documents.
I'm also pretty sure that this option is not valid even if you activate it in the IMG.
Can anybody tell me:
1) Is my statement above correct ?
2) If so, why are schedule lines not allowed for TATX items.
3) Is there any way around this limitation ?Thanks for your input so far. Perhaps you'll be kind enouth to stick with me a little more.
Let me expalin what my user is doing:
In the IMG configuration of our system, schedule lines were activated for TATX item category, however it still does not work as expected.
User enters a quantity of deliverable product on line item 1 with item category of TAN.
User creates a delivery schedule for line item 1 using schedule lines (category CP).
For line item 2, user wants to send "DOCUMENTATION" for each schedule line.
"DOCUMENTATION" exists in our SAP system as a material master, but no stock exists.
User enters a quantity of DOCUMENTATION on line item 2 with item category TATX.
User creates delivery schedule for line item 2. (auto populates sched category CT).
When delivery is created, the first schedule line for both items works fine.
For subsequent deliveries, line item 1 continues to work, but the line item 2, DOCUMENTATION material does not show up.
I suspect that we are trying to use the TATX item category differently than it was intended, and that some other method would be a better fit for making deliveries of non-stocked material. -
Unable to enter multiple Schedule lines for BOM material in Sales Order
Hi All,
We have a Sales Order where in which we cannot add additional schedule lines for BOM material.
The schedule lines are greyed out, user was able to add schedule lines earlier.
I have checked all assignments in VOV6, VOV7 and everything seems to be fine and no changes have been made to item category being used.
Please provide a solution for this.
PFB link in which similar situation posted in this community but the final resolution method is not discussed.
http://scn.sap.com/message/13201504#13201504
Regards,
SamikshHi Samiksh,
Pls check for that particular customer, only complete delivery allowed(c) is set in the CMR or CMIR. If so, you can't enter multiple schedule lines for that customer.. it would be grayed out in the sales order schedule lines except confirmed line.
or check the problematic sales order at item level shipping tab if the par del/item is set to 'C'
With regards
S.Siva -
Multiple Schedule Lines for Individual Qty in Standard Order
Hello All,
I have a Client Requirement to Set up the Standard Order for a Material which will be sold on Single Quantity every Month.
This will have to occur from the same Order. For this Multiple Schedule Lines are required to be generated as per Monthly Delivery Schedule.
I know this functionality comes under Scheduling Agreements where we can deliver goods as per confirmed Schedule Lines for the Month.
But Client Requirement is to set up this functionality in Standard Order Only as setting up scheduling agreements calls for mapping of New Order Types which is not feasible.
So Can you provide with your valuable Inputs as to whether this can be possible through Standard Order in the system.
Looking forward to your esteemed reply!!
Warm Regards,
Onkar KhedekarDear Onkar:
If you don't want to use Schedule agreements, you can enter several schedule lines for each item in "Schedule line" tab at item level.
Enter in this tab each schedule line per month.
But be aware which date you enter becuase this requirement will be transfered to MRP.
Check it and revert.
Jose Antonio Martinez
Maybe you are looking for
-
Query String in URL policy?
Hi all, Is it possible in a policy agent to do these: 1- Filter requests with respect to the query string? i.e. = http://www.example.com/go?*allowed=yes* (Bear in mind, there might be other fields in the query string) 2- Is it possible to use query s
-
i tunes repeatedly asks for my password when i attempt to purchase a song/movie etc. anyone else have this issue?? the password works fine for everything except buying something....
-
Automate monitoring of inbound and outbound queues
Hi, I think It would be better to go for standard CCMS monitoring, if you dont have very specific requirements. Yes, we can easily sent out emails for CCMS alerts. You can either use the auto-reaction method CCMS_Send_Alert_to_ALM (Note 617547 - RZ2
-
We have a wrt54gs providing wireless access to our network. The wrt54gs supports 2 wireless users and two wired users. We also have 5 other people on the network but not using the wrt54gs. All users run a program on a remote server in a different
-
It appear some longitudinal lines on my screen Can I fix it or the touch is broken?