Skip to Content
0
Oct 17, 2011 at 11:19 AM

Adding default line items on VA01/VA21 based on Incoterms

328 Views

Hi Experts,

Is there a way to add a default line items (material list) on the Quotation/Sales Order creation based on the Incoterms, I was able to do that but I have to hardcode some data since I don't know where to get it. Here are my code:

check vbkd-inco1 is not initial.

select

makt~matnr

makt~maktx

zmilssd01~etenr

into corresponding fields of table it_mara

from zmilssd01

inner join makt on maktmatnr eq zmilssd01matnr

where spart eq vbak-spart

and inco1 eq vbkd-inco1.

if zzinco1 ne vbkd-inco1.

refresh: xvbap, ivbap, xvbep, ivbep.

clear: xvbap, ivbap, xvbep, ivbep.

endif.

clear p_ctr.

sort it_mara by etenr.

if it_mara[] is not initial and xvbap[] is initial..

loop at it_mara.

clear vbap.

add 1 to p_ctr.

vbap-mandt = vbak-mandt.

vbap-vbeln = vbak-vbeln.

  • HARD-CODED PART *************************************

vbap-matkl = 'FFS'.

vbap-pstyv = 'AGX'.

vbap-zieme = 'AU'.

vbap-umziz = 1.

vbap-umzin = 1.

vbap-meins = 'AU'.

vbap-spart = 'SE'.

vbap-gsber = 'C9S3'.

vbap-netwr = 0.

vbap-waerk = 'MYR'.

vbap-antlf = 9.

vbap-vrkme = 'AU'.

vbap-gewei = 'KG'.

vbap-erlre = 'B'.

vbap-werks = 'C902'.

vbap-vstel = 'FFS1'.

vbap-erdat = sy-datum.

vbap-ernam = sy-uname.

vbap-erzet = sy-uzeit.

vbap-umvkz = 1.

vbap-umvkn = 1.

  • HARD-CODED PART *************************************

p_posnr = p_ctr * 10.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = p_posnr

importing

output = vbap-posnr.

vbap-matnr = it_mara-matnr.

vbap-matwa = it_mara-matnr.

vbap-arktx = it_mara-maktx.

move vbap to xvbap.

xvbap-updkz = 'I'.

append xvbap.

ivbap-posnr = vbap-posnr.

ivbap-tabix = p_ctr.

append ivbap.

endloop.

zzinco1 = vbkd-inco1.

endif.

I just want to know where to get the data of the hardcoded part given only the material number (just like on the VA21/VA01 item screen where you only need to input material number and the XVAP/IVBAP table was auto populated.)

By the way, I used exit of MV45AFZZ form userexit_move_field_to_vbak to input my code.

Thanks,

Eric