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: 

Problem with BDC of Tcode VA01

Former Member
0 Kudos

I'm having a problem while writing a BDC for Tcode VA01.

After giving the order type, sales org., distribution channel and division in the first screen, the screen prompts for contract no., where we give the contract no. The next screen comes with customer code and the relevant materials given in that particular contract no. Suppose we have contract for 5 materials for that customer in the relevant contract no. but while doing the BDC, i want 3 of the materials and put the corresponding quantity against them and delete the rest of the 2 materials from the screen. The flat file that i have to upload contains customer code, material no. and quantity.

Please guide me as how this should be done.

I've already recorded the Transaction with SHDB, but i cant make out how to select which materials i've to keep and which all to delete after matching with the excel.

4 REPLIES 4

Former Member
0 Kudos

Since you have contract already in system, you will know the sequence of materials in the contract i.e. you can use EBELP field to select the line that you want to modify.

you can use the following code example for selecting a line

FORM select_line USING p_counter.

DATA: l_string(20) TYPE c.

CONCATENATE 'RC27X-FLG_SEL(' p_counter ')' INTO l_string.

PERFORM populate_bdc_tab USING:

'1' 'SAPLCPDI' '4400',

'' 'BDC_OKCODE' '/00',

  • '' 'RC27X-ENTRY_ACT' '1',

'' l_string 'X'.

ENDFORM. " select_line

In case you do not have information on the line number of item to be selected, you can query into contract table with material and quantity to find exact line number.

Once you have a line selected, the item detail screen can be accessed and relevant modification can be done.

Hope this helps.

Former Member
0 Kudos

Dear Anindita,

Please go through the following lines of code:

Batch Input Program for Transaction VA01

How to Create a batch input program for transaction VA01.

The scenerio is

Input fields: Manditory fields to create a new Sales Order using VA01.

Hint: Take an existing Sales Order and use the master data which was previously used.

Conditions:

1)Upload the input data from a text file stored in your note pc.

2)Use call transaction method.

3)Your program should allow to input the file path and file name to select the data.

Here I'm attaching BDC Code for 'VA01'.

report ZBDC3_VA01

no standard page heading line-size 255.

include bdcrecx1.

types : begin of ty_head,

auart(4),

vkorg(4),

vtweg(2),

spart(2),

kunnr(10),

bstkd(10),

end of ty_head.

types: begin of ty_item,

matnr(18) type c,

kwmeng(13) type c,

end of ty_item.

data: it_head type table of ty_head. " Header

data: wa_head like line of it_head.

data: it_item type table of ty_item. " Item

data: wa_item like line of it_item.

data:v_kwmeng(30) type c,

v_mabnr(30) type c.

DATA: VAL(2) TYPE N VALUE 01.

DATA : w_file2 TYPE string,

w_file1 TYPE string.

PARAMETERS: filename LIKE rlgrap-filename.

PARAMETERS: filenam1 LIKE rlgrap-filename.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

file_name = filename.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR filenam1.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

file_name = filenam1.

START-OF-SELECTION.

w_file2 = filename.

w_file1 = filenam1.

                              • HEADER ************************

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = w_file2

filetype = 'ASC'

has_field_separator = 'X'

TABLES

data_tab = it_head.

                              • Item *******************

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = w_file1

filetype = 'ASC'

has_field_separator = 'X'

TABLES

data_tab = it_item.

perform open_group.

loop at it_head into wa_head.

.

perform bdc_dynpro using 'SAPMV45A' '0101'.

perform bdc_field using 'BDC_CURSOR'

'VBAK-AUART'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'VBAK-AUART'

WA_HEAD-AUART.

perform bdc_field using 'VBAK-VKORG'

WA_HEAD-VKORG.

perform bdc_field using 'VBAK-VTWEG'

WA_HEAD-VTWEG.

perform bdc_field using 'VBAK-SPART'

WA_HEAD-SPART.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'VBKD-BSTKD'

WA_HEAD-BSTKD.

perform bdc_field using 'VBKD-BSTDK'

'30.01.2006'.

perform bdc_field using 'KUAGV-KUNNR'

WA_HEAD-KUNNR.

perform bdc_field using 'RV45A-KETDAT'

'30.01.2006'.

perform bdc_field using 'RV45A-KPRGBZ'

'D'.

perform bdc_field using 'VBKD-ZTERM'

'0001'.

perform bdc_field using 'VBKD-INCO1'

'CIF'.

perform bdc_field using 'VBKD-INCO2'

'COST INSUSRABCE FRIEGHT'.

loop at it_item into wa_item .

CONCATENATE 'RV45A-MABNR(' '0' VAL ')' INTO v_MABNR. CONCATENATE 'RV45A-KWMENG(' '0' VAL ')' INTO v_kwmeng.

perform bdc_field using 'BDC_CURSOR'

v_kwmeng.

perform bdc_field using v_mabnr

wa_item-matnr.

perform bdc_field using v_kwmeng

wa_item-kwmeng.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

VAL = VAL + 1.

IF VAL > 5.

VAL = 5.

ENDIF.

endloop.

VAL = 01.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'BDC_OKCODE'

'=SICH'.

perform bdc_transaction using 'VA01'.

endloop.

perform close_group.

Regards,

Abir

***********************************

  • Don't forget to award points *

Former Member
0 Kudos

I've solved this issue ...

thanks

Anindita

0 Kudos

How did you solve it?