Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Update/create the sales price condition

Former Member
0 Kudos

Hi All,

i got a requirment to develop a call transaction for the transaction VK11(Condition Records) for condition type ZPR0.

which has to update:

Material no, sales organization, currency and unit of measure(in the standard ISO code).

can any one help me in writing the code for this..

BAPIs are first priforable for this requirment.

Thanks and Regards,

Rama

3 REPLIES 3

Former Member
0 Kudos

Hi,

You can use the BAPI BAPI_PRICES_CONDITIONS.

Check this link for a sample code

Thanks

Naren

0 Kudos

Hi Naren,

The code given in the thread is very much usefull to me.

i have a few doubts in this:

1) will this BAPI is useful for both Create and Change modes.

2) how to find the BAPICONDCT-TABLE_NO(Condition table)

3) what value do we need to pass to BAPICONDCT-OPERATION, how can we find this value and what does the value '009' is for.

4) do we need to pass the value for BAPICONDCT-COND_NO(Condition record number), is it must.

please help me ASAP.

Thanks,

Rama

Former Member
0 Kudos

Hi

See the sample BDC for VK11 and do accordingly, if BAPI is not useful to you

report ZSDBDCP_PRICING no standard page heading

line-size 255.

include zbdcrecx1.

*--Internal Table To hold condition records data from flat file.

Data: begin of it_pricing occurs 0,

key(4),

f1(4),

f2(4),

f3(2),

f4(18),

f5(16),

end of it_pricing.

*--Internal Table To hold condition records header .

data : begin of it_header occurs 0,

key(4),

f1(4),

f2(4),

f3(2),

end of it_header.

*--Internal Table To hold condition records details .

data : begin of it_details occurs 0,

key(4),

f4(18),

f5(16),

end of it_details.

data : v_sno(2),

v_rows type i,

v_fname(40).

start-of-selection.

refresh : it_pricing,it_header,it_details.

clear : it_pricing,it_header,it_details.

  • CALL FUNCTION 'UPLOAD'

  • EXPORTING

  • FILENAME = 'C:\WINDOWS\Desktop\pricing.txt'

  • FILETYPE = 'DAT'

  • TABLES

  • DATA_TAB = it_pricing

  • EXCEPTIONS

  • CONVERSION_ERROR = 1

  • INVALID_TABLE_WIDTH = 2

  • INVALID_TYPE = 3

  • NO_BATCH = 4

  • UNKNOWN_ERROR = 5

  • GUI_REFUSE_FILETRANSFER = 6

  • OTHERS = 7.

WRITE : / 'Condition Records ', P_FNAME, ' on ', SY-DATUM.

OPEN DATASET P_FNAME FOR INPUT IN TEXT MODE.

if sy-subrc ne 0.

write : / 'File could not be uploaded.. Check file name.'.

stop.

endif.

CLEAR : it_pricing[], it_pricing.

DO.

READ DATASET P_FNAME INTO V_STR.

IF SY-SUBRC NE 0.

EXIT.

ENDIF.

  • write v_str.

  • translate v_str using '#/'.

SPLIT V_STR AT ',' INTO it_pricing-key

it_pricing-F1 it_pricing-F2 it_pricing-F3

it_pricing-F4 it_pricing-F5 .

APPEND it_pricing.

CLEAR it_pricing.

ENDDO.

IF it_pricing[] IS INITIAL.

WRITE : / 'No data found to upload'.

STOP.

ENDIF.

loop at it_pricing.

At new key.

read table it_pricing index sy-tabix.

move-corresponding it_pricing to it_header.

append it_header.

clear it_header.

endat.

move-corresponding it_pricing to it_details.

append it_details.

clear it_details.

endloop.

perform open_group.

v_rows = sy-srows - 8.

loop at it_header.

perform bdc_dynpro using 'SAPMV13A' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RV13A-KSCHL'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RV13A-KSCHL'

it_header-f1.

perform bdc_dynpro using 'SAPMV13A' '1004'.

perform bdc_field using 'BDC_CURSOR'

'KONP-KBETR(01)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'KOMG-VKORG'

it_header-f2.

perform bdc_field using 'KOMG-VTWEG'

it_header-f3.

**Table Control

v_sno = 0.

loop at it_details where key eq it_header-key.

v_sno = v_sno + 1.

clear v_fname.

CONCATENATE 'KOMG-MATNR(' V_SNO ')' INTO V_FNAME.

perform bdc_field using v_fname

it_details-f4.

clear v_fname.

CONCATENATE 'KONP-KBETR(' V_SNO ')' INTO V_FNAME.

perform bdc_field using v_fname

it_details-f5.

if v_sno eq v_rows.

v_sno = 0.

perform bdc_dynpro using 'SAPMV13A' '1004'.

perform bdc_field using 'BDC_OKCODE'

'=P+'.

perform bdc_dynpro using 'SAPMV13A' '1004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

endif.

endloop.

*--Save

perform bdc_dynpro using 'SAPMV13A' '1004'.

perform bdc_field using 'BDC_OKCODE'

'=SICH'.

perform bdc_transaction using 'VK11'.

endloop.

perform close_group.

Regards

Anji