FOR VK11
Hi All
after calling VK11, there is an additional popup (with radiobuttons) requesting a key combination and I don't have a any idea, how to select a value in this radiobutton box.... .if i want to select all radio button one by one then give me some coding idea.
*& Report ZVK11_EXC_COND1 *
REPORT ZVK11_EXC_COND1
no standard page heading line-size 255.
DATA:C_PR00(4) type C value 'PR00',
c_1 type i value '1',
C_2 TYPE I VALUE '2',
C_3 TYPE I VALUE '3',
c_x type c value 'X'.
TABLES:RV130,TMC1T.
DATA:SELKZ LIKE RV130-SELKZ.
data:GSTXT LIKE TMC1T-GSTXT.
DATA:BEGIN OF it_condn OCCURS 0,
KSCHL(4) TYPE C,
selkz(1) type c,
VKORG(4) TYPE C,
VTWEG(2) TYPE C,
KUNNR(10) TYPE C,
pltyp(2) type c,
WAERK(3) TYPE C,
MATNR(18) TYPE C,
kbetr(10) type c,
DATAB(10) TYPE C,
DATBI(10) TYPE C,
END OF it_condn.
*-- Internal table to store excel data
data: begin of it_excel_data occurs 0.
include structure alsmex_tabline.
data: end of it_excel_data.
data: begin of it_excel_data1 occurs 0.
include structure alsmex_tabline.
data: end of it_excel_data1.
data: begin of it_col occurs 0,
col like alsmex_tabline-col,
size type i.
data: end of it_col.
data: begin of it_fieldnames occurs 3,
title(60),
table(6),
field(10),
kz(1),
end of it_fieldnames.
data: begin of it_final occurs 0,
value_0001(50),
value_0002(50),
value_0003(50),
value_0004(50),
value_0005(50),
value_0006(50),
value_0007(50),
value_0008(50),
value_0009(50),
end of it_final.
DATA DECLARATIONS
data: v_lines type i, "Total no of records
v_bdc_total_recs type i, "no.of records inserted in BDC
v_color type c, "Toggle color
v_open_error type c, "BDC Open Error
v_file_not_read type c, "File not read
v_matnr like mara-matnr, "Matnr
v_bdc_open, "To indicate if BDC session-
"-is open or closed.
zwlen type i,
zwlines type i,
tind(4) type n,
zwfeld(19) type c.
DATA BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
*if it_condn-kschl eq c_pr00.
perform bdc_PR00.
*ENDIF.
SELECTION SCREEN DECLARATIONS
selection-screen: begin of block b1 with frame title text-001.
parameters : p_file like rlgrap-filename obligatory.
p_sess like apqi-groupid obligatory.
parameters: begcol type i default 1 no-display,
begrow type i default 1 no-display,
endcol type i default 100 no-display,
endrow type i default 32000 no-display.
selection-screen: end of block b1.
START-OF-SELECTION.
start-of-selection.
*-- Read file from presentation server and store in an internal table
perform get_data.
*-- Process Internal table
perform process_itab.
*LOOP AT it_CONDN.
*CALL TRANSACTION 'VK11' USING BDCDATA MODE 'A' UPDATE 'S'.
*PERFORM MATCHDATA.
*if it_condn-kschl eq C_PR00.
perform bdc_PR00.
ENDIF.
*CALL TRANSACTION 'VK13' USING BDCDATA MODE 'A' UPDATE 'S'.
*perform bdc_PR00.
*REFRESH BDCDATA.
*ENDLOOP.
FIELD SYMBOLS *
field-symbols: <fs1>.
*& Form get_data
form get_data.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = begcol
i_begin_row = begrow
i_end_col = endcol
i_end_row = endrow
TABLES
intern = it_excel_data
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
v_file_not_read = c_x.
stop.
endif.
endform. " get_data
*& Form process_itab
form process_itab .
loop at it_excel_data.
it_excel_data1 = it_excel_data.
clear it_excel_data1-row.
append it_excel_data1.
endloop.
sort it_excel_data1 by col.
loop at it_excel_data1.
at new col.
it_col-col = it_excel_data1-col.
append it_col.
endat.
zwlen = strlen( it_excel_data1-value ).
read table it_col with key col = it_excel_data1-col.
if sy-subrc eq 0.
if zwlen > it_col-size.
it_col-size = zwlen.
Internal Table, Current Row Index
modify it_col index sy-tabix.
endif.
endif.
endloop.
describe table it_col lines zwlines.
sort it_excel_data by row col.
loop at it_excel_data.
it_fieldnames-title = it_excel_data-value.
append it_fieldnames.
at end of row.
exit.
endat.
endloop.
sort it_excel_data by row col.
loop at it_excel_data.
tind = it_excel_data-col.
concatenate 'IT_FINAL-VALUE_' tind into zwfeld.
assign (zwfeld) to <fs1>.
<fs1> = it_excel_data-value.
at end of row.
append it_final.
clear it_final.
endat.
endloop.
loop at it_final.
if sy-tabix > 1.
it_condn-VKORG = it_final-value_0001.
it_condn-VTWEG = it_final-value_0002.
it_condn-KUNNR = it_final-value_0003.
it_condn-PLTYP = it_final-value_0004.
it_condn-WAERK = it_final-value_0005.
it_condn-MATNR = it_final-value_0006.
it_condn-KBETR = it_final-value_0007.
it_condn-DATAB = it_final-value_0008.
it_condn-DATBI = it_final-value_0009.
append it_condn.
clear it_condn.
endif.
endloop.
describe table it_condn lines v_lines.
endform. " process_itab
*include bdcrecx1.
*start-of-selection.
*perform open_group.
form BDC_PR00.
*FORM MATCHDATA.
LOOP AT IT_CONDN.
REFRESH BDCDATA.
perform bdc_dynpro using 'SAPMV13A' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RV13A-KSCHL'.
perform bdc_field using 'BDC_OKCODE'
'=ANTA'. "'/00''=ANTA'.
perform bdc_field using 'RV13A-KSCHL'
'PR00'.
perform bdc_dynpro using 'SAPLV14A' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RV130-SELKZ(01)'.
if RV130-SELKZ(01) eq C_1.
perform bdc_field using 'BDC_CURSOR'
'RV130-SELKZ(01)'.
perform bdc_field using 'BDC_OKCODE'
'=WEIT'.
perform bdc_dynpro using 'SAPMV13A' '1305'.
perform bdc_field using 'BDC_CURSOR'
'KOMG-MATNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KOMG-VKORG'
IT_CONDN-VKORG.
perform bdc_field using 'KOMG-VTWEG'
IT_CONDN-VTWEG.
perform bdc_field using 'KOMG-KUNNR'
IT_CONDN-KUNNR.
perform bdc_dynpro using 'SAPMV13A' '1305'.
perform bdc_field using 'BDC_CURSOR'
'KOMG-MATNR(01)'.
perform bdc_field using 'KOMG-MATNR(01)'
IT_CONDN-MATNR.
perform bdc_field using 'KONP-KBETR(01)'
IT_CONDN-KBETR.
perform bdc_field using 'RV13A-DATAB(01)'
IT_CONDN-DATAB.
perform bdc_field using 'RV13A-DATBI(01)'
IT_CONDN-DATBI.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
perform bdc_field using 'BDC_CURSOR'
'RV130-SELKZ(02)'.
ELSEif rv130-selkz eq c_2.
perform bdc_field using 'BDC_CURSOR'
'RV130-SELKZ(02)'.
perform bdc_field using 'BDC_OKCODE'
'=WEIT'.
perform bdc_field using 'RV130-SELKZ(02)'
'X'.
perform bdc_dynpro using 'SAPMV13A' '1306'.
perform bdc_field using 'BDC_CURSOR'
'KOMG-MATNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KOMG-VKORG'
IT_CONDN-VKORG.
perform bdc_field using 'KOMG-VTWEG'
IT_CONDN-VTWEG.
perform bdc_field using 'KOMG-PLTYP'
IT_CONDN-PLTYP.
perform bdc_field using 'KOMG-WAERK'
IT_CONDN-WAERK.
perform bdc_dynpro using 'SAPMV13A' '1306'.
perform bdc_field using 'BDC_CURSOR'
'KOMG-MATNR(01)'.
perform bdc_field using 'KOMG-MATNR(01)'
IT_CONDN-MATNR.
perform bdc_field using 'KONP-KBETR(01)'
IT_CONDN-KBETR.
perform bdc_field using 'RV13A-DATAB(01)'
IT_CONDN-DATAB.
perform bdc_field using 'RV13A-DATBI(01)'
IT_CONDN-DATBI.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
*perform bdc_field using 'BDC_CURSOR'
'RV130-SELKZ(03)'.
ELSEif rv130-selkz eq c_3.
perform bdc_field using 'BDC_CURSOR'
'RV130-SELKZ(03)'.
perform bdc_field using 'BDC_OKCODE'
'=WEIT'.
perform bdc_field using 'RV130-SELKZ(03)'
'X'.
perform bdc_dynpro using 'SAPMV13A' '1304'.
perform bdc_field using 'BDC_CURSOR'
'KOMG-MATNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KOMG-VKORG'
IT_CONDN-VKORG.
perform bdc_field using 'KOMG-VTWEG'
IT_CONDN-VTWEG.
perform bdc_dynpro using 'SAPMV13A' '1304'.
perform bdc_field using 'BDC_CURSOR'
'KOMG-MATNR(01)'.
perform bdc_field using 'KOMG-MATNR(01)'
IT_CONDN-MATNR.
perform bdc_field using 'KONP-KBETR(01)'
IT_CONDN-KBETR.
perform bdc_field using 'RV13A-DATAB(01)'
IT_CONDN-DATAB.
perform bdc_field using 'RV13A-DATBI(01)'
IT_CONDN-DATBI.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
ENDIF.
CALL TRANSACTION 'VK11' USING BDCDATA MODE 'A' UPDATE 'S'.
REFRESH BDCDATA.
ENDLOOP.
endform. "BDC_PR00
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> SPACE.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM. "BDC_FIELD
Here i have witten coding for that but it is not working
Please give me answer some one.
Hi Navid,
Take a look at IDOC_INPUT_COND_A. You can either use the COND_A Idoc to accomplish this (quiet easy), or take a look at the logic in this FM.
Regards,
John.
Similar Messages
-
I hav to upload bdc for vk11 trans and table konv.
hi experts,
i m new in BDC... i hav to upload bdc for vk11 trans and table konv.
frst doubt is
i hv to run shdb transc?? or just i hv to write program??
nd cn any1 send me teps as hw to create upload..
Condition Type Sales Organisation Distribution channel Material Price Unit Valid from Valid to
KSCHL VKORG VTWEG MATNR_01 KBETR_01 KPEIN_01 DATAB_01 DATBI_01
now plz tel me hw to do this...whether to run shdb or jus to write program in se38..
or i hv to do both...bt plz tel me step by stepPlease don't ignore the warnings. Read the rules of engagement.
Thread locked, again.
Thomas
wrking on ABAP OOPS, oput is coming but 1 field name wd customer name is nt -
hi!
can anybody plz tell me how to do bdc for vk11 and vk12.
the scene is that i have zpogram which displays the data and from there i have to add one button and whenever that button is triggred bdc had to be performed for vk11 and vk12 only for those fields which are diaplayed by my z program.
kindly help me out.
regards
anjaliHi Anjali
It is not advicable to create BDC for transactions like VK11, MEK1 ... which we use to create condition records. The reason is for each condition type, the options we see might vary when ever there is change in access sequences and their precedence. So if we create BDC, our program needs to modified everytime there is change in the access sequences and condition tables.
I would recommed you to either use the program that i have provided or use some BAPI's to upload/change condition records.
As you are saying, you have the data in your internal table. Download the data to a file in the format RV14BTCI needs and SUBMIT the program.
For understanding on the structure for this program, use transaction SXDB.
Kind Regards
Eswar -
BAPI for VK11,VK12,MEK1,MEK2
Hi,
1) Is there a BAPI or standard function module for MEK1 and MEK2?
2) I searched and found for VK11 and VK12 we have the following function modules
BAPI_PRICE_CONDITIONS
RV_KONDITION_SICHERN
RV_KONDITION_SICHERN_V13A
Please share if you has used the aboveGot it to work. With the sequence :
<b>1.</b> RV_CONDITION_COPY
<b>2.</b> RV_CONDITION_SAVE
<b>3.</b> RV_CONDITION_RESET
<b>4.</b> commit
* At least the key fields of the conditiontable
* (here 800) must be filled in structure ls_komg.
ls_komg-vbeln = '1234567890'. " document number
ls_komg-posnr = '000010'. " item number
clear wt_komv.
ls_komv-kappl = 'V '. " Application V = Sales
ls_komv-kschl = lc_kschl. " Condition type
ls_komv-waers = 'EUR'. " Currency
ls_komv-kmein = 'ST'. " Unit of measurement
ls_komv-kpein = '1'.
ls_komv-krech = 'M'. " calculation type;
"M = Quantity - monthy price
ls_komv-kbetr = '1234.56'. " new condition value
append ls_komv to lt_komv.
call function 'RV_CONDITION_COPY'
exporting
application = 'V'
condition_table = '800' " cond. table
condition_type = lc_kschl " cond. type
date_from = '20061101' " valid on
date_to = '20061130' " valid to
enqueue = 'X' " lock entry
i_komk = ls_komk
i_komp = ls_komp
key_fields = ls_komg " key fields
maintain_mode = 'A' " A= create
" B= change,
" C= display
" D= create
with reference
no_authority_check = 'X'
keep_old_records = 'X'
overlap_confirmed = 'X'
no_db_update = space
importing
e_komk = ls_komk
e_komp = ls_komp
new_record = lv_new_record
tables
copy_records = lt_komv
exceptions
call function 'RV_CONDITION_SAVE'.
call function 'RV_CONDITION_RESET'.
* necessary to write data
commit work.
Check data with transaction VK12
Thank you for your support
Thomas -
Hi All,
can anyone suggest me about data load for VK11, I mean which method will be easier?
appreciate if you can send me the developed custom code
thanks.Hi Kiran,
You can also use BAPI BAPI_PRICES_CONDITIONS.
Please check this link for sample codes.
Re: Sample code for BAPI_PRICES_CONDITIONS
Hope this will help.
Regards,
Ferry Lianto -
Hi,
Can anybody tell me the BAPI name with simple coding to update Condition types for different material, plant, region etc for tcode VK11.
thanks
n kumarHI
VK11,
vk11 bapi
Regards
Pavan -
Hi
Can any one tell me how to create <b>Generic BDC for transaction VK11 (Creating condition records)</b>
My actual requirement is like we need to create <b>condition record</b> for every material with all the condition types exist for that material for different key combinations . <b>A condition record for every material is to be created for different condition types and different key combinations where material MATNR is a key field .For example we need to create condition records dynamically for condition types ZPR0, ZCM0 etc.. for different key combinations where matnr is a key field .</b>
can anyone of you point out a way to me?
Thanks in advance
Shivakumarplease copy the program and use it
* Report to Upload the pricing condtion records for materials. *
* Program : ZSDR_PRICE_UPLOAD *
* Author : girish.
* Description: *
* This report Creat pricing condition records for materials *
* Tables Used : SELECT UPDATE INSERT DELETE *
* MVKE X *
* Input/Output Files: *
* Transactions called: *
* Includes: *
* Run Frequency - *
* Program History *
* Date Change No Change Request SAP Rel NSC Rel *
* Description *
* 4.6C *
REPORT zsdr_price_upload MESSAGE-ID zsdr_bdc_vk11 LINE-SIZE 150
LINE-COUNT 75 .
******Internal Table for Header Data.
TYPES : BEGIN OF type_header,
kschl LIKE konv-kschl,
vkorg LIKE vbak-vkorg,
vtweg LIKE komg-spart,
matnr LIKE mvke-matnr,
kbetr(11) TYPE c,
datab(10) TYPE c,
datbi(10) TYPE c,
END OF type_header.
****Internal Table for Item Level.
TYPES : BEGIN OF type_item,
kschl LIKE konv-kschl,
vkorg LIKE vbak-vkorg,
vtweg LIKE komg-spart,
matnr LIKE mvke-matnr,
kbetr(11) TYPE c,
datab(10) TYPE c,
datbi(10) TYPE c,
END OF type_item.
******Error Table For not found in MVKE.
TYPES : BEGIN OF type_error ,
kschl LIKE konv-kschl,
vkorg LIKE vbak-vkorg,
vtweg LIKE komg-spart,
matnr LIKE mvke-matnr,
kbetr LIKE konp-kbetr,
datab(10) TYPE c,
datbi(10) TYPE c,
text(100) TYPE c,
END OF type_error.
****For error Messages
TYPES : BEGIN OF type_mtab,
matnr LIKE mara-matnr,
msgtyp LIKE bdcmsgcoll-msgtyp,
msgid LIKE bdcmsgcoll-msgid,
msgnr LIKE bdcmsgcoll-msgnr,
text(100) TYPE c,
END OF type_mtab.
****Internal Table
TYPES: BEGIN OF type_mvke,
matnr LIKE mvke-matnr,
vkorg LIKE mvke-vkorg,
vtweg LIKE mvke-vtweg,
END OF type_mvke.
****Internal Table
TYPES : BEGIN OF type_tvkov,
vkorg LIKE tvkov-vkorg,
vtweg LIKE tvkov-vtweg,
END OF type_tvkov.
** Declaring Internal Tables
DATA : t_header TYPE STANDARD TABLE OF type_header,
t_item TYPE STANDARD TABLE OF type_item,
t_mvke TYPE STANDARD TABLE OF type_mvke,
t_tvkov TYPE STANDARD TABLE OF type_tvkov,
t_error TYPE STANDARD TABLE OF type_error,
t_mtab TYPE STANDARD TABLE OF type_mtab.
** Work Area Declaration.
DATA : wa_header LIKE LINE OF t_header,
wa_item LIKE LINE OF t_item,
wa_error LIKE LINE OF t_error,
wa_mtab LIKE LINE OF t_mtab,
wa_tvkov LIKE LINE OF t_tvkov,
wa_mvke LIKE LINE OF t_mvke.
**Rows for Table with Excel Data********
DATA: t_xls_file LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
***Constant.
DATA : c_params LIKE ctu_params.
DATA : c_ans(1) TYPE c.
DATA : v_count(4) TYPE c. " To show No.of records
DATA : bdctab LIKE bdcdata OCCURS 10 WITH HEADER LINE. " BDCDATA
DATA : tmess_mtab LIKE bdcmsgcoll OCCURS 10 WITH HEADER LINE.
** SELECTION SCREEN
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_fname LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK b1.
* END OF SELECTION SCREEN.
DATA : repid LIKE sy-repid.
DATA : v_matnr(50) TYPE c, "used for line items
v_kbetr(50) TYPE c, "used for line items
v_dat1(50) TYPE c, "used for line items
v_dat(50) TYPE c. "used for line items
DATA : v_lindx(5) TYPE n ,"index counter for first 14 records.
v_lindx1(5) TYPE n VALUE '01', "index counter for 13 records.
v_item(5) TYPE c, "To increment the line index
v_pgedwn2 TYPE i . "For Pagedown Counter
DATA: v_currentrow TYPE i. "For Current Row
DATA v_bdc(50) TYPE c." Text to apper in Confrim POPUP Window.
************AT SELECTION-SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
PERFORM get_filename USING p_fname.
*************START-OF-SELECTION
START-OF-SELECTION.
******Values for Ctu_params to Transaction
c_params-defsize = 'X'.
c_params-dismode = 'N'.
c_params-updmode = 'S'.
******Refresh
PERFORM f_refresh.
*********To upload File.
PERFORM upload_file.
****User Confrimation only BDC will Process
IF c_ans = '1'.
** *** BDC Process.
PERFORM read_data.
ELSE.
FORMAT COLOR 3 INTENSIFIED .
WRITE:/ 'Selected not to Process the Upload'.
EXIT.
ENDIF.
******On completion of Process Refresh the Internal Table
REFRESH : t_xls_file,
t_header,
t_item,
t_mvke,
t_tvkov.
CLEAR : t_xls_file,
wa_header,
wa_item,
wa_mvke,
wa_tvkov.
***********Display Messages
WRITE : /01 'Status',19 'Status Text'.
WRITE AT 0(150) sy-uline.
LOOP AT t_mtab INTO wa_mtab.
WRITE :/01 wa_mtab-msgtyp,19 wa_mtab-text.
ENDLOOP.
SKIP 2.
SORT t_error BY matnr.
WRITE AT 0(150) sy-uline.
WRITE 'ERROR MESSAGES'.
WRITE AT 0(150) sy-uline.
WRITE :/01 'Material.No',20 'Status Text'.
WRITE AT 0(150) sy-uline.
LOOP AT t_error INTO wa_error WHERE matnr NE ' '.
WRITE:/01 wa_error-matnr,20 wa_error-text.
ENDLOOP.
*& Form get_filename
* text
* -->P_FILENAME text
FORM get_filename USING p_fname.
*****To read the file from Presentation Server
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = repid
dynpro_number ! ; = syst-dynnr
field_name = p_fname
* STATIC = ' '
mask = '*.XLS'
CHANGING
file_name = p_fname
EXCEPTIONS
mask_too_long = 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. " get_filename
*& Form upload_file
* text
* --> p1 text
* <-- p2 text
FORM upload_file.
DATA : frow VALUE 2 TYPE i,
fcol VALUE 1 TYPE i,
erow VALUE 10000 TYPE i,
ecol VALUE 7 TYPE i,
ecol1 VALUE 1 TYPE i,
c_col1 TYPE i VALUE '0001',
c_col2 TYPE i VALUE '0002',
c_col3 TYPE i VALUE '0003',
&nb! sp; c_col4 TYPE i VALUE '0004',
c_col5 TYPE i VALUE '0005',
c_col6 TYPE i VALUE '0006',
c_col7 TYPE i VALUE '0007'.
***FM used to UPLOAD data from Flat file
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_fname
i_begin_col = fcol
i_begin_row = frow
i_end_col = ecol
i_end_row = erow
TABLES
intern = t_xls_file
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e000.
ENDIF.
****T_XLS_FILE is initial, stop the process & throw message
IF t_xls_file[] IS INITIAL.
FORMAT COLOR 6 ON INTENSIFIED ON.
WRITE:/ 'No Data Exists '.
FORMAT COLOR OFF INTENSIFIED OFF.
STOP.
ELSE.
* Sort table by rows and colums
SORT t_xls_file BY row col.
* Get first row retrieved
READ TABLE t_xls_file INDEX 1.
* Set first row retrieved to current row
v_currentrow = t_xls_file-row.
**Loop to move data in internal Table
LOOP AT t_xls_file .
* Reset values for next row
IF t_xls_file-row NE v_currentrow.
APPEND wa_header TO t_header.
CLEAR wa_header.
v_currentrow = t_xls_file-row.
ENDIF.
CASE t_xls_file-col.
WHEN c_col1. "Kschl
wa_header-kschl = t_xls_file-value.
WHEN c_col2. "Vkorg
wa_header-vkorg = t_xls_file-value.
WHEN c_col3. "vtweg
wa_header-vtweg = t_xls_file-value.
WHEN c_col4. "Matnr
wa_header-matnr = t_xls_file-value.
WHEN c_col5. "Kbetr
wa_header-kbetr = t_xls_file-value.
WHEN c_col6. "FROm
wa_header-datab = t_xls_file-value.
WHEN c_col7. "TO
wa_header-datbi = t_xls_file-value.
ENDCASE.
ENDLOOP.
APPEND wa_header TO t_header.
CLEAR wa_header.
ENDIF.
****To process the data
PERFORM f_process.
ENDFORM. " upload_file
*& Form READ_DATA
* text
* --> p1 text
* <-- p2 text
FORM read_data.
****To make Uniq Records in Header Level
SORT t_header BY kschl vkorg vtweg.
DELETE ADJACENT DUPLICATES FROM t_header COMPARING
kschl vkorg vtweg .
SORT t_item BY vkorg vtweg matnr.
DATA : wa1_item TYPE type_item.
DATA : l_cnt TYPE i.
DATA : flag(1) TYPE c. "to process the Line item.
***Looping Header Table.
LOOP AT t_header INTO wa_header.
PERFORM bdc_dynpro US! ING 'SAPMV13A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RV13A-KSCHL'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ANTA'.
PERFORM bdc_field USING 'RV13A-KSCHL'
wa_header-kschl.
PERFORM bdc_dynpro USING 'SAPLV14A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RV130-SELKZ(03)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=WEIT'.
PERFORM bdc_field USING 'RV130-SELKZ(03)'
'X'.
PERFORM bdc_dynpro USING 'SAPMV13A' '1004'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KOMG-VKORG'.
PERFORM bdc_field USING 'KOMG-VKORG'
wa_header-vkorg.
PERFORM bdc_field USING 'KOMG-VTWEG'
wa_header-vtweg.
****To handle Line Items.
LOOP AT t_item INTO wa1_item WHERE vkorg = wa_header-vkorg AND
vtweg = wa_header-vtweg.
wa_item = wa1_item.
******Flag Set only After processing first 14 records .
IF flag = ' '.
v_lindx = v_lindx + 01.
SHIFT v_lindx LEFT DELETING LEADING '0'.
v_item = v_lindx .
CONCATENATE 'KOMG-MATNR(' v_item ')' INTO v_matnr.
PERFORM bdc_field USING v_matnr
wa_item-matnr.
CONCATENATE 'KONP-KBETR(' v_item ')' INTO v_kbetr.
PERFORM bdc_field USING v_kbetr
wa_item-kbetr.
CONCATENATE 'RV13A-DATAB(' v_item ')' INTO v_dat.
PERFORM bdc_field USING v_dat
wa_item-datab.
CONCATENATE 'RV13A-DATBI(' v_item ')' INTO v_dat1.
PERFORM bdc_field USING v_dat1
wa_item-datbi.
IF v_item = 14.
flag = 'X'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=P+'.
PERFORM bdc_dynpro USING 'SAPMV13A' '1004'.
CLEAR v_lindx.
CLEAR v_item.
CONTINUE.
ENDIF.
ENDIF.
***Flag is Set after Processing of 14 records.
****** TO process rest of Records
IF flag = 'X'.
v_pgedwn2 = v_pgedwn2 + 1.
v_lindx1 = v_lindx1 + 01.
SHIFT v_lindx1 LEFT DE! LETING LEADING '0'.
v_item = v_lindx1 .
CONCATENATE 'KOMG-MATNR(' v_it! em ')' INTO v_matnr.
PERFORM bdc_field USING v_matnr
wa_item-matnr.
CONCATENATE 'KONP-KBETR(' v_item ')' INTO v_kbetr.
PERFORM bdc_field USING v_kbetr
wa_item-kbetr.
CONCATENATE 'RV13A-DATAB(' v_item ')' INTO v_dat.
PERFORM bdc_field USING v_dat
wa_item-datab.
CONCATENATE 'RV13A-DATBI(' v_item ')' INTO v_dat1.
PERFORM bdc_field USING v_dat1
wa_item-datbi.
IF v_pgedwn2 = 13.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=P+'.
PERFORM bdc_dynpro USING 'SAPMV13A' '1004'.
v_pgedwn2 = 0.
v_lindx1 = 1.
CLEAR v_item.
CONTINUE.
ENDIF.
ENDIF.
ENDLOOP.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SICH'.
****** Calling Transaction after Processing All items.
CALL TRANSACTION 'VK11' USING bdctab
OPTIONS FROM c_params MESSAGES INTO tmess_mtab.
REFRESH bdctab.
CLEAR : bdctab.
CLEAR : wa_item.
CLEAR : wa1_item.
CLEAR : wa_header.
CLEAR : l_cnt.
CLEAR : v_lindx1.
CLEAR: v_pgedwn2,v_lindx.
LOOP AT tmess_mtab .
l_cnt = l_cnt + 1.
READ TABLE t_item INTO wa_item INDEX l_cnt .
CALL FUNCTION 'MASS_MESSAGE_GET' "To get the Message Text
EXPORTING
arbgb = tmess_mtab-msgid
msgnr = tmess_mtab-msgnr
msgv1 = tmess_mtab-msgv1
msgv2 = tmess_mtab-msgv2
msgv3 = tmess_mtab-msgv3
msgv4 ! = tmess_mtab-msgv4
IMPORTING
msgtext = wa_mtab-text
EXCEPTIONS
message_not_found = 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.
wa_mtab-matnr = wa_item-matnr.
wa_mtab-msgtyp = tmess_mtab-msgtyp.
wa_mtab-msgid = tmess_mtab-msgid.
wa_mtab-msgn! r = tmess_mtab-msgnr.
APPEND wa_mtab TO t_mtab.
CLEAR wa_mtab-text.
CLEAR wa_item.
ENDLOOP.
ENDLOOP.
ENDFORM. " READ_DATA
*& Form BDC_DYNPRO
* text
* -->P_0300 text
* -->P_0301 text
* Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR bdctab.
bdctab-program = program.
bdctab-dynpro = dynpro.
bdctab-dynbegin = 'X'.
APPEND bdctab.
ENDFORM. " BDC_DYNPRO
*& Form BDC_FIELD
* text
* -->P_0305 text
* -->P_WA_HEADER_KSCHL text
* Insert field *
FORM bdc_field USING fnam fval.
CLEAR bdctab.
bdctab-fnam = fnam.
bdctab-fval = fval.
APPEND bdctab.
ENDFORM. " BDC_FIELD
*& Form bdc_trc_ansaction
* text
* -->P_0527 text
*& Form f_Process
* text
* --> p1 text
* <-- p2 text
FORM f_process.
DATA : l_todate(12) TYPE c,
l_frdate(12) TYPE c.
***Select for all entries of material in Header "Flat File Materials".
IF NOT t_header[] IS INITIAL.
SELECT matnr vkorg vtweg FROM mvke INTO TABLE t_mvke FOR ALL ENTRIES
IN t_header WHERE matnr = t_header-matnr AND
vkorg = t_header-vkorg AND
vtweg = t_header-vtweg.
ENDIF.
*********select Sales.org & Dist.channel.
IF NOT t_header[] IS INITIAL.
SELECT vkorg vtweg FROM tvkov INTO TABLE t_tvkov FOR ALL ENTRIES IN
t_header WHERE vkorg = t_header-vkorg
AND vtweg = t_header-vtweg.
ENDIF.
***Checking for material in Sales Master Table
SORT t_mvke BY matnr vkorg vtweg.
SORT t_tvkov BY vkorg vtweg.
LOOP AT t_header INTO wa_header.
READ TABLE t_mvke INTO wa_mvke WITH KEY matnr = wa_header-matnr
vkorg = wa_header-vkorg
! ; vtweg = wa_header-vtweg BINARY SEARCH.
IF sy-subrc <> 0.
wa_error = wa_header.
&nb! sp; MOVE text-011 TO wa_error-text.
APPEND wa_error TO t_error.
DELETE TABLE t_header FROM wa_header.
ELSE.
********Date Validations
IF ( wa_header-datab NE ' ! ; ' AND wa_header-datbi NE ' ' ) .
l_todate = wa_header-datab.
l_frdate = wa_header-datbi.
REPLACE '.' INTO l_toda! te WITH ''.
REPLACE '.' INTO l_todate WITH ''.
CONDENSE l_todate NO-GAPS.
REPLACE '.' INTO l_frdate WITH ''.
REPLACE '.' INTO l_frdate WITH ''.
CONDENSE l_frdate NO-GAPS.
IF l_frdate < l_todate.
wa_error = wa_header .
MOVE text-012 TO wa_error-text.
APPEND wa_error TO t_error.
DELETE TABLE t_header FROM wa_header.
ENDIF.
ELSE.
wa_error = wa_header .
MOVE text-016 TO wa_error-text.
APPEND wa_error TO t_error.
DELETE TABLE t_header FROM wa_header.
ENDIF.
ENDIF.
********Rate Validation.
IF wa_header-kbetr = ' '.
wa_error = wa_header .
MOVE text-017 TO wa_error-text.
APPEND wa_error TO t_error.
DELETE TABLE t_header FROM wa_header.
ENDIF.
READ TABLE t_tvkov INTO wa_tvkov WITH KEY vkorg = wa_header-vkorg
BINARY SEARCH.
IF sy-subrc = 0.
READ TABLE t_tvkov INTO wa_tvkov WITH KEY vtweg = wa_header-vtweg
BINARY SEARCH.
IF sy-subrc <> 0.
wa_error = wa_header.
MOVE text-015 TO wa_error-text.
WRITE wa_header-vtweg TO wa_error-text+13(4).
APPEND wa_error TO t_error.
ENDIF.
ELSE.
wa_error = wa_header.
MOVE text-013 TO wa_error-text.
WRITE wa_header-vkorg TO wa_error-text+9(4).
APPEND wa_error TO t_error.
ENDIF.
CLEAR wa_header.
ENDLOOP.
*****Deleting Duplicate Material Form Header "Flat File Data".
SORT t_header BY kschl vkorg vtweg matnr.
DELETE ADJACENT DUPLICATES FROM t_header COMPARING
kschl! vkorg vtweg matnr .
* ****Data Moving from Header to Item Level.
t_item[] = t_header[].
*To count No.of records in Item Table.
DESCRIBE TABLE t_item LINES v_count.
CONCATENATE text-014 ' ' v_count INTO v_bdc.
****Popup to get Confirmation from user to process BDC
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'Confirmation of File Data'
text_question = v_bdc
text_button_1 = 'Confirm'
text_button_2 = 'Cancel Run'
default_button = '1'
IMPORTING
answer = c_ans.
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. " f_Process
*& Form f_Refresh
* text
* --> p1 text
* <-- p2 text
FORM f_refresh.
REFRESH : t_xls_file,
t_header,
t_item,
t_mvke,
t_tvkov,
t_error,
t_mtab.
CLEAR : t_xls_file,
wa_header,
wa_item,
wa_mvke,
wa_tvkov,
wa_error,
wa_mtab.
ENDFORM. " f_Refresh
reward point s if it is usefull ....
girish -
Hi
Can any one tell me how to create <b>Generic BDC for transaction VK11 (Creating condition records)</b>
My actual requirement is like we need to create <b>condition record</b> for every material with all the condition types exist for that material for different key combinations dynamically . <b>A condition record for every material is to be created for different condition types and different key combinations dynamically where material MATNR is a key field</b> for example i need to create a conditon record for condition type <b>ZPR0,ZPR1</b> etc dynamically for different key combinations.
can anyone of you point out a way to me?
Thanks in advance
ShivakumarHi
Can any one tell me how to create <b>Generic BDC for transaction VK11 (Creating condition records)</b>
My actual requirement is like we need to create <b>condition record</b> for every material with all the condition types exist for that material for different key combinations dynamically . <b>A condition record for every material is to be created for different condition types and different key combinations dynamically where material MATNR is a key field</b> for example i need to create a conditon record for condition type <b>ZPR0,ZPR1</b> etc dynamically for different key combinations.
can anyone of you point out a way to me?
Thanks in advance
Shivakumar -
Mass upload for VK11 - Additional Data
I'm currently using the RV_CONDITION_COPY to upload data to VK11. However, I can't find a way to include in the upload the Additional Data (F7). I will be including only the field "Max.number.of.orders (ANZAUF).
I will appreciate your help guys.Hi,
you could also check report RV14BTCI.
For this report you create a file with your conditions and then start the report to update them in SAP.
Best regards,
Oliver -
Hi All,
I got a requirement to upload Condition records through trnx VK11 , but I have one doubt , how can we handle the radio buttons ( Table ) dyamically for every Condition type???
Ex : for condition type 'X' it has choose the table '111' and for condition type 'Y' it has to choose '222' and so on ...
How to do the recording for this requirement ???
I am really confused with this...Please suggest me
Thanks in advance.Hi,
Why don't you use BAPI BAPI_PRICES_CONDITIONS instead?
Please check this sample code from other thread.
wtable1-table_no = '306'.
wtable1-applicatio = 'V'.
wtable1-cond_type = 'ZPR0'.
wtable1-operation = '009'.
wtable1-varkey = '13001001USD 000000000050068946'.
wtable1-valid_to = '99991231'.
wtable1-valid_from = '20051101'.
wtable1-cond_no = '$000000001'.
APPEND wtable1 TO table1.
wtable2-operation = '009'.
wtable2-cond_no = '$000000001'.
wtable2-created_by = sy-uname.
wtable2-creat_date = '20051022'.
wtable2-cond_usage = 'A'.
wtable2-table_no = '110'.
wtable2-applicatio = 'V'.
wtable2-cond_type = 'ZPR0'.
wtable2-varkey = '13001001USD 000000000050068946'.
wtable2-valid_from = '20051101'.
wtable2-valid_to = '99991231'.
APPEND wtable2 TO table2.
wtable3-operation = '009'.
wtable3-cond_no = '$000000001'.
wtable3-cond_count = '01'.
wtable3-applicatio = 'V'.
wtable3-cond_type = 'ZPR0'.
wtable3-scaletype = 'A'.
wtable3-scalebasin = 'C'.
wtable3-scale_qty = '1'.
wtable3-cond_p_unt = '1'.
wtable3-cond_unit = 'EA'.
wtable3-calctypcon = 'C'.
wtable3-cond_value = '454'.
wtable3-condcurr = 'USD'.
APPEND wtable3 TO table3.
CALL FUNCTION 'BAPI_PRICES_CONDITIONS'
EXPORTING
PI_initialmode = 'X'
PI_BLOCKNUMBER =
TABLES
ti_bapicondct = table1
ti_bapicondhd = table2
ti_bapicondit = table3
ti_bapicondqs = table4
ti_bapicondvs = table5
to_bapiret2 = table6
to_bapiknumhs = table7
to_mem_initial = table8
EXCEPTIONS
update_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.
READ TABLE table6 WITH KEY type = 'E' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
loop at table6 into ret.
write: / ret-type, ret-message, ret-id, RET-LOG_NO, RET-LOG_MSG_NO,
RET-MESSAGE_V1, RET-MESSAGE_V2, RET-MESSAGE_V3, RET-MESSAGE_V4,
RET-PARAMETER,RET-ROW,RET-FIELD.
endloop.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*EXPORTING
WAIT =
IMPORTING
return = ret
ENDIF.
Also there are other options:
- from LSMW the report RV14BTCI
- batch input to transaction XK15
- using FM modules RV_CONDITION* (e.g. _copy and _save)
Hope this will help.
Regards,
Ferry Lianto -
i have created a BDC program for uploading data into VK11 & VK12 .what it does that it compares the valid from and valid to dates from the flat files
and if they already exist then for that condiotn type it goes to vk 12 and changes the prices and scalling quantity according to the falt file
and if the date range is not present then it oes to VK11 and creates the same from the flat file
now i want a bapi that works the same manner..
if any body can hel;p me
thanks in advanceI am using the RV_condition_copy function the way it is described in this post, I am able to update the date but not the price in Vk12 / vk13 . I am using option D for maintain_mode (create with reference) - > this is essentially what I want to do, as we already ahve the pricing in vk13, we want to change it for year 2008.
Please advise what I must be doing wrong. I do not get any errors while running the following code. Also I am doing commit. Thanks.
Pranav
Do I have to pass any values to I_komk I_komp, i do not have anything to pass.??!$#?
ls_komg-kunnr = '0001000008'. " Cust number
ls_komg-matnr = 'PP500P3'. " Mat number
ls_komg-VKORG = 'PPC1'.
ls_komg-vtweg = 'BB'.
clear: Lt_komv,LS_KOMV.
ls_komv-kappl = 'V '. " Application V = Sales
ls_komv-kschl = 'PR00'. " Condition type
ls_komv-waers = 'USD'. " Currency
ls_komv-kmein = 'EA'. " Unit of measurement
ls_komv-kpein = '100'.
ls_komv-krech = 'C'. " calculation type;
"M = Quantity - monthy price
LS_KOMV-KAWRT = '251.00'.
ls_komv-kbetr = '121.50'. " new condition value
*LS_KOMV-KWERT_K = '251.10'.
*LS_KOMV-KNUMV ='0000008911'
append ls_komv to lt_komv.
CLEAR LT_KOMV.
call function 'RV_CONDITION_COPY'
exporting
application = 'V'
condition_table = '005' " cond. table
condition_type = 'PR00' " cond. type
date_from = '20070108' " valid on
date_to = '99991231' " valid to
enqueue = 'X' " lock entry
i_komk = ls_komk
i_komp = ls_komp
key_fields = ls_komg " key fields
maintain_mode = 'D' " A= create
" B= change,
" C= display
" D= create with reference
with reference
no_authority_check = 'X'
keep_old_records = 'X'
overlap_confirmed = 'X'
no_db_update = space
importing
e_komk = ls_komk
e_komp = ls_komp
new_record = lv_new_record
tables
copy_records = lS_komv
EXCEPTIONS
ENQUEUE_ON_RECORD = 1
INVALID_APPLICATION = 2
INVALID_CONDITION_NUMBER = 3
INVALID_CONDITION_TYPE = 4
NO_SELECTION = 5
TABLE_NOT_VALID = 6
NO_AUTHORITY_EKORG = 7
NO_AUTHORITY_KSCHL = 8.
call function 'RV_CONDITION_SAVE'.
call function 'RV_CONDITION_RESET'.
necessary to write data
commit work.
Message was edited by:
pranav kulkarni -
Hi Experts.
WE have mass data to introduce by VK11.WE want to use LSMW recording.
But the problem;
We input condition type,then we have to select key combination.But we have to scroll down to click key combination.And lsmw does not read sroll down and select the first key combination instead of ours.
İs the any solution to solve tihis problem..
Thanks in advance..HI
Not required to Take scroll down
After you created a First Step , take the Table and Fields names of
Suppose Condition Type is PR00 , Key Combination : Customer / Material
You need to maintain the Excel for the fields Condition type, Sale Org., Distribution Channel , Customer & material , Amount l if you required From date and TO date
before execute the last step , before one more step is there , in that step just check whether values are uploaded correctly or not
if not just check the file and do the necessary changes and same it in the same file name
Run the Once with File upload Step onward's
Kindly Avoid Posting into multiple forums , same thread you are posted in MM Forum
for you reference check the below link
[lsmw recording does not read Scroll down |Re: lsmw recording does not read Scroll down]
Regards,
Prasanna -
Hi friends
I have created a bdc(by call transaction ) to upload data to tcode vk11 and it works fine but also I need to add a validation that if a duplicate value is found in local file that is already found in vk01 it should give information that value already found how this can be achieved .Hi,
1.Get all the values into internal table.
2. get all the values from vk11 DB table.
3. Loop VK11 table records and read the internal table records. If sy-subrc fails, then process the BDC.
Regards,
Veda Moorthy Rajan -
Restricting access for condition types in VK11
Hi
ZWX1 and ZWX2 are SD discount condition types, I should use these condition types only for sales deal , hence , I will create condition record only in VB21 with reference to sales deal.
Some other users may create condition records in VK11 mistakenly, I need to avoid it, so these condition types should not be accessible to create condition records in VK11 or anywhere except VB21.
Any thought ? how can I achieve this ?
thanksHi
If you want to restrict the access for the condition types then you give the authorization for VK11 for maritaining the condition records only to those users who has to maintain the condition records for that condition types.So you have to take the help of BASIS team
Regards
Srinath -
Hi friends,
I am wokring on LSMW for VK11 transaction. I have to use batch input standard program....
can any body help me in this regard.
Regards,
JayanHi
a) For Standard Batch/Direct Input i believe we can assign 2 files (structures) , but it is possible for batch input recording ?
b) If this is possible, how can i assign the second file (detail structure) to C201 recording ?
In [this post|Re: LSMW load Customer data with Table like file with Header and Item records ?] you can read a good discussion about a problem like yours (header, item):
I believe you can use both solutions: single or double files.
c) How can i mapping the detail file fields to recording fields (PLPOD-ARBPL(01), PLPOD-ARBPL(02),..) ?
Just as Breakpoint said you can check if there's a chance in order to place the record to the top line, else it could be a problem
Max
Maybe you are looking for
-
Camera Raw editing is not enabled. Camera Raw editing requires that a qualifying product has been launched at least once to enable this feature.This appears when the open in camera raw disc is clicked in bridge. any solutions??
-
Can you tie mobile device to adobe acrobat to sign pdfs?
I work in the medical field and I think it would be awesome if there was an Adobe app that allowed for people to sign pdf's on their cell phone. You can't imagine how useful it would be to get permissions and MD orders signed on the go.
-
I have a problem when i try to install oracle RAC on 2 x86 solaris machines when i run the script : ./clusvfy to check the two nodes ... i got an error message that says : USER EQUIVELANCE UNAVAILABLE ON ALL THE NODES if anyone could help me i would
-
Aggregate Layout for FAS2552 AFF VDI
Hi - recently racked a fas2552 with NO external storage all SSD system. Upgraded it to 8.3P1. This system is for our VDI environment. (2 nodes) single chassis). Setup up 10G NFS and will present datastores as NFS. I was just curious since there are 2
-
Update Nightmare, Phone is wiping and scrubbing?!?!
Good day My hubby told me to update my new bb curve 8330, so I plugged it in and started. It kept asking for a password so I typed in the one I use to lock my phone. And well thats not it, so I kept trying and well now my phone wiped and is now scrub