How to INSERT items using BAPI_SALESORDER_CHANGE
Hello all,
i am trying to insert a items into SALESDOCUMENT, i am making the following process.
i have a SALESDOCUMENT from which a make a copy then i delete all the ITEMS and i try to insert the new one, i am trying to insert a new ITEMS which has relations with another material i am making this because i am expecting when i insert the ITEMS all the material will be recalculated.
for example
position material quantity.
10 6050 1 this is the main material
20 7228 30 This is child record of the main material
30 7143 1 this is child record of the main material.
when i run my function i need to modify the main material as this
position material quantity
10 6050 2.
so i am expecting
position material quantity.
10 6050 2 this is the main material
20 7228 60 This is child record of the main material
30 7143 2 this is child record of the main marial.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = p_copia "this is the copy
order_header_inx = are_headx " value U
TABLES
return = tab_retor
order_item_in = tab_items
order_item_inx = tab_itemx
schedule_lines = tab_sched
schedule_linesx = tab_schex.
but i really i don`t how to do it, i have been using the bapi BAPI_SALESORDER_CHANGE, this bapi delete the items this is ok , but not insert the items that i need , 'does anybody has make something like this, i will really apprecite if someone give a hand, please.
continue..................................................
***GET LIST OF SALESORDER
CALL FUNCTION 'BAPISDORDER_GETDETAILEDLIST'
EXPORTING
i_bapi_view = i_bapi_view
TABLES
sales_documents = sales_documents
order_headers_out = order_headers_out
order_items_out = order_items_out.
LOOP AT order_items_out .
MOVE-CORRESPONDING order_items_out TO order_item_in.
order_item_in-val_type = pval.
APPEND order_item_in.
ENDLOOP.
LOOP AT order_item_in .
MOVE-CORRESPONDING order_item_in TO itab_ch.
APPEND itab_ch.
ENDLOOP.
LOOP AT itab_ch .
* Header update indicator
s_order_header_inx-updateflag = 'U'.
i_order_item_in-itm_number = itab_ch-itm_number .
i_order_item_in-material = itab_ch-material.
i_order_item_in-target_qty = itab_ch-target_qty.
i_order_item_in-sales_unit = itab_ch-sales_unit.
i_order_item_in-val_type = itab_ch-val_type.
i_order_item_inx-updateflag = 'I'.
i_order_item_inx-itm_number = itab_ch-itm_number .
i_order_item_inx-material = itab_ch-material.
i_order_item_inx-target_qty = 'X'.
i_order_item_inx-sales_unit = itab_ch-sales_unit.
i_order_item_inx-val_type = 'X'.
APPEND: i_order_item_in, i_order_item_inx.
** Fill schedule lines
i_sched-itm_number = itab_ch-itm_number .
i_sched-sched_line = '0001'.
i_sched-req_qty = itab_ch-target_qty.
APPEND i_sched.
* Fill schedule line flags
i_schedx-itm_number = itab_ch-itm_number .
i_schedx-sched_line = '0001'.
i_schedx-updateflag = 'I'.
i_schedx-req_qty = 'X'.
APPEND i_schedx.
ENDLOOP.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = p_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'
EXPORTING
wait = 'X'.
LOOP AT it_return.
WRITE / it_return-message.
ENDLOOP.
Similar Messages
-
How to insert values using pushputtons in text item & fetch data based on
Dear friends,
I want to insert values in the Text item using pushbutton e.g to insert 05CST884 into text item using pushbuttons '0' '5' 'C' 'S' 'T' '8' '8' '4' (alpha numeric buttons) in the layout editor and then fetch data based on the number entered with that of one in the table in the another text item2 in the layout editor.
Suggestions regarding how to develop and use effective triggers are welcome.At the block level (for the control block where all your push buttons are, let's call it block1) create a WHEN-BUTTON-PRESSED trigger. Your [A-Z] and [0-9] buttons should be on a dedicated non-database datablock to reduce problems. As stated previously, this trigger should just contain the code:
:block2.text_item := :block2.text_item||get_item_property(:system.trigger_item, label);
Also on the pushbutton block, create a backspacve button with its own dedicated WHEN-BUTTON-PRESSED trigger containing:
if length(:block2.text_item) > 0 then :block2.text_item := substr(:block2.text_item, 1, length(:block2.text_item)); end if;
This will hopefully erase the last character entered.
block2 should be based on the database table (see Property Palette --> Database) you wish to query and text_item should be based on the database item which contains the code you entered. All the other database items you wish to displayshould also be added to block2.
Add another FIND push button to block1 with the code:
go_block('block2');
execute_query;
Without writing the whole thing for you, I'd suggest you get a decent Forms tutorial book to guide you through the basics (Oracle Forms Developers Handbook). -
How to Insert Character using Prepared statement
Hi All,
Can anyone let me know how can I insert character using prepared statement.
Thanks
SameerIn the future JDBC related questions should be posted into the JDBC forum.
Can you please provide some more information about what you are trying to do? It isn't clear to me. Are you trying to update a CHAR field? -
I have redeemed my itunes card for $25.00. This amount shows next to my account name. I chose songs from the itunes store and added to my wish list, but when I try to purchase these using my $25.00, it tells me this has already been redeemed. How do I buy songs and use my gift card to pay for them?
The amount is already credited to your account. Purchase something and it will use this balance.
-
I want to insert a XML Document using xsql?
tell me anyone step step procedure using xsql;this is very urgentI want to insert a XML Document using xsql?
tell me anyone step step procedure using xsql;this is very urgent Use use <xsql:insert-request> to insert your data into the database.
example
<xsql:insert-request xmlns:xsql="urn:oracle-xsql" connection="demo" table="TC_UTIL_CONFIG" columns="ID, NAME, VALUE" />
The above inserts the input request to the table and inserts the colums with the values. The input XML should look like the following
<ROWSET>
<ROW>
<ID>1</ID>
<NAME>kesav</NAME>
<VALUE>good</VALUE>
<ROW>
<ROW>
<ID>2</ID>
<NAME>kumar</NAME>
<VALUE>good</VALUE>
</ROW>
</ROWSET>
If your request doesn't match the above you can use transform attribute to specify an xsl to convert the input to match the above xml.
If you submit your request from form you should use the transform stylesheet to convert the request to the XML. If you use Microsoft.XMLHTTP to post the xml document which matches the xml then you don not need any transformation. -
How to insert Commandbutton using paneltab in ADF Faces
hi all,
i am developing the ADF application where i created JSF page(.jspx).In that i have used the panelTabbed and dropped one VO(viewobject) as a table.I need to add one commandbutton and inputtext(any objects) after the table...But commandbutton or whatever components are not visible in the page..Please help on this.
The below code for your reference.....
<af:showDetailItem text="Add" id="sdi3">
<af:panelGroupLayout id="pgl2">
<af:table value="#{bindings.RejctVO1.collectionModel}"
var="row"
rows="#{bindings.RejctVO1.rangeSize}"
emptyText="#{bindings.RejctVO1.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.RejctVO1.rangeSize}"
rowBandingInterval="0" id="t1">
<af:column sortProperty="RejctId" sortable="false"
headerText="#{bindings.RejctVO1.hints.RejctId.label}"
id="c2">
<af:inputText value="#{row.bindings.RejctId.inputValue}"
label="#{bindings.RejctVO1.hints.RejctId.label}"
required="#{bindings.RejctVO1.hints.RejctId.mandatory}"
columns="#{bindings.RejctVO1.hints.RejctId.displayWidth}"
maximumLength="#{bindings.RejctVO1.hints.RejctId.precision}"
shortDesc="#{bindings.RejctVO1.hints.RejctId.tooltip}"
id="it2">
<f:validator binding="#{row.bindings.RejctId.validator}"/>
<af:convertNumber groupingUsed="false"
pattern="#{bindings.RejctVO1.hints.RejctId.format}"/>
</af:inputText>
</af:column>
<af:column sortProperty="RejctDs" sortable="false"
headerText="#{bindings.RejctVO1.hints.RejctDs.label}"
id="c1">
<af:inputText value="#{row.bindings.RejctDs.inputValue}"
label="#{bindings.RejctVO1.hints.RejctDs.label}"
required="#{bindings.RejctVO1.hints.RejctDs.mandatory}"
columns="#{bindings.RejctVO1.hints.RejctDs.displayWidth}"
maximumLength="#{bindings.RejctVO1.hints.RejctDs.precision}"
shortDesc="#{bindings.RejctVO1.hints.RejctDs.tooltip}"
id="it1">
<f:validator binding="#{row.bindings.RejctDs.validator}"/>
</af:inputText>
</af:column>
</af:table>
</af:panelGroupLayout>
<af:spacer id="s1"/>
<af:commandButton text="commandButton 1" id="cb1"/>
</af:showDetailItem>
Regards
muraliHi Muralli,
First u can display the command button near to the table by surrounding the af:table by panelCollection and panelCollection has some facets... even af:table too have some facets
In panelcollection facets make use of toolbar facet
<af:panelCollection ....
<f:facet name="toolbar">
<af:toolbar id="t2">
<af:commandButton text="commandButton 1" id="cb1"/>
</af:toolbar>
</f:facet>
<af:table ....
</af:table>
</af:panelCollection>
Have look on this documents for Table and Collection
Table : http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e12419/tagdoc/af_table.html
PanelCollection : http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e12419/tagdoc/af_panelCollection.html
Regards,
Suganth.G -
How to insert data using jdeveloper 11g
hi all..
i'm starting my first web aplication using JSF in jdeveloper 11g.
I have one table in the database has two attributes(id and name). i connected to the database succrssfuly.
i built adf application and created JSF page then i draged my view from data controls to built adf form without selected submit button.
and i draged commit operation and created a button to save .
but when i run the application the adding process didn't work.
plz, help me to complete my application .
thankswell Learn ADF first :)
check this simple Create Edit form http://orclsamples.googlecode.com/files/CreateEditRecord.zip might help you to get started
also check my blog i post basic cook book kind style ADF examples for newbies http://baigsorcl.blogspot.com/search/label/ADF -
How to insert symbols using my mac?
I already went to system preferences and clicked on Input Sources and did all that jazz. I have the flag in the upper right hand corner and I can view the different characters but there is no way to input them? Any suggestions? I'm sure I'm doing something wrong. + I'm new to Mac.
Open the Character Viewer (should be in the Input Menu, the one with the flag on it), and locate the character you want.
Place your cursor in the text document where you want the character, then double-click the character in Character Viewer.
✪ ❦ ❒ ♺ ♼ ♥ ♘ -
SolMan 4.0 CHaRM: Insert Item to Normal Correction: Item category / product
I'm looking for some detailed documentation on <b>how to insert items to a Normal Correction</b>.
When I add an item with (standard) product SAPCUSTPRGOPT and choose the (standard) item category SDCR ("best I could find") then I get the error "<i>The item category 'SDCR' is not permitted for product 'SAPCUSTPRGOPT'</i>."
Now I'm looking for an example that will show me <b>how to insert an item with standard SOLMAN 4.0 settings</b>. I hesitate to step into the CRM customizing details prepared by SOLMAN, instead I would expect that standard setting should work if used properly.
Thanks for help.No further interest in this topic.
-
How to insert text using Lightroom 5 (not in slide mode or using watermark)?
If you mean superimposing text on your photo, you can't do that in Lightroom. There is no "insert text" feature (other than watermark or slides). There is a plug-in called Mogrify that allows you to superimpose text on your photos during export.
-
How to insert date from preparedstatement
hi,
I have a problem here trying to insert date into my table. but the problem is the date is supposed to be grabbed from the user input which is in textfield. However, I did a short cut and made the list of data into and array of String. so when i tried to insert the data into the table it gives me this error:
ORA-01861: literal does not match format string
so, I would like to ask if there is a solution to insert date into the table with the use of prepared statement..
for (int i=0; i<str_val.length; i++){
ps.setString(i+1, str_val);
ps.executeUpdate();
con.commit();
this is how i insert data using prepared statement. but the date is causing problem. Helps please....
Thanks in advanceI have a problem here trying to insert date into my
table. but the problem is the date is supposed to be
grabbed from the user input which is in textfield.So you have a string which is supposed to contain a date (or timestamp.)
Presumably you verified it.
You have two choices...
1. Create your SQL for your prepared statement using the oracle function todate(). You will need to use the exact format string, as defined by the function, that corresponds to the text field you have.
2. Use SimpleDateFormat to parse the string into a date. Use another SimpleDateFormat to parse the date into the format expected by oracle. -
How to insert multiple line items in fv60 using bdc.
Hi all,
How to insert multiple line items in fv60 using bdcshi
chk this
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA : IT_MESSAGES LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : V_EBELP(30) , V_MENGE(30) , V_WERKS(30), V_EMATN(30) ,
V_PEINH(30).
DATA : FILE TYPE STRING, V_MSG(100) , V_IND(2) TYPE N , FLAG VALUE 'X'.
PARAMETERS: P_FILE(50) TYPE C DEFAULT 'C:\ME21_TEST'.
DATA : BEGIN OF ITAB OCCURS 0,
IND(02),
LIFNR_001(010),
data element: BSART
BSART_002(004),
data element: BEDAT
data element: EKORG
EKORG_004(004),
EKGRP_006(003),
data element: LPEIN
LPEIN_005(001),
data element: EMATNR
EMATN_01_007(018),
data element: EWERK
WERKS_01_008(004),
data element: EPEIN
PEINH_01_009(006),
data element: EWERK
MENGE_01_013(017),
data element: AUFEP
EBELP_014(005),
data element: AUFEP
END OF ITAB.
START-OF-SELECTION.
FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = ITAB
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.
SORT ITAB BY IND.
START-OF-SELECTION.
LOOP AT ITAB.
REFRESH IT_MESSAGES.
<b>V_IND = V_IND + 1.</b>
<b>AT NEW IND.</b>
<b>READ TABLE ITAB INDEX SY-TABIX.</b>
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0100'.
PERFORM BDC_FIELD USING 'EKKO-LIFNR'
ITAB-LIFNR_001.
PERFORM BDC_FIELD USING 'RM06E-BSART'
ITAB-BSART_002.
*perform bdc_field using 'RM06E-BEDAT'
ITAB-BEDAT_003.
PERFORM BDC_FIELD USING 'EKKO-EKORG'
ITAB-EKORG_004.
PERFORM BDC_FIELD USING 'RM06E-LPEIN'
ITAB-LPEIN_005.
PERFORM BDC_FIELD USING 'EKKO-EKGRP'
ITAB-EKGRP_006.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
ENDAT.
<b>PERFORM BDC_DYNPRO USING 'SAPMM06E' '0120'.
CONCATENATE 'EKPO-EMATN(' V_IND ')' INTO V_EMATN.
PERFORM BDC_FIELD USING V_EMATN
ITAB-EMATN_01_007.
CONCATENATE 'EKPO-WERKS(' V_IND ')' INTO V_WERKS.
PERFORM BDC_FIELD USING V_WERKS
ITAB-WERKS_01_008.
CONCATENATE 'EKPO-PEINH(' V_IND ')' INTO V_PEINH.
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0120'.
PERFORM BDC_FIELD USING V_PEINH
ITAB-PEINH_01_009.
*CONCATENATE 'EKPO-MENGE(' V_IND ')' INTO V_MENGE.
*perform bdc_dynpro using 'SAPMM06E' '0120'.
*perform bdc_field using V_MENGE
ITAB-MENGE_01_013.
*CONCATENATE 'EKPO-EBELP(' V_IND ')' INTO V_EBELP.
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0120'.
PERFORM BDC_FIELD USING 'RM06E-EBELP'
ITAB-EBELP_014.</b>PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
AT END OF IND.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BU'.
ENDAT.
CALL TRANSACTION 'ME21' USING IT_BDCDATA MODE 'A'
UPDATE 'S'
MESSAGES INTO IT_MESSAGES.
LOOP AT IT_MESSAGES WHERE MSGTYP = 'E' OR MSGTYP = 'A'.
IF FLAG = 'X'.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = 'GAMY_FAILURE'
HOLDDATE = FILLER8
KEEP = 'X'
USER = SY-UNAME
RECORD = FILLER1
PROG = SY-CPROG
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR FLAG.
ENDIF.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'ME21'
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
SIMUBATCH = ' '
CTUPARAMS = ' '
TABLES
DYNPROTAB = IT_BDCDATA
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_MESSAGES-MSGID
LANG = 'EN'
NO = IT_MESSAGES-MSGNR
V1 = IT_MESSAGES-MSGV1
V2 = IT_MESSAGES-MSGV2
V3 = IT_MESSAGES-MSGV3
V4 = IT_MESSAGES-MSGV4
IMPORTING
MSG = V_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
WRITE : / V_MSG.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
ENDLOOP.
IF FLAG NE 'X'.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROGRAM.
IT_BDCDATA-DYNPRO = DYNPRO.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA. -
How to insert more than 12 items using BDC for MB1C
Hi,
When we use LSMW for data transfer of MB1C transaction, more than 12 items can be inserted in a document.
But using BDC only 12 and below is possible, if the flat file system has more that 12 item, then the document is not created.
How to insert more than 12 item in a document.
RegardsHi Gow,
I have uploaded the MB1C through a BDC and it is working fine for n no of items.
Here is the code. May be this will be of your help.
*& Report ZMB1C
report ZMB1C
no standard page heading line-size 255.
type-pools : slis.
tables : t100.
data: begin of record,
MATNR(018),
ERFMG(017),
EXBWR(016),
end of record.
data : itab like table of record with header line.
data : w_bdcdata type bdcdata.
data : t_bdcdata type standard table of bdcdata initial size 1.
data : messtab type standard table of bdcmsgcoll with header line.
data : mstring(300).
data : vf_index type i,
no_lines type i,
count type i value 0.
data : v_bldat(20),
v_budat(20).
*Excel Sheet Data Upload Details
data : vf_start_col type i value '1', "start column
vf_start_row type i value '2', "start row
vf_end_col type i value '100', "maximum column
vf_end_row type i value '10000'. "maximum row
*/ Internal Table For Excel Data
data : it_excel type kcde_cells occurs 0 with header line.
*/ Field symbol
field-symbols : <fs>.
data : begin of it_messtab occurs 0,
plant(10) type c,
status(10) type c,
message(90) type c,
end of it_messtab.
*Data for ALV display
data : wa_fcat type slis_fieldcat_alv,
colcnt type i.
data : it_fieldcat type slis_t_fieldcat_alv,
i_events type slis_t_event.
data : l_title type sychar70.
data : l_repid like sy-repid.
* Selction Screen
selection-screen begin of block b1 with frame title text-000.
parameters : p_file like ibipparms-path obligatory,
p_mode like ctu_params-dismode default 'A'.
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-001.
parameters : p_bldat like MKPF-BLDAT obligatory,
p_budat like MKPF-BUDAT obligatory,
p_bwart like RM07M-BWARTWA obligatory,
p_werks like RM07M-WERKS obligatory,
p_lgort like RM07M-LGORT obligatory.
selection-screen end of block b2.
* At Selction Screen
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ''
IMPORTING
file_name = p_file.
*Start of Selection Event
start-of-selection.
call function 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_file
i_begin_col = vf_start_col
i_begin_row = vf_start_row
i_end_col = vf_end_col
i_end_row = vf_end_row
TABLES
intern = it_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
if it_excel[] is initial.
MESSAGE I000(ZCL_TCSABAP).
else.
sort it_excel by row col.
loop at it_excel.
move : it_excel-col to vf_index.
assign component vf_index of structure itab to <fs>.
move : it_excel-value to <fs>.
at end of row.
append itab.
clear itab.
endat.
endloop.
endif.
if not itab[] is initial.
DESCRIBE TABLE itab LINES no_lines.
clear messtab.
refresh messtab.
CONCATENATE p_bldat+6(2) '.' p_bldat+4(2) '.' p_bldat(4) into v_bldat.
CONCATENATE p_budat+6(2) '.' p_budat+4(2) '.' p_budat(4) into v_budat.
perform map_rec.
call transaction 'MB1C' using t_bdcdata mode p_mode update 'A'
messages into messtab .
clear t_bdcdata.
refresh t_bdcdata.
loop at messtab where msgtyp = 'E' or msgtyp = 'S' .
select single * from t100 where sprsl = messtab-msgspra
and arbgb = messtab-msgid
and msgnr = messtab-msgnr.
if sy-subrc = 0.
mstring = t100-text.
if mstring cs '&1'.
replace '&1' with messtab-msgv1 into mstring.
replace '&2' with messtab-msgv2 into mstring.
replace '&3' with messtab-msgv3 into mstring.
replace '&4' with messtab-msgv4 into mstring.
else.
replace '&' with messtab-msgv1 into mstring.
replace '&' with messtab-msgv2 into mstring.
replace '&' with messtab-msgv3 into mstring.
replace '&' with messtab-msgv4 into mstring.
endif.
condense mstring.
it_messtab-message = mstring(300).
it_messtab-plant = p_werks.
if messtab-msgtyp = 'E'.
it_messtab-status = 'Error'.
else.
it_messtab-status = 'Success'.
endif.
append it_messtab.
clear it_messtab.
endif.
endloop. "messtab
if not it_messtab[] is initial.
perform buildcatalog.
perform display.
endif.
endif.
*& Form Map_Rec
* text
form map_rec.
perform bdc_dynpro using 'SAPMM07M' '0400'.
perform bdc_field using 'BDC_CURSOR'
'RM07M-WVERS3'.
perform bdc_field using 'BDC_OKCODE'
'NPE'.
perform bdc_field using 'MKPF-BLDAT'
v_bldat.
perform bdc_field using 'MKPF-BUDAT'
v_budat.
perform bdc_field using 'RM07M-BWARTWA'
p_bwart.
perform bdc_field using 'RM07M-WERKS'
p_werks.
perform bdc_field using 'RM07M-LGORT'
p_lgort.
perform bdc_field using 'XFULL'
perform bdc_field using 'RM07M-XNAPR'
'X'.
perform bdc_field using 'RM07M-WVERS2'
perform bdc_field using 'RM07M-WVERS3'
'X'.
loop at itab.
count = count + 1.
perform bdc_dynpro using 'SAPMM07M' '0410'.
perform bdc_field using 'BDC_CURSOR'
'MSEG-EXBWR'.
if count <> no_lines.
perform bdc_field using 'BDC_OKCODE'
'=NPE'.
elseif count = no_lines.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
endif.
perform bdc_field using 'MSEG-MATNR'
itab-MATNR.
perform bdc_field using 'MSEG-ERFMG'
itab-ERFMG.
perform bdc_field using 'MSEG-EXBWR'
itab-EXBWR.
endloop. "itab
endform. "Map_Rec
** Form BDC_DYNPRO
form bdc_dynpro using program dynpro.
clear w_bdcdata.
w_bdcdata-program = program.
w_bdcdata-dynpro = dynpro.
w_bdcdata-dynbegin = 'X'.
append w_bdcdata to t_bdcdata.
endform. "bdc_dynpro
** Form BDC_FIELD
form bdc_field using fnam fval.
if fval <> space.
clear w_bdcdata.
w_bdcdata-fnam = fnam.
w_bdcdata-fval = fval.
append w_bdcdata to t_bdcdata.
else.
clear w_bdcdata.
w_bdcdata-fnam = fnam.
w_bdcdata-fval = fval.
append w_bdcdata to t_bdcdata.
endif.
endform. "bdc_field
* FORM buildcatalog *
form buildcatalog.
clear wa_fcat.
clear it_fieldcat.
colcnt = colcnt + 1.
wa_fcat-col_pos = colcnt.
wa_fcat-fieldname = 'PLANT'.
wa_fcat-tabname = it_messtab.
wa_fcat-seltext_l = 'PLANT'.
wa_fcat-key = 'X'.
wa_fcat-outputlen = '10'.
append wa_fcat to it_fieldcat.
clear wa_fcat.
colcnt = colcnt + 1.
wa_fcat-col_pos = colcnt.
wa_fcat-fieldname = 'STATUS'.
wa_fcat-tabname = it_messtab.
wa_fcat-seltext_l = 'STATUS'.
wa_fcat-outputlen = '10'.
append wa_fcat to it_fieldcat.
clear wa_fcat.
colcnt = colcnt + 1.
wa_fcat-col_pos = colcnt.
wa_fcat-fieldname = 'MESSAGE'.
wa_fcat-tabname = it_messtab.
wa_fcat-seltext_l = 'Message'.
wa_fcat-outputlen = '90'.
append wa_fcat to it_fieldcat.
endform. "buildcatalog
* FORM display *
form display.
l_title = text-002.
l_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_grid_title = l_title
it_fieldcat = it_fieldcat
it_events = i_events[]
TABLES
t_outtab = it_messtab
EXCEPTIONS
program_error = 1
others = 2.
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. "display
Regards,
Amit -
How to insert contract line item from file using any bapi
Hi gurus,
Just wanted to ask how can I insert new line item which were created from a file
when updating/changing contract details.
The requirement was to create new line item from a file and use those details in updating the contracts.
What BAPI can I use to address this requirement?
Thanks!Hi Rajvansh Ravi,
This is for Service Contracts. Sorry for missing this detail.
Hi Tarangini Katta,
I have already used BAPI_CONTRACT_CHANGE, and it was good in updating existing line items,
but it doesn't update the contract when a new line item is created in the file.
To make a clearer view of the flow (requirement)
First scenario:
From the tcode (ME32K or ME33K), we can download contract details into an excel file for a particular service contract.
Next scenario:
That same excel file (downloaded) can be enhanced per line item (can also insert new line) and be saved locally.
Next scenario:
This same excel file can also be uploaded. And the changes done to the file have to overwrite or rather have to changed the details of the same contract and then will appear/reflect in the tcode.
With this, if we had a new line item created (inserted) on the file (not change), we can not see the changes when we view the same contract in the tcode. (ME33K)
Do you have any idea how the insertion from the file can be reflected on the tcode using an existing bapi?
Hope this was clear enough...
Thanks and hope to hear something from you soon. -
How to insert data values using Poplist to both block items....
Hi,
I have created a poplist which should return a sequence(which is stored in a db table) and a description .
The sequence(stored in table) is of number datatype and the description is of varchar2.....
I have created the required record group as:
rg_id := Create_Group_From_Query('TEXNIKOS_GROUP', 'select eponymo , to_char(seq_code_ergazomenoy)
from ref_ergazomenos,ref_eidikothta
where ref_ergazomenos.code_eidikothtas_type_id=ref_eidikothta.seq_code_eidikothtas
order by 1');
status := Populate_Group( rg_id );
if (status = 0)
then
POPULATE_LIST('MOD2_KLISI_VLAVIS.TEXNIKOS_FNAME','TEXNIKOS_GROUP');
end if;The field 'MOD2_KLISI_VLAVIS.TEXNIKOS_FNAME' is the description i described above ... and whereas this block item is filled with the selected poplist... the sequence - the code of the db table- is not.....
Is it possible to do so.... ????
NOTE: i use Dev10g.
Many thanks,
SimonI have two block items:
seq_code_ergazomenoy: number datatype , db item , invisible
eponymo:varchar2 datatype , non db item , visible
How to fill these both block items using the written record group...?????
Now , only the "eponymo" block item is filled but not the required "seq_code_ergazomenoy"....
In other words.... is there any manner to do the column mapping of the two selected columns (in the dynamically created record group) to the two block items....????
Thanks,
Simon
Message was edited by:
sgalaxy
Maybe you are looking for
-
Call a function at a specific time
I am working on a large java project, and i need a way to call a function at a specific time(midnight of every night). How can i do this?
-
Testing function TEXT_CONVERT_XML_TO_SAP
Hi, Function "TEXT_CONVERT_XML_TO_SAP" has status not released for customer therefore I cannot use it. I have copied the whole function group TRUX bat I still get the error en I try to test "Z_TEXT_CONVERT_XML_TO_SAP" . I have done the SQL trace but
-
Hi all, i found a rather bothering problem. I have successfully created risk and generated the rules in the development server. But when i export and import into QAS, i found that although the risk/functions are loaded into QAS, but the actions/permi
-
Syncing iOS4 is EXTREMELY slow
Before I updated my iPhone 3G from 3.1.3 to iOS 4.0 I was able to sync fairly quickly with iTunes, under a minute. Calendars, Contacts and Notes would each only take a few seconds to sync. Since upgrading the sync process takes around 15 minutes with
-
Quickest way to substitute values in a String...
I have a string that represents the contents of a html file. I want to substitute all the custom variables (shown as {value} ) in the String with a new value. I am using the Java REGEXP to find the start/end position of all the custom variables that