11-17-2006 9:45 AM
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.
11-17-2006 9:55 AM
this can be implemented by simple ABAP logic...
I saw that there are 3 radio buttons...
You Recording will be split into 2 parts... ths 1st part till the radio button and the 2nd part after the radio button.
You will have to record the BDC for all the 3 cases....
then just put a if-else condition and populate the rest BDC.
Pseudo code will be like this ...
if RB_1 = 'X'
perform sub_fill_bdc_with_condition_1.
else if RB_2 = 'X'
perform sub_fill_bdc_with_condition_2.
else.
perform sub_fill_bdc_with_condition_3.
endif.
I hope this will be helpful... It is just like normal BDC... just that the u are populating differently in different cases...
Please award points if this was helpful...
Also feel free to come back if there are some doubts unanswered...
11-17-2006 9:58 AM
Now, as U have radio buttons, u need to implement conditions. If first radio button selected, then select table 111...if second radio button selected, then select table 222 & so...on
U need to record the no of times the radio buttons in SHDB & then analyze & implement the code properly so that it works for all scenarios.
11-17-2006 10:16 AM
Hi
The various options of radiobuttons that we see in VK11 transaction are the various access sequences defined for the condition type. This can vary in a long run.
Hence, i recommend considering Batch Input Program: RV14BTCI to upload the condition records.
Documentation of the program can help you handle the same.
Also consider using transaction XK15 as we can use this transaction for loading both Sales and Purchase Condition records i.e both that can done via VK11 and MEK1.
Hope the above info helps you.
Kind Regards
Eswar
11-17-2006 12:32 PM
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