Problem in EXTENSIONIN parmeter of SD_SALESDOCUMENT_CHANGE
Hi all,
We are using SD_SALESDOCUMENT_CHANGE bapi to change the schedule agreement created. It is working fine with the normal fields and updating all the fields in the database tables.
Now, as per our requirement, we added 4 fields
Veh_num - char(15)
Depo_Code- numc(2)
Veh_type - char(5)
Shipment type - char(20)
in the VBEP table. We want to update this four fields also through same BAPI. For this, we appended our four fields in other four structures, namely, VBEPKOZ, VBEPKOZX, BAPE_VBEP, BAPE_VBEPX.
Then, in the EXTENSIONIN parameterin of bapi, we have passed the data for the two structures BAPE_VBEP and BAPE_VBEPX.
But the data is updated in the database table VBEP for the four fields added. Can some one please let me know how to get this done.
Thanks and Regards,
Avinash Bolisetty
How are you excatly passing the value to structure BAPIPAREX. Is it like as below? I had a similar problem and it was happening as the fields which were added to VBEPKOZ were at the end and thus were part of VALUEPART4 and somehow VALUEPART4 was not properly passed.
type: begin of t_ext,
valuepart1 type bapiparex-valuepart1,
valuepart2 type bapiparex-valuepart2,
valuepart3 type bapiparex-valuepart3,
valuepart4 type bapiparex-valuepart4,
end of t_ext.
data: wa_ext type t_ext,
wa_bapevbep type bape_vbep,
wa_bapiparex type bapiparex.
wa_ext = wa_bapevbep.
wa_bapiparex-STRUCTURE = 'BAPE_VBEP' .
wa_bapiparex-VALUEPART1 = wa_ext-valuepart1.
wa_bapiparex-VALUEPART2 = wa_ext-valuepart2.
wa_bapiparex-VALUEPART3 = wa_ext-valuepart3.
wa_bapiparex-VALUEPART4 = wa_ext-valuepart4.
append wa_bapiparex to i_bapiparex.
Cheers,
Shweta
Similar Messages
-
Problems in the EXTENSIONIN Parameter of BAPI_PO_CREATE1
Hello Experts,
I have a cfeild in the table EKKO and want to fill it.
I have try it over the EXTENSIONIN Parameter of BAPI_PO_CREATE1, but it doesn't work.
The strucurtes BAPI_TE_MEPOHEADER and BAPI_TE_MEPOHEADERX has also the required customerfields included
Some Ideas? why it doesn'works ?
Thanx in Advance
REPORT Z_BAPI_PO_CREATE1.
DATA: LS_POHEADER TYPE TABLE OF BAPIMEPOHEADER WITH HEADER LINE .
DATA: LS_POHEADERX TYPE TABLE OF BAPIMEPOHEADERX WITH HEADER LINE.
DATA: LT_RETURN type TABLE OF BAPIRET2.
DATA: LT_POITEM TYPE TABLE OF BAPIMEPOITEM WITH HEADER LINE.
DATA: LT_POITEMX type TABLE OF BAPIMEPOITEMX WITH HEADER LINE .
DATA: LT_ACCOUNT type TABLE OF BAPIMEPOACCOUNT WITH HEADER LINE .
DATA: LT_ACCOUNTX TYPE TABLE OF BAPIMEPOACCOUNTX WITH HEADER LINE .
DATA: LT_ADDRDELIV type BAPIMEPOADDRDELIVERY .
*********************Setze HEADER**************************
LS_POHEADER-DOC_TYPE = 'Z028'.
LS_POHEADER-CREAT_DATE = '01032006'.
LS_POHEADER-ITEM_INTVL = '00001'.
*LS_POHEADER-VENDOR = '0021000000'.
LS_POHEADER-SUPPL_PLNT = '4700' .
LS_POHEADER-PURCH_ORG = '2700' .
LS_POHEADER-PUR_GROUP = '701' .
LS_POHEADER-CURRENCY = 'EUR' .
APPEND LS_POHEADER .
*********************Setze HEADERX**************************
LS_POHEADERX-DOC_TYPE = 'X' .
LS_POHEADERX-CREAT_DATE = 'X' .
LS_POHEADERX-ITEM_INTVL = 'X' .
LS_POHEADERX-SUPPL_PLNT = 'X' .
*LS_POHEADERX-VENDOR = 'X' .
LS_POHEADERX-PURCH_ORG = 'X' .
LS_POHEADERX-PUR_GROUP = 'X' .
LS_POHEADERX-CURRENCY = 'X' .
APPEND LS_POHEADERX .
*********************Setze ITEMS**************************
LT_POITEM-PO_ITEM = '00001' .
LT_POITEM-MATERIAL = '023JK513' .
LT_POITEM-PLANT = '4700' .
LT_POITEM-STGE_LOC = '7001' .
LT_POITEM-QUANTITY = '1' .
LT_POITEM-PO_UNIT = 'PC' .
LT_POITEM-ACCTASSCAT = 'K' .
LT_POITEM-PERIOD_IND_EXPIRATION_DATE = 'D' .
APPEND LT_POITEM .
*********************Setze ITEMSX**************************
LT_POITEMX-PO_ITEM = '00001' .
LT_POITEMX-PO_ITEMX = 'X' .
LT_POITEMX-MATERIAL = 'X' .
LT_POITEMX-PLANT = 'X' .
LT_POITEMX-STGE_LOC = 'X' .
LT_POITEMX-QUANTITY = 'X' .
LT_POITEMX-PO_UNIT = 'X' .
LT_POITEMX-PERIOD_IND_EXPIRATION_DATE = 'X' .
LT_POITEMX-ACCTASSCAT = 'X' .
APPEND LT_POITEMX .
*********************Setze ACCOUNTPARAMETER**************************
LT_ACCOUNT-COSTCENTER = '1301000001' .
LT_ACCOUNT-PO_ITEM = '00001' .
APPEND LT_ACCOUNT .
LT_ACCOUNTX-COSTCENTER = 'X' .
LT_ACCOUNTX-PO_ITEM = '00001' .
APPEND LT_ACCOUNTX .
DATA: ls_bapi_te_po_header type BAPI_TE_MEPOHEADER,
ls_bapi_te_po_headerx type BAPI_TE_MEPOHEADERX,
ls_bapi_extension type BAPIPAREX,
it_bapi_extension type table of BAPIPAREX WITH HEADER LINE.
********************Setze EXTENSIONIN**************************
ls_bapi_extension-structure = 'BAPI_TE_MEPOHEADER' .
*ls_bapi_te_po_header-po_number = '' .
ls_bapi_te_po_header-cfield = '8204' .
ls_bapi_extension-valuepart1 = ls_bapi_te_po_header .
append ls_bapi_extension to it_bapi_extension .
clear ls_bapi_extension .
ls_bapi_extension-structure = 'BAPI_TE_MEPOHEADERX' .
*ls_bapi_te_po_header-po_number = '' .
ls_bapi_te_po_headerx-cfield = 'X' .
ls_bapi_extension-valuepart1 = ls_bapi_te_po_headerx .
append ls_bapi_extension to it_bapi_extension .
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
POHEADER = LS_POHEADER
POHEADERX = LS_POHEADERX
TABLES
RETURN = LT_RETURN
POITEM = LT_POITEM
POITEMX = LT_POITEMX
POACCOUNT = LT_ACCOUNT
POACCOUNTX = LT_ACCOUNTX
EXTENSIONIN = it_bapi_extension
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.Hello,
thank you for your response
The Problem was on the BADI below:
it wasn't implemented.
BAPI_PO_CREATE1->PERFORM move_data_in ->PERFORM move_extensionin->PERFORM move_container_in->CALL BADI lr_badi->map2i_extensionin
CALL BADI lr_badi->map2i_extensionin
EXPORTING
im_container = im_container
im_name = im_name
im_error = lf_exit
CHANGING
ch_struc = ch_struc.
Best Regards -
BAPI_PO_CHANGE Extensionin problem
Hi Experts,
i'm tryng to assign the structure bapi_te_mepoheader at extensionin in this way:
MOVE-CORRESPONDING pt_ifile TO s_bapi_te_mepoheader.
pt_extensionin-valuepart1 = s_bapi_te_mepoheader.
pt_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
but it return error: "pt_extensionin-valuepart1 and s_bapi_te_mepoheader are not mutually convertible in a Unicode program" so i tried with a concatenate:
CONCATENATE pt_ifile-ebeln wa_field-zzsaiso wa_field-zzsaisj ..[etc]...INTO valuepart RESPECTING BLANKS.
but the QUAN and CURR data field types give me problems of irregular shifting of fields.
How can i solve this problem?
thanks in advance,
Cosimo.Hi Cosimo,
Check like this and do for that bapi.
DATA: wa_extensionin TYPE bapiparex,
wa_bape_vbap TYPE bape_vbap,
wa_bape_vbapx TYPE bape_vbapx,
wa_bape_vbak TYPE bape_vbak,
wa_bape_vbakx TYPE bape_vbakx,
lv_posnr TYPE posnr.
Processing the header extension
CLEAR wa_bape_vbak.
wa_bape_vbak-ZZFIELD = 'TEST'.
wa_extensionin-structure = 'BAPE_VBAK'.
wa_extensionin+30(960) = wa_bape_vbak.
append wa_extensionin to lt_extensionin.
clear wa_extensionin.
Processing the line extension
LOOP AT line_items INTO wa_lineitems.
ADD 10 TO lv_posnr.
CLEAR wa_bape_vbap.
wa_bape_vbap-ZZFIELD = 'TET'.
wa_extensionin-structure = 'BAPE_VBAP'.
wa_bape_vbap-posnr = lv_posnr.
wa_extensionin+30(960) = wa_bape_vbap.
append wa_extensionin to lt_extensionin.
clear wa_extensionin.
CLEAR wa_bape_vbapx.
wa_bape_vbapx-ZZFIELD = 'X'.
wa_extensionin-structure = 'BAPE_VBAPX'.
wa_bape_vbapx-posnr = lv_posnr.
wa_extensionin+30(960) = wa_bape_vbapx.
append wa_extensionin to lt_extensionin.
clear wa_extensionin.
ENDLOOP.
Then the call to the BAPI
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = ls_order_header_in
order_header_inx = ls_order_header_inx
IMPORTING
salesdocument = lv_salesdocument
TABLES
return = lt_ret2
order_items_in = lt_order_items_in
order_items_inx = lt_order_items_inx
order_partners = lt_order_partners
order_keys = lt_order_keys
extensionin = lt_extensionin.
Note: If you have a need to force a different Business Object type or wish to see the extension return fields then use the function SD_SALESDOCUMENT_CREATE instead.
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
sales_header_in = ls_order_header_in
sales_header_inx = ls_order_header_inx
business_object = 'BUS2032'
IMPORTING
salesdocument_ex = lv_salesdocument
sales_header_out = lv_sales_header_out
sales_header_status = lv_sales_header_status
TABLES
return = lt_ret2
sales_items_in = lt_order_items_in
sales_items_inx = lt_order_items_inx
sales_partners = lt_order_partners
sales_keys = lt_order_keys
extensionin = lt_extensionin
incomplete_log = lt_incomplete_log
extensionex = lt_extensionex.
Check this i did for sales order.
Regards,
Madhu.
Moderator message: copy/pasted from previous discussions, please do not repeat, or your user ID might get deleted!
BAPI Enhancement
Edited by: Thomas Zloch on Sep 14, 2011 1:07 PM
Hi Thomas,
Hi,
Actually this code i got from erpgenie.com and i implemented that in my system.If there is any issue related to extension i am giving this code.This is not just copy and paste.I already answered related to extension three to four times.If it wrong giving code then it wont repeat.
Edited by: madhurao123 on Sep 14, 2011 5:03 PM -
Problem in MARA extension BAPI 'BAPI_MATERIAL_SAVEDATA' - EXTENSIONIN
Dear All,
Im trying to update Z fields in MARA using the BAPI 'BAPI_MATERIAL_SAVEDATA'
The appends to MARA & BAPI_TE_MARA are done.
There are lots of appends & it now exceeded 960 characters.
My Z fields are in the position 974 to 984.
EXTENSIONIN has 4 Value parts (VALUEPART1, VALUEPART2, VALUEPART3 & VALUEPART4) each of length char240.
So the Maximum Zextension updates possile are 240*4 = 960.
Please let me know update Z fields that are higher than 960.
Thanks in Advance.
Regards,
Prabhu Selvaraj.Hi Prabhu,
Can you please provide your code snippet ?
Regards
HM -
Problem in uploading multiple line items while Creating sales order by BAPI
Hi experts , Im able to create sales order with one item while using this program, but the problem is when iam having multiple items or multiple sales order , iam not able to createthe line items , though its creating sales order header , Iam copy pasting my code , please add the additional code to my code to take more than 1 line items ,This is urgent requirement . Points will be rewarded for answers , Thanks in advance
*& Report Z_SO_CREATE_BAPI
REPORT Z_SO_CREATE_BAPI.
DATA: i_header TYPE bapisdhd1 occurs 0 with header line.
DATA: i_details TYPE bapisditm OCCURS 0 WITH HEADER LINE.
DATA: i_partner TYPE bapiparnr OCCURS 0 WITH HEADER LINE.
DATA: i_return1 TYPE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: i_return2 TYPE bapiret2.
data : ORDER_HEADER_IN like BAPISDHD1.
data : ORDER_ITEMS_IN like BAPISDITM occurs 0 with HEADER LINE .
data : ORDER_ITEMS_INX Like BAPISDITMX occurs 0 with HEADER LINE .
data : RETURN like BAPIRET2 occurs 0 with header line.
data : ORDER_PARTNERS like BAPIPARNR occurs 0 with
header line.
DATA : ORDER_KEYS LIKE BAPISDKEY OCCURS 0 WITH HEADER
LiNE.
data : ORDER_SCHEDULES_IN like BAPISCHDL occurs 0 with
header line.
data : ORDER_SCHEDULES_INX like BAPISCHDLX occurs 0 with
header line.
data : BEGIN OF TAB OCCURS 0,
SRNO(4),
DOC_TYPE like ORDER_HEADER_IN-dOC_TYPE,
SALES_ORG LIKE ORDER_HEADER_IN-SALES_ORG,
DISTR_CHAN LIKE ORDER_HEADER_IN-DISTR_CHAN,
DIVISION like ORDER_HEADER_IN-DIVISION,
REQ_DATE_H(10),
PURCH_DATE(10),
PMNTTRMS LIKE ORDER_HEADER_IN-PMNTTRMS,
PURCH_NO_C LIKE ORDER_HEADER_IN-PURCH_NO_C,
ITM_NUMBER like BAPISDITM-ITM_NUMBER,
MATERIAL LIKE ORDER_ITEMS_IN-MATERIAL ,
PLANT LIKE ORDER_ITEMS_IN-PLANT,
TARGET_QTY LIKE ORDER_ITEMS_IN-TARGET_QTY,
ITM_NUMBERX like ORDER_ITEMS_INX-ITM_NUMBER ,
MATERIALX LIKE ORDER_ITEMS_INX-MATERIAL ,
CUST_MAT22 LIKE ORDER_ITEMS_IN-CUST_MAT22,
PLANTX LIKE ORDER_ITEMS_INX-PLANT,
TARGET_QTYX LIKE ORDER_ITEMS_INX-TARGET_QTY,
ITM_NUMBER LIKE ORDER_ITEMS_IN-ITM_NUMBER,
MATERIAL LIKE ORDER_ITEMS_IN-MATERIAL ,
PARTN_ROLE LIKE ORDER_PARTNERS-PARTN_ROLE,
PARTN_NUMB LIKE ORDER_PARTNERS-PARTN_NUMB,
END OF TAB.
DATA: v_vbeln TYPE bapivbeln-vbeln.
selection-screen begin of block b1 with frame.
skip 3.
parameter:p_infile like rlgrap-filename obligatory.
skip 3.
selection-screen end of block b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_infile.
PERFORM value_help.
start-of-selection.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_infile
FILETYPE = 'DAT'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = tab.
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
**Validation for the Create SO screen
*AT SELECTION-SCREEN ON BLOCK na_create.
Loop at Tab.
i_header-doc_type = TAB-DOC_TYPE .
i_header-sales_org = TAB-SALES_ORG.
i_header-distr_chan = TAB-DISTR_CHAN .
i_header-division = TAB-DIVISION .
append i_header.
*endloop.
i_partner-partn_role = TAB-PARTN_ROLE .
i_partner-partn_numb = TAB-PARTN_NUMB.
APPEND i_partner.
i_details-material = TAB-MATERIAL .
APPEND i_details.
endloop.
*Bapi for Creating SO
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN = v_vbeln
order_header_in = i_header
ORDER_HEADER_INX =
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
SALESDOCUMENT = v_vbeln
tables
RETURN = i_return1
ORDER_ITEMS_IN = i_details
ORDER_ITEMS_INX = ORDER_ITEMS_INX
order_partners = i_partner .
ORDER_SCHEDULES_IN =
ORDER_SCHEDULES_INX =
ORDER_CONDITIONS_IN =
ORDER_CONDITIONS_INX =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
ORDER_CCARD =
ORDER_TEXT =
ORDER_KEYS =
EXTENSIONIN =
PARTNERADDRESSES =
IF NOT v_vbeln IS INITIAL.
*Bapi Commit Work
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
return = i_return2
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
RETURN =
ENDIF.
LOOP AT i_return1 . "INTO wa_return1.
WRITE:/ i_return1-message.
ENDLOOP.
FORM value_help .
CALL FUNCTION 'DSVAS_DOC_WS_FILENAME_GET_50'
EXPORTING
DEF_FILENAME = ' '
DEF_PATH = ' '
MASK = ',.,..'
MODE = 'O'
TITLE = ' '
IMPORTING
FILENAME = p_infile
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.
txt file data
order type salesorg distch divison materialno parter role
TA PB01 01 00 000000000000000852 WE
Partner no
8101000000Hi Neerja,
you can reffer this sample code. It may not be complet soluation for your poblem,
but you will get some idea.
*& Report ZBAPI_SALESORDER_CREATE
*& Author : Karthik
REPORT ZBAPI_SALESORDER_CREATE.
data : ORDER_HEADER_IN like BAPISDHD1.
data : ORDER_ITEMS_IN like BAPISDITM occurs 0 with
header line.
data : RETURN like BAPIRET2 occurs 0 with header line.
data : ORDER_PARTNERS like BAPIPARNR occurs 0 with
header line.
DATA : ORDER_KEYS LIKE BAPISDKEY OCCURS 0 WITH HEADER
LINE.
data : ORDER_SCHEDULES_IN like BAPISCHDL occurs 0 with
header line.
data : BEGIN OF TAB OCCURS 0,
SRNO(4),
DOC_TYPE like ORDER_HEADER_IN-dOC_TYPE,
SALES_ORG LIKE ORDER_HEADER_IN-SALES_ORG,
DISTR_CHAN LIKE ORDER_HEADER_IN-DISTR_CHAN,
DIVISION like ORDER_HEADER_IN-DIVISION,
REQ_DATE_H(10),
PURCH_DATE(10),
PMNTTRMS LIKE ORDER_HEADER_IN-PMNTTRMS,
PURCH_NO_C LIKE ORDER_HEADER_IN-PURCH_NO_C,
ITM_NUMBER like BAPISDITM-ITM_NUMBER,
CUST_MAT22 LIKE ORDER_ITEMS_IN-CUST_MAT22,
PLANT LIKE ORDER_ITEMS_IN-PLANT,
TARGET_QTY LIKE ORDER_ITEMS_IN-TARGET_QTY,
PARTN_ROLE LIKE ORDER_PARTNERS-PARTN_ROLE,
PARTN_NUMB LIKE ORDER_PARTNERS-PARTN_NUMB,
END OF TAB.
data: itab1 like alsmex_tabline occurs 0 with header
line.
DATA: gd_currentrow type i.
data : PURCHASEORDER like ekko-ebeln.
Data: tot_rec type i, "Total Records
gd_update type i, "Main Table Increement Counter
gd_lines type i, "Success Table increement Counter
w_textout like t100-text. "VARIABLE TO GET ERRORLOG
data : begin of it_success occurs 0,
SALESDOCUMENT LIKE BAPIVBELN-VBELN, "PROJECT
end of it_success.
data : begin of it_error occurs 0,
srno(4),
err_msg(73) TYPE c, "TO RETREIVE ERROR MESSAGES
end of it_error.
data : srno(4).
DATA : SALESDOCUMENT LIKE BAPIVBELN-VBELN.
selection-screen begin of block b1 with frame.
skip 3.
parameter:p_infile like rlgrap-filename obligatory.
skip 3.
selection-screen end of block b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_infile.
PERFORM value_help.
start-of-selection.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_infile
i_begin_col = '1'
i_begin_row = '2' "Do not require
headings
i_end_col = '22'
i_end_row = '10000'
TABLES
intern = itab1
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message e010(zz) with text-001. "Problem uploading
Excel Spreadsheet
endif.
*perform open_group.
sort itab1 by row col.
Get first row retrieved
read table itab1 index 1.
Set first row retrieved to current row
gd_currentrow = itab1-row.
loop at itab1.
Reset values for next row
if itab1-row ne gd_currentrow.
append tab .
clear tab.
gd_currentrow = itab1-row.
endif.
SHIFT ITAB1-VALUE LEFT DELETING LEADING SPACE.
case itab1-col.
when '0001'.
TAB-SRNO = itab1-value.
when '0002'.
TAB-DOC_TYPE = itab1-value.
when '0003'.
TAB-SALES_ORG = itab1-value.
when '0004'.
TAB-DISTR_CHAN = itab1-value.
when '0005'.
TAB-DIVISION = itab1-value.
when '0006'.
TAB-REQ_DATE_H = itab1-value.
when '0006'.
TAB-PURCH_DATE = itab1-value.
when '0007'.
TAB-PMNTTRMS = itab1-value.
when '0008'.
TAB-PURCH_NO_C = itab1-value.
when '0009'.
TAB-ITM_NUMBER = itab1-value.
when '0010'.
TAB-CUST_MAT22 = itab1-value.
when '0011'.
TAB-PLANT = itab1-value.
when '0012'.
TAB-TARGET_QTY = itab1-value.
when '0013'.
TAB-PARTN_ROLE = itab1-value.
when '0014'.
TAB-PARTN_NUMB = itab1-value.
endcase.
endloop.
append tab.
clear tab.
sort tab by SRNO.
LOOP AT TAB.
concatenate tab-REQ_DATE_H+4(4)
tab-REQ_DATE_H2(2) tab-REQ_DATE_H0(2) into
tab-REQ_DATE_H.
concatenate tab-PURCH_DATE+4(4)
tab-PURCH_DATE2(2) tab-PURCH_DATE0(2) into
tab-PURCH_DATE.
SRNO = TAB-SRNO.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = tab-PARTN_NUMB
IMPORTING
OUTPUT = tab-PARTN_NUMB.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = tab-CUST_MAT22
IMPORTING
OUTPUT = tab-CUST_MAT22.
IF TAB-SRNO = SRNO.
ORDER_HEADER_IN-DOC_TYPE = TAB-DOC_TYPE.
ORDER_HEADER_IN-SALES_ORG = TAB-SALES_ORG.
ORDER_HEADER_IN-DISTR_CHAN = TAB-DISTR_CHAN.
ORDER_HEADER_IN-REQ_DATE_H = TAB-REQ_DATE_H.
ORDER_HEADER_IN-PURCH_DATE = TAB-PURCH_DATE.
ORDER_HEADER_IN-PMNTTRMS = TAB-PMNTTRMS.
ORDER_HEADER_IN-PURCH_NO_C = TAB-PURCH_NO_C.
ORDER_HEADER_IN-DIVISION = tab-DIVISION.
ORDER_ITEMS_IN-ITM_NUMBER = tab-ITM_NUMBER.
ORDER_ITEMS_IN-material = TAB-CUST_MAT22.
ORDER_ITEMS_IN-PLANT = TAB-PLANT.
APPEND ORDER_ITEMS_IN.
ORDER_PARTNERS-PARTN_ROLE = TAB-PARTN_ROLE.
ORDER_PARTNERS-PARTN_NUMB = TAB-PARTN_NUMB.
APPEND ORDER_PARTNERS.
ORDER_SCHEDULES_IN-ITM_NUMBER = tab-ITM_NUMBER.
ORDER_SCHEDULES_IN-REQ_QTY = tab-TARGET_QTY.
append ORDER_SCHEDULES_IN.
ENDIF.
AT END OF SRNO.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN =
ORDER_HEADER_IN = ORDER_HEADER_IN
ORDER_HEADER_INX =
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
SALESDOCUMENT = SALESDOCUMENT
TABLES
RETURN = RETURN
ORDER_ITEMS_IN = ORDER_ITEMS_IN
ORDER_ITEMS_INX =
ORDER_PARTNERS = ORDER_PARTNERS
ORDER_SCHEDULES_IN = ORDER_SCHEDULES_IN
ORDER_SCHEDULES_INX =
ORDER_CONDITIONS_IN =
ORDER_CONDITIONS_INX =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
ORDER_CCARD =
ORDER_TEXT =
ORDER_KEYS = ORDER_KEYS
EXTENSIONIN =
PARTNERADDRESSES =
IF SALESDOCUMENT <> SPACE.
commit work.
ADD 1 TO gd_update.
it_success-SALESDOCUMENT = SALESDOCUMENT.
append it_success.
CLEAR :SALESDOCUMENT,ORDER_HEADER_IN.
REFRESH : RETURN,ORDER_ITEMS_IN,ORDER_PARTNERS.
ELSE.
loop at return.
it_error-SRNO = tab-SRNO.
it_error-err_msg = return-MESSAGE .
Append it_error.
ENDLOOP.
CLEAR :SALESDOCUMENT,ORDER_HEADER_IN.
REFRESH : RETURN,ORDER_ITEMS_IN,ORDER_PARTNERS.
ENDIF.
endat.
endloop.
DESCRIBE TABLE it_success LINES gd_lines.
IF gd_lines GT 0.
Display result report column headings
PERFORM display_column_headings.
Display result report
PERFORM DISPLAY_SUCESS.
ENDIF.
IF SUCESS FAILS Display Error Report
DESCRIBE TABLE it_error LINES gd_lines.
IF gd_lines GT 0.
PERFORM errorheadings.
PERFORM errorreport.
ENDIF.
*& Form display_column_headings
text
FORM display_column_headings.
WRITE:2 ' Success Report '(014) COLOR COL_POSITIVE.
SKIP.
WRITE:2 'The following records inserted
successfully:'(013).
WRITE:/ sy-uline(15).
FORMAT COLOR COL_HEADING.
WRITE:/ sy-vline,
(10) 'Sales order'(004), sy-vline.
WRITE:/ sy-uline(15).
ENDFORM. "display_column_headings
*Subroutine to display SUCESS REPORT
FORM DISPLAY_SUCESS.
FORMAT COLOR COL_NORMAL.
LOOP AT it_success.
WRITE:/ sy-vline,
(10) it_success-SALESDOCUMENT, sy-vline.
CLEAR it_success.
ENDLOOP.
WRITE:/ sy-uline(15).
REFRESH: it_success.
FORMAT COLOR COL_BACKGROUND.
ENDFORM. "
DISPLAY_REPORT
*& Form errorreport
text
FORM errorreport.
LOOP AT it_error.
WRITE:/ sy-vline,
(10) it_error-SRNO, sy-vline,
(40) it_error-err_msg, sy-vline.
ENDLOOP.
WRITE:/ sy-uline(104).
REFRESH: it_error.
endform. "errorreport
*& Form ERRORHEADINGS
text
FORM ERRORHEADINGS.
SKIP.
WRITE:2 ' Error Report '(007) COLOR COL_NEGATIVE.
SKIP.
WRITE:2 'The following records failed during
update:'(008).
WRITE:/ sy-uline(104).
FORMAT COLOR COL_HEADING.
WRITE:/ sy-vline,
(10) 'ERROR.'(009), sy-vline.
WRITE:/ sy-uline(104).
FORMAT COLOR COL_NORMAL.
ENDFORM. "ERRORHEADINGS
**& Form value_help
text
--> p1 text
<-- p2 text
FORM value_help .
CALL FUNCTION 'DSVAS_DOC_WS_FILENAME_GET_50'
EXPORTING
DEF_FILENAME = ' '
DEF_PATH = ' '
MASK = ',.,..'
MODE = 'O'
TITLE = ' '
IMPORTING
FILENAME = p_infile
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. "value_help
Regards,
Amit. -
FM SD_SALESDOCUMENT_CREATE - pricing condition problem
Hello,
I hope someone could help me on this one:
First of all, my SAP version is 4.6c.
I've been developing a program that will create a sales contract using FM SD_SALESDOCUMENT_CREATE. Overall, the sales contract is being created successfully.
However, in the item pricing, the pricing condition that I need to create is being duplicated. I understand that in the pricing procedure the particular condition is being inserted automatically. The problem is, instead of the FM updating the default inserted pricing condition, it's inserting the one being passed.
I've already done a little research through the forums. I've tried [this|SD_SALESDOCUMENT_CREATE with Pricing Condition; suggestion where I create first the document then update it using SD_SALESDOCUMENT_CHANGE. There is also [this suggestion|SD_SALESDOCUMENT_CREATE - Duplicate sales conditions; that sets the field LOGIC_SWITCH-COND_HANDL, but my version does not have that field.
Finally, there's [this suggestion|http://www.sapfans.com/forums/viewtopic.php?f=13&t=218865&start=0&st=0&sk=t&sd=a] that sets the field LOGIC_SWITCH-PRICING to a particular value. I tried the initially suggested value of 'G' - Copy pricing elements unchanged and redetermine taxes. The duplicate condition no longer occurs, but other pricing conditions were removed. Using other values resulted in either the contract creation failing, or the condition value not updating.
So, please please can anyone help with my problem? Thank you in advance.SALES_CONDITIONS_IN
ITM_NUMBER 000010
COND_ST_NO 020
COND_COUNT 01
COND_TYPE YB05
COND_VALUE 10.000000000
CURRENCY TWD
SALES_CONDITIONS_INX
ITM_NUMBER 000010
COND_ST_NO 020
COND_COUNT 01
COND_TYPE YB05
UPDATEFLAG U
COND_VALUE X
CURRENCY X
IF the condition is being inserted automatically,you must update it.
some import parameters are obligatory,including COND_ST_NO COND_COUNT. -
Problem in Material create through BAPI
Hi All,
For creating MATERIAL first used BAPI_MATERIAL_GETINTNUMBER for material no generation and for creation material master BAPI_MATERIAL_SAVEDATA.
<garbled code removed>
Moderator message: Post relevant portions of the code only!
My problem is material no is not created and passing into second bapi.
Help me out of this
Edited by: Suhas Saha on Jun 17, 2011 8:01 PMHi Venkatesh,
*Use This Bapi :BAPI_MATERIAL_SAVEREPLICA and pass values as mentioned below.*
Use this method to create new material master data or change existing material master data. Every time this method is called, data for one or more materials can be transferred.
When new material master data is created, the material number, the material type and the sector must be sent to the method. Furthermore, a short text and the language in which the short text has been created, have to be entered. When data is being changed, only the material number need be entered.
In the header data, at least one view has to be selected for which the data is to be created. Depending on the selected view, additional mandatory parameters that have been defined as such in Customizing have to be created. If not all mandatory fields are field with data, the method ends with an error message being displayed.
First, the appropriate fields in the tables (for example, CLIENTDATA) have to be filled with data by the user. These fields must also be flagged as the method data can only be written to the database if this is the case. The user must also provide data for the appropriate fields that have been selected in a checkbox table (for example, CLIENTDATAX). Checkbox tables exist for tables that do not contain language-dependent texts (MAKT, MLTX), European article numbers (MEAN) and tax classifications (MLAN). More than one data record can be created for a material in these tables (for all materials transferred to the method).
If a structure contains fields for a unit of measure (for example, structure CLIENTDATA, field BASE_UOM), language indicator (for example, structure MATERIALDESCRIPTION, field LANGU) or country identifier (for example, structure TAXCLASSIFICATIONS, field DEPCOUNTRY) then a similarly-named field ending with _ISO also exists. In doing so, the user has the option of using the internal SAP code or the ISO code for units of measure, language indicators or country identifiers. ISO codes are converted into an SAP code for further processing. The ISO code is only used if the SAP code is not displayed. In Customizing under "General Settings", a clear assignment has to be made between the ISO codes and the SAP codes for the following activities, if you want to use ISO codes:
If a structure contains fields for units of measurement (such as structure CLIENTDATA, field BASE_UOM), language indicators (such as structure MATERIALDESCRIPTION, field LANGU), or country indicators (such as structure TAXCLASSIFICATIONS, field DEPCOUNTRY), there is always a field of the same name with the ending _ISO. This makes it possible to transfer either the internally used SAP code or a standardized ISO code for the units of measurement, language indicators, or country indicators. ISO codes are converted to an SAP code internally for further processing. The ISO code is used only if the SAP code is not transferred. If you use ISO codes, there must be a unique assignment of the ISO code to the SAP code in the following activities in Customizing for Global Parameters:
Check Units of Measurement
Define Countries
If long texts (for example, basic data texts, internal notes, purchasing info texts, material notes or sales and distribution texts) or customer-specific fields have to be created for a material, some specific characteristics have to be taken into consideration. These characteristics are detailed in the documentation for parameters MATERIALLONGTEXT and EXTENSIONIN. -
PO BAPI Problem in condition types
Hi,
I am facing a strange problem in creation of PO through "BAPI_PO_CREATE1".
In the Item condition internal table, I am passing the condition types.
The PO is getting created successfully.
Eg. I pass conditions and their values as follows:
PB00 : 1000
ZB00 : 1000
FRB1 : 1000
The PO is created successfully and we can check the prices updated properly.
Now,
When I create a second PO with the same values, the prices are taken from the last PO and the prices from
my code(which are passed through BAPI) are added to the last value.
If I run the program with the same values as above, the PO is created with the values 2000.
Third time it is 3000 and so.
The value from the last PO is coming into the new PO.
Please advise me if anything missing.
My code is below::
================
*& Report ZTEST_PO
REPORT ZTEST_PO.
data : HEADER like BAPIMEPOHEADER .
data : HEADERX like BAPIMEPOHEADERX .
data : POITEM like BAPIMEPOITEM occurs 0 with header line.
data : POITEMX like BAPIMEPOITEMX occurs 0 with header line.
data : POSCHEDULE like BAPIMEPOSCHEDULE occurs 0 with header line.
data : POSCHEDULEX like BAPIMEPOSCHEDULX occurs 0 with header line.
DATA : RET LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
DATA : ret1 like bapiret2.
Data PO like BAPIMEPOHEADER-PO_NUMBER.
data : pocond like BAPIMEPOCOND occurs 0 with header line.
data : pocondx like BAPIMEPOCONDX occurs 0 with header line.
*pocond-CONDITION_NO = '00000'.
pocond-itm_number = '000010'.
pocond-COND_ST_NO = '001' .
*pocond-COND_COUNT = '1'.
pocond-COND_TYPE = 'PB00'.
pocond-COND_value = '500'.
pocond-CURRENCY = 'EUR'.
pocond-CURRENCY_ISO = 'EUR'.
pocond-CHANGE_ID = 'I'.
APPEND POCOND.
**pocond-CONDITION_NO = '00000'.
*pocond-itm_number = '000010'.
*pocond-COND_ST_NO = '10' .
*pocond-COND_COUNT = '2'.
*pocond-COND_TYPE = 'PBXX'.
*pocond-COND_value = '555'.
*pocond-CURRENCY = 'EUR'.
*pocond-CURRENCY_ISO = 'EUR'.
*pocond-CHANGE_ID = 'U'.
*APPEND POCOND.
**pocond-CONDITION_NO = '00000'.
*pocond-itm_number = '000010'.
*pocond-COND_ST_NO = '20' .
*pocond-COND_COUNT = 0.
*pocond-COND_TYPE = 'ZB00'.
*pocond-COND_value = '666'.
*pocond-CURRENCY = 'EUR'.
*pocond-CHANGE_ID = 'U'.
*APPEND POCOND.
**pocond-CONDITION_NO = '00000'.
*pocond-itm_number = '000010'.
*pocond-COND_ST_NO = '30' .
*pocond-COND_COUNT = 0.
*pocond-COND_TYPE = 'FRB1'.
*pocond-COND_value = '777'.
*pocond-CURRENCY = 'EUR'.
*pocond-CHANGE_ID = 'U'.
*APPEND POCOND.
*pocondx-CONDITION_NO = '00000'.
POCONDX-ITM_NUMBER = '000010'.
POCONDX-COND_ST_NO = '000'.
*POCONDX-CONDITION_NOX = 'X'.
*POCONDX-COND_ST_NOX = 'X'.
POCONDX-ITM_NUMBERX = 'X'.
*POCONDX-COND_COUNT = 'X'.
POCONDX-COND_TYPE = 'X'.
POCONDX-COND_value = 'X'.
pocondX-CURRENCY = 'X'.
*pocondX-CURRENCY_ISO = 'X'.
pocondX-CHANGE_ID = 'X'.
APPEND POCONDX.
HEADER-COMP_CODE = 'TF01'.
HEADER-DOC_TYPE = 'DMPO'.
HEADER-VENDOR = '0000000317'.
HEADER-LANGU = 'EN'.
HEADER-PURCH_ORG = '1001'.
HEADER-PUR_GROUP = '110'.
HEADER-CURRENCY = 'EUR'.
HEADER-DOC_DATE = '22.10.2007'.
HEADER-REF_1 = '999999999999'.
HEADERX-VENDOR = 'X'.
HEADERX-PURCH_ORG = 'X'.
HEADERX-PUR_GROUP = 'X'.
HEADERX-REF_1 = 'X'.
POITEM-PO_ITEM = '00010'.
POITEM-MATERIAL = '00042199730L'.
POITEM-PLANT = '1000'.
POITEM-STGE_LOC = '1030'.
POITEM-MATL_GROUP = '01'.
POITEM-QUANTITY = '10'.
POITEM-PRICE_UNIT = 500.
poitem-calctype = 'C'.
append POITEM.
POITEMX-PO_ITEM = '00010'.
POITEMX-MATERIAL = 'X'.
POITEMX-PLANT = 'X'.
POITEMX-QUANTITY = 'X'.
POITEMX-PRICE_UNIT = 'X'.
append POITEMX.
POSCHEDULE-PO_ITEM = '00010'.
POSCHEDULE-DELIVERY_DATE = '30.10.2007'.
append POSCHEDULE.
POSCHEDULEX-PO_ITEM = '00010'.
POSCHEDULEX-PO_ITEMX = 'X'.
POSCHEDULEX-DELIVERY_DATE = 'X'.
append POSCHEDULEX.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = HEADER
POHEADERX = HEADERX
POADDRVENDOR =
TESTRUN =
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
NO_MESSAGING =
NO_MESSAGE_REQ =
NO_AUTHORITY =
NO_PRICE_FROM_PO =
IMPORTING
EXPPURCHASEORDER = PO
EXPHEADER =
EXPPOEXPIMPHEADER =
TABLES
RETURN = RET
POITEM = POITEM
POITEMX = POITEMX
POADDRDELIVERY =
POSCHEDULE = POSCHEDULE
POSCHEDULEX = POSCHEDULEX
POACCOUNT =
POACCOUNTPROFITSEGMENT =
POACCOUNTX =
POCONDHEADER = POCOND
POCONDHEADERX = POCONDX
POCOND = POCOND
POCONDX = POCONDX
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
POPARTNER =
POCOMPONENTS =
POCOMPONENTSX =
POSHIPPING =
POSHIPPINGX =
POSHIPPINGEXP =
NFMETALLITMS =
if RET-type NE 'E'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = ret1.
write : ' PO Created : ', PO .
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
RETURN = ret1.
ENDIF.
================Any input??
-
Problem while changing Sales order using 'BAPI_SALESORDER_CHANGE'
Hi all,
Below is my code to update delivery block value:
FORM call_bapi_salesorder_change .
DATA: iv_bapi_view LIKE order_view.
DATA: gt_sales_doc TYPE STANDARD TABLE OF sales_key, " Document Numbers to Be Selected
gt_items TYPE STANDARD TABLE OF bapisdit. " Order Item Data for Document Numbers
*************************************************************8
DATA:order_headers_out LIKE bapisdhd OCCURS 0 WITH HEADER LINE.
DATA:order_header_inx LIKE bapisdh1x.
DATA: lv_salesdocument LIKE bapivbeln-vbeln.
data: lv_matnr(10) type c.
DATA:
gt_schdule TYPE STANDARD TABLE OF bapischdl, " for gl date & load date
gt_schdulex TYPE STANDARD TABLE OF bapischdlx, " for partner role and partner function.
gt_return TYPE STANDARD TABLE OF bapiret2,
gt_itemin TYPE STANDARD TABLE OF bapisditm,
gt_iteminx TYPE STANDARD TABLE OF bapisditmx ,
gt_bapisdh1 TYPE STANDARD TABLE OF bapisdh1.
DATA:gs_head_bapi TYPE bapisdh1x,
gs_schdule TYPE bapischdl,
gs_schdulex TYPE bapischdlx,
gs_return TYPE bapiret2,
gs_itemin TYPE bapisditm,
gs_iteminx TYPE bapisditmx,
gs_bapisdh1 TYPE bapisdh1.
CLEAR : gt_schdule,gt_schdulex,gs_return.
REFRESH gt_return.
gs_head_bapi-updateflag = 'U'.
SORT gt_final BY vbeln.
CLEAR gs_vbep.
REFRESH gt_vbep[].
CLEAR gs_final.
LOOP AT gt_final1 INTO gs_final.
gs_itemin-itm_number = gs_final-posnr.
*move gs_final-matnr to lv_matnr."qx94162
gs_itemin-material = gs_final-matnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = gs_final-matnr
IMPORTING
output = gs_final-matnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_matnr
IMPORTING
output = lv_matnr.
gs_itemin-material = lv_matnr.
gs_itemin-material = gs_final-matnr.
gs_iteminx-itm_number = gs_final-posnr.
gs_iteminx-updateflag = 'U'.""changed to I
gs_iteminx-material = 'X'.
" gs_schdule-req_dlv_bl = gs_final-lifsp. " Delivery block
gs_schdule-itm_number = gs_final-posnr.
gs_schdulex-itm_number = gs_final-posnr.
gs_schdule-sched_line = '0001'.
gs_schdulex-sched_line = '0001'.
MOVE gs_final-lifsp to gs_schdule-req_dlv_bl.
gs_schdule-req_dlv_bl = gs_final-lifsp.
gs_schdulex-req_dlv_bl = 'X'. " Delivery block
gs_schdulex-updateflag = 'U'.
gs_bapisdh1-sales_org = gs_final-vkorg.
APPEND gs_schdule TO gt_schdule.
APPEND gs_schdulex TO gt_schdulex.
APPEND gs_itemin TO gt_itemin.
APPEND gs_iteminx TO gt_iteminx.
Append gs_BAPISDH1 to gt_BAPISDH1.
lv_salesdocument = gs_final-vbeln.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = lv_salesdocument
ORDER_HEADER_IN = gs_BAPISDH1
order_header_inx = gs_head_bapi
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
NO_STATUS_BUF_INIT = ' '
TABLES
return = gt_return
order_item_in = gt_itemin
order_item_inx = gt_iteminx
PARTNERS =
PARTNERCHANGES =
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 = gt_schdule
schedule_linesx = gt_schdulex
ORDER_TEXT =
ORDER_KEYS =
CONDITIONS_IN =
CONDITIONS_INX =
EXTENSIONIN =
NFMETALLITMS =
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
REFRESH: gt_schdule, gt_schdulex, gt_itemin , gt_iteminx.
LOOP AT gt_return INTO gs_return.
WRITE / gs_return-message .
ENDLOOP .
ENDLOOP.
ENDFORM. " CALL_BAPI_SALESORDER_CHANGE
When I am using material value as 18342 using CONVERSION_EXIT_ALPHA_OUTPUT:
ORDER_HEADER_IN has been processed successfully
Material is not defined for sales org.A101, distr.chan.00, language DE
Error in ITEM_IN 000030
SCHEDULE_IN has been processed successfully
The sales document is not yet complete: Edit data
Sales document 5010000715 was not changed
and when I am using CONVERSION_EXIT_ALPHA_INPUT (000000000000018342)or while debuging when I am changing value to 0018342 :
I am getting below dump:
Runtime Errors DATA_LENGTH_0
Exception CX_SY_RANGE_OUT_OF_BOUNDS
Date and Time 21.10.2010 07:22:17
Information on where terminated
Termination occurred in the ABAP program "SAPLVBAK" - in
"MAP_VBAP_TO_BAPISDIT".
The main program was "RS_TESTFRAME_CALL ".
In the source code you have the termination point in line 168
of the (Include) program "LVBAK001".
The termination is caused because exception "CX_SY_RANGE_OUT_OF_BOUNDS"
occurred in
procedure "MAP_VBAP_TO_BAPISDIT" "(FORM)", but it was neither handled local
nor declared
in the RAISING clause of its signature.
The procedure is in program "SAPLVBAK "; its source code begins in line
99 of the (Include program "LVBAK001 ".
The same dump I am getting while executing this above BAPI from SE37 tcode with the same test data.
but I am able to change it though Va02 tcode.
Edited by: Arora26 on Oct 21, 2010 7:58 AMHi,
have you searched for OSS notes? The note 1137897 looks like related to your problem. It mentions different BAPI but I assume that both BAPI reuse same routines and therefore it might solve your problem as well.
Cheers -
Problem in pricing conditions are not updated in BAPI_SAG_CHANGE
Hallo Friends,
we have faced the one problem with the standard bapi *BAPI_SAG_CHANGE.
we have passed the 10 item level data to the BAPI_SAG_CHANGE , the bapi BAPI_SAG_CHANGE successfully updated the 10 item level data to the schedule agreement .
the problem is pircing condtions are not updated succesfully for the each items in the schedule agreement.
please suggest the good solution.
thanks
kumarHi jons,
Thanks for respoding my request, Please find my below code lines
CALL FUNCTION 'BAPI_SAG_CHANGE'
EXPORTING
purchasingdocument = st_header-number
header = st_header
headerx = st_headerx
VENDOR_ADDRESS =
HEAD_EXPORT_IMPORT =
HEAD_EXPORT_IMPORTX =
TESTRUN =
TECHNICAL_DATA =
IMPORTING
EXP_HEADER =
EXP_HEAD_EXPORT_IMPORT =
TABLES
return = st_return
Begin of modify by kirankumar 07/12/2009
item = st_item
item = st_item[]
End of modify by kirankumar 07/12/2009
itemx = st_itemx[]
account = st_account
accountprofitsegment = st_accountprofitsegment
accountx = st_accountx
schedule = st_schedule
schedulex = st_schedulex
sc_component = st_sc_component
sc_componentx = st_sc_componentx
shipping = st_shipping[]
shippingx = st_shippingx[]
shipping_exp = st_shipping_exp
delivery_address = st_delivery_address
item_cond_validity = st_item_cond_validity[]
item_cond_validityx = st_item_cond_validityx[]
item_condition = st_item_condition[]
item_conditionx = st_item_conditionx[]
item_cond_scale_value = st_item_cond_scale_value
item_cond_scale_quan = st_item_cond_scale_quan
export_import = st_export_import
export_importx = st_export_importx
item_text = st_item_text
header_text = st_header_text
head_cond_validity = st_head_cond_validity
head_cond_validityx = st_head_cond_validityx
head_condition = st_head_condition
head_conditionx = st_head_conditionx
head_cond_scale_val = st_head_cond_scale_val
head_cond_scale_quan = st_head_cond_scale_quan
partner = st_partner[]
partnerx = st_partnerx[]
extensionin = st_extensionin
extensionout = st_extensionout. -
Hi All,
Because of your help I am doing small application and I am new in xml I gets small small problem and by the your help i cam solve it.
Now i have last problem when i solve it then my tool gets complete. I have attached small code of it and its working. The problem is when i fill one methods parameter information its comes in all methods. Which is wrong.
I want output like:
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<name>the name of package</name>
<className>The name of class</className>
<methods>
<name>the name of the method</name>
<invokeKind/>
<returnType>the return type of the method</returnType>
<optionalParameters/>
<parameters>
<name>Param1</name>
<type>Void</type>
</parameters>
</methods>
<methods>
<name>the name of the method22</name>
<returnType>the return type of the method22</returnType>
<parameters/>
</methods>
</interface>But output comes like
<?xml version="1.0" encoding="UTF-8"?><interface>
<name>the name of package</name>
<className>The name of class</className>
<methods>
<name>the name of the method</name>
<invokeKind/>
<returnType>the return type of the method</returnType>
<optionalParameters/>
<parameters>
<name>Param1</name>
<type>Void</type>
</parameters>
</methods>
<methods>
<name>the name of the method22</name>
<returnType>the return type of the method22</returnType>
<parameters>
<name>Param1</name>
<type>Void</type>
</parameters>
</methods>
</interface>
I have not given parameter in second method but given in first method but replicates in second thats y i am stucked,
Please help me.
Code is ::
import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Node;
public class TryXML
public static void main(String args[])
try
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
Document methoddoc = parser.parse(new File("methodinfo.xml"));
Document packageDoc = parser.parse(new File("interface.xml"));
//***Package information
Node packagenameNode = packageDoc.getElementsByTagName("name").item(0);
Node packageclassNode = packageDoc.getElementsByTagName("className").item(0);
packagenameNode.setTextContent("the name of package");
packageclassNode.setTextContent("The name of class");
//***First method information
Node nameNode = methoddoc.getElementsByTagName("name").item(0);
Node returnTypeNode = methoddoc.getElementsByTagName("returnType").item(0);
nameNode.setTextContent("the name of the method");
returnTypeNode.setTextContent("the return type of the method");
//**Parameter Informtion of this method.
Document parameterDoc = parser.parse(new File("parameter.xml"));
Node paramnameNode = parameterDoc.getElementsByTagName("name").item(0);
Node paramreturnTypeNode = parameterDoc.getElementsByTagName("type").item(0);
paramnameNode.setTextContent("Param1");
paramreturnTypeNode.setTextContent("Void");
//***adding parameter information into method.
Node methodaddnode = methoddoc.importNode(parameterDoc.getDocumentElement(), true);
DocumentFragment docfrag = methoddoc.createDocumentFragment();
//***Move the nodes into the fragment
while (methodaddnode.hasChildNodes())
docfrag.appendChild(methodaddnode.removeChild(methodaddnode.getFirstChild()));
Node paramNode = methoddoc.createElement("parameters");
methoddoc.getDocumentElement().appendChild(paramNode);
paramNode.appendChild(docfrag);
//***adding first methode's information into package.
Node node = packageDoc.importNode(methoddoc.getDocumentElement(), true);
docfrag = packageDoc.createDocumentFragment();
while (node.hasChildNodes())
docfrag.appendChild(node.removeChild(node.getFirstChild()));
Node methodnode = packageDoc.createElement("methods");
packageDoc.getDocumentElement().appendChild(methodnode);
methodnode.appendChild(docfrag);
//***adding second methode's information into package.
nameNode.setTextContent("the name of the method22");
returnTypeNode.setTextContent("the return type of the method22");
node = packageDoc.importNode(methoddoc.getDocumentElement(), true);
docfrag = packageDoc.createDocumentFragment();
while (node.hasChildNodes())
docfrag.appendChild(node.removeChild(node.getFirstChild()));
Node methodnode2 = packageDoc.createElement("methods");
packageDoc.getDocumentElement().appendChild(methodnode2);
methodnode2.appendChild(docfrag);
//**Display
DOMSource source = new DOMSource(packageDoc);
StreamResult result = new StreamResult(System.out);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
System.out.println("This is the content of the XML document:\n");
transformer.transform(source, result);
catch (Exception e)
}regards
-buntymy problem was, if i dont have parameters for second method then also parameters of first methods comes into 2nd method. I think its headache for me.
Parmeter.xml:
<parameter>
<name></name>
<type></type>
</parameter>Method.xml
<method>
<name></name>
<returnType></returnType>
<parameters>
</parameters>
</method>So my quetion is, I have put whole parameter.xml into method.xml's parameter node. In previous post u said refresh it. How can i refresh it ? not get this point .
Code is :
import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class TryXML
public static void main(String args[])
try
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
Document methoddoc = parser.parse(new File("method.xml"));
Document packageDoc = parser.parse(new File("interface.xml"));
Document parmerterDoc=parser.parse(new File("parameter.xml"));
//***Package information
Node packagenameNode = packageDoc.getElementsByTagName("name").item(0);
Node packageclassNode = packageDoc.getElementsByTagName("className").item(0);
packagenameNode.setTextContent("package1");
packageclassNode.setTextContent("class1");
//***First method information
Node nameNode = methoddoc.getElementsByTagName("name").item(0);
Node returnTypeNode = methoddoc.getElementsByTagName("returnType").item(0);
nameNode.setTextContent("method1");
returnTypeNode.setTextContent("int");
//**Parameter Informtion of this method.
Node paramnameNode = parmerterDoc.getElementsByTagName("name").item(0);
Node paramreturnTypeNode = parmerterDoc.getElementsByTagName("type").item(0);
paramnameNode.setTextContent("Param1");
paramreturnTypeNode.setTextContent("Void");
NodeList list = parmerterDoc.getElementsByTagName("parameter");
Element element = (Element)list.item(0);
NodeList list1 = methoddoc.getElementsByTagName("parameters");
Element element1 = (Element)list1.item(0);
// Make a copy of the element subtree suitable for inserting into doc2
Node dup = methoddoc.importNode(element, true);
// Insert the copy into doc2
element1.appendChild(dup);
NodeList methodlist = methoddoc.getElementsByTagName("method");
Element methodelement = (Element)methodlist.item(0);
NodeList methodlist1 = packageDoc.getElementsByTagName("methods");
Element methodelement1 = (Element)methodlist1.item(0);
// Make a copy of the element subtree suitable for inserting into doc2
Node methoddup = packageDoc.importNode(methodelement, true);
// Insert the copy into doc2
methodelement1.appendChild(methoddup);
// ***Second method information
nameNode = methoddoc.getElementsByTagName("name").item(0);
returnTypeNode = methoddoc.getElementsByTagName("returnType").item(0);
nameNode.setTextContent("method2");
returnTypeNode.setTextContent("short");
//**Parameter Informtion of this method.
methodlist = methoddoc.getElementsByTagName("method");
methodelement = (Element)methodlist.item(0);
methodlist1 = packageDoc.getElementsByTagName("methods");
methodelement1 = (Element)methodlist1.item(0);
// Make a copy of the element subtree suitable for inserting into doc2
methoddup = packageDoc.importNode(methodelement, true);
// Insert the copy into doc2
methodelement1.appendChild(methoddup);
//**Display
DOMSource source = new DOMSource(packageDoc);
StreamResult result = new StreamResult(System.out);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
System.out.println("This is the content of the XML document:\n");
transformer.transform(source, result);
catch (Exception e)
e.printStackTrace();
}Message was edited by:
bunty_barge -
Problem in down loading Grid out to Excel
Hi all ,
when i down load grid output into excel using list->export->localfile ->spread sheet,
Some columns headings are down loaded with medium texts and some with short texts (seltext_s) .The same is displayed in default output(with out dragging) . I found that fields with short texts are because of field data length is less than 10 char .customer is asking to medium or long texts in excel when down loaded..
1)Hence i expanded fileds and then down loaded , same short texts are down loaded to XL.
2)I incresed output length for those fields so as to take medium or long texts in default output of report(no need of dragging ) and then down loaded to excel .Still it is taking short texts only in XL .
Will there be any default settings to consider text to considered while down loading or do ineed to set explicitley .Please advise me ..
a bit urgent .
I constructed fieldcat as follows
ls_fieldcat-fieldname = c_cname.
ls_fieldcat-seltext_l = text-004.
ls_fieldcat-seltext_s = text-004.
ls_fieldcat-seltext_m = text-004.
ls_fieldcat-reptext_ddic = text-004.
MODIFY p_fieldcat FROM ls_fieldcat TRANSPORTING seltext_l seltext_m
seltext_s reptext_ddic WHERE fieldname = ls_fieldcat-fieldname.
Many Thanks
Dharma PHi A. Caglar Ozkor,
Basically the parmeter layout-colwidth optimization is set to 'X'. I tried out to increase outputlength after setting it to ' ' , then down loaded to excel .In that case also it picked only short texts , Hence I thought there would be some settings to decide what text to be picked while down loading in to excel .
Guys , Any ideas to solve this problem ...
Dharma P -
Problem in enhancing the Purchase Order BADI with custom fields
Hi All,
I have problem in populating the cutom fields for the Purchase Order. I have created a custon include and i am passing the values to the extension of the Function module BAPI_PO_CHANGE In ECC 6.0. I have one currency field (ZZMASSIST) in the header level and three curr fields in the item level , due to this currfields we are getting the errors like "Error transferring ExtensionIn data for enhancement CI_EKPODB" and "Error transferring ExtensionIn data for enhancement CI_EKKODB" .
So i am looking to implement the BADI "ME_BAPI_PO_CUST " . Please provide me the sample code for maintain the currency fields in method IF_EX_ME_BAPI_PO_CREATE_02~MAP2I_EXTENSIONIN.
Thanks in Advence.
Regards,
Venkat Appikonda.Hi Venkat,
Saw that you solved the issue, can I ask how do you implement it? Is the implementation done in the BAPI itself? -
Problem using BAPI_BUS2001_CREATE to create project definition
Hi,
i have a problem using BAPI_BUS2001_CREATE to create project definition.
i have customer fields in CI_PROJ structure.
i used help structure BAPI_TE_PROJECT_DEFINITION in EXTENSIONIN table
the problem is that customer fields that i have populated in BAPI_TE_PROJECT_DEFINITION are not processed.
please help.
thanks.solved,
applay oss note 637345 -
Hi all,
I have a problem with PR creation by BAPI_PR_CREATE. We use ECC 6.0. We have one non-character field in CI_EBANDB. I know, it isn't correct, but we have this field. And there is a BAdI to solve this problem: IF_EX_ME_BAPI_PR_CREATE_02~MAP2I_EXTENSIONIN. I have used this BAdI, and after
implementation of notes 1148689, 1176786, 1156334 and 1173224 it works, but not quite correct.
The problem: It could be the field in EXTENSIONIN brings an conversion error. In this case I want to send a message from BAdI to BAPI and the BAPI has to terminate the creation of the PR.
In many steps with the aid of SAP I have "developed" the following code:
method if_ex_me_bapi_pr_create_02~map2i_extensionin.
*-- define local data
data: l_done type mmpur_bool. "conversion done
data: wa_ebanci_char type zmi_mm_ci_ebandb_char.
data: l_obj type ref to if_message_obj_mm. "#EC NEEDED
data: my_mereq_ref type ref to if_accounting_model_mm.
check im_name = 'CI_EBANDB'.
check im_error eq cl_mmpur_constants=>yes.
include mm_messages_mac.
mmpur_dynamic_cast1 l_obj me->my_mereq_ref.
mmpur_business_obj l_obj.
call method cl_abap_container_utilities=>read_container_c
exporting
im_container = im_container+5
importing
ex_value = wa_ebanci_char
exceptions
illegal_parameter_type = 1
others = 2.
if not sy-subrc is initial.
* Errorhandling needed
return.
endif.
try.
move-corresponding wa_ebanci_char to ch_struc.
*-- Errorhandling
catch cx_sy_conversion_no_number
cx_sy_conversion_overflow
cx_sy_move_cast_error.
mmpur_message_forced 'E' 'ZMIZZD' '809' space space space space.
endtry.
l_done = cl_mmpur_constants=>yes.
move im_container(5) to ch_struc(5).
check l_done eq cl_mmpur_constants=>yes.
raise exception type cx_mmpur_root.
endmethod. "if_ex_me_bapi_pr_create_02~map2i_extensionin
My Problem is the accurate using of the mmpur macros. I have the message 809 in case of a conversion errror in the RETURN-Table in BAPI. But the fields PARAMETER, ROW and FIELDS of the RETURN-Table are not or not well filled. I have seen I have to make something with mmpur_business_obj_id and mmpur_metafield, but I can't find how to do this exactly in this BAdI.
Has anyone a idea?
Thanks in advance.
MichaelHi Michael,
(1) in the BAdI IF_EX_ME_BAPI_PR_CREATE_02~MAP2I_EXTENSIONIN, if you use Method "Read_Container_C" in class CL_abap_container_utilities
as following:
CALL METHOD cl_abap_container_utilities=>read_container_c
EXPORTING
im_container = im_container
IMPORTING
ex_value = ch_struc
EXCEPTIONS
illegal_parameter_type = 1
others = 2
AND (2) in your BAPI-call, for the part exteinionIN, you use another method "Fill_Container_C" of the same class CL_abap_container_utilities
something like these:
DATA: lw_bapi_te_mereqitem TYPE bapi_te_mereqitem,
lw_bapi_te_mereqitemx TYPE bapi_te_mereqitemx.
*-- Feldsymbole Ausgangsparameter
FIELD-SYMBOLS: <lw_extensionin> TYPE bapiparex.
APPEND INITIAL LINE TO pt_extensionin
ASSIGNING <lw_extensionin>.
CLEAR lw_bapi_te_mereqitem.
lw_bapi_te_mereqitem-preq_item = pw_output-bnfpo.
lw_bapi_te_mereqitem-zz_qty = pw_output-meng.
lw_bapi_te_mereqitem-zzdatum_grund = sy-datum.
lw_bapi_te_mereqitem-zzuzeit_grund = sy-uzeit.
<lw_extensionin>-structure = 'BAPI_TE_MEREQITEM'.
* fill extension i-tab which mit ZZ-Felder EBAN
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = lw_bapi_te_mereqitem
IMPORTING
ex_container = <lw_extensionin>+30(930)
EXCEPTIONS
illegal_parameter_type = 1
others = 2
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1.
* RAISE illegal_parameter_type.
WHEN OTHERS.
* RAISE unknown_error.
ENDCASE..
ENDIF.
APPEND INITIAL LINE TO pt_extensionin
ASSIGNING <lw_extensionin>.
CLEAR lw_bapi_te_mereqitemx.
lw_bapi_te_mereqitemx-preq_item = pw_output-bnfpo.
lw_bapi_te_mereqitemx-zz_qty = true.
lw_bapi_te_mereqitemx-zzdatum_grund = true.
lw_bapi_te_mereqitemx-zzuzeit_grund = true.
<lw_extensionin>-structure = 'BAPI_TE_MEREQITEMX'.
* fill extension i-tabx
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = lw_bapi_te_mereqitemx
IMPORTING
ex_container = <lw_extensionin>+30(930)
EXCEPTIONS
illegal_parameter_type = 1
others = 2
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1.
* RAISE illegal_parameter_type.
WHEN OTHERS.
* RAISE unknown_error.
ENDCASE..
ENDIF.
It works for BAPI_PR_CHANFGE! It should work for BAPI_PR_CREATE.
(3)One condition is note 1176786, which correced errors in L2014I01 and L2105I01, where the code
CHECK: <comp>-type_kind EQ lr_abap->typekind_packed ,
must be
CHECK: <comp>-type_kind EQ lr_abap->typekind_packed OR "1176786
=> comma "," is wrong, logic operator "OR" is correct.
Viele Grüße
Shuhui
Maybe you are looking for
-
CD Burner and Player Tripping...?!
Wont play certain cd's, and no longer burns at all. Spits a warning saying- The attempt to burn disc failed. The device failed to calibrate the laser poser level for this media. whats the deal?? I adjusted the burn speed then I get this warning- The
-
Good afternoon, This time I write to you aksing for your help with the following problem. I have a report in CR2008, which with I made a cash receipt with the B1 tables ORCT, RCT1 ETC .. Now I want to take that same report but changing it to the tabl
-
My adobe reader download will not accept my adobe pw?
my adobe reader download will not accept my pw for adobe??
-
Relation between OTA_ACTIVITY Tables
Hi, Can some one explain the relation between ota_activity_definitions, ota_activity_versions,ota_category_usages,ota_act_cat_inclusions tables as how hey are related to one another. Thanks in advance.
-
I am using Oracle 9iDS Report Builder, I Built a report that is supposed to be generated in Arabic, Once generated as a paper layout all the Arabic characters (numbers and letters) appear in Arabic correctly. BUT THE PROBLEM APPEARS when i try to gen