2008 Mar 28 8:12 AM
Hi,
How to create the sales order life cycle using CATT tool.
Can anyone send me the step by step process how to create.
i heared that we need to maintain data in notepad.
Need that process also.
regards,
kb
2008 Mar 28 8:22 AM
Hi,
Its Better to create Sales Order Using BDC rather than CATT.
See this Link .. CATT Tutorial.
[CATT|http://help.sap.com/printdocu/core/print46b/en/data/en/pdf/BCCATTUT.pdf]
See example Program to create BDC.
report zbdcva01 line-size 132 .
*** ZPOP
*$*$ Create Sales Order With Product Proposal
*$*$ Author M.S.Anand
*$*$ Date written : 10.03.99
*$*$ Initiated By : Sreedhar
data : begin of i_tab occurs 0,
kunnr(10), " Customer No
bstnk(20), " P.O Number
bstdk(10), " P.O Date
* zterm(4), " Payment term
matnr(18), " Material
zmeng(17), " Target Qty
end of i_tab .
data: begin of bdc_tab occurs 0.
include structure bdcdata.
data: end of bdc_tab.
data: begin of bdc_tab2 occurs 0.
include structure bdcdata.
data: end of bdc_tab2.
data : error(1) value 'N' ,
text(11) type c value 'Record No.' ,
wrk_matnr like marc-matnr,
count type i .
data : infile like rlgrap-filename.
parameters : p_auart like vbak-auart,
p_vkorg like vbak-vkorg,
p_vtweg like vbak-vtweg,
p_spart like vbak-spart,
p_group like bgr00-group obligatory .
data w_matnr(14) value 'VBAP-MATNR(XX)'.
data w_zmeng(16) value 'RV45A-KWMENG(XX)'.
data w_ctr(2) type n .
data w_ctr2(2) type n.
data w_matnrend like vbap-matnr .
data w_zmengend(15) .
data w_zterm(4) .
data w_datum(10) .
start-of-selection .
write sy-datum mm/dd/yyyy to w_datum .
call function 'UPLOAD'
exporting
codepage = 'IBM'
filename = infile
filetype = 'DAT'
tables
data_tab = i_tab.
w_ctr = 1.
call function 'BDC_OPEN_GROUP'
exporting
client = sy-mandt
group = p_group
keep = 'X'
user = sy-uname.
* sort i_tab.
loop at i_tab .
move i_tab-matnr to w_matnrend .
move i_tab-zmeng to w_zmengend .
if w_ctr = 1.
perform generate_bdc_data_head.
perform generate_bdc_data_step1 .
endif .
move w_ctr to w_matnr+11(2).
move w_ctr to w_zmeng+13(2).
perform generate_bdc_data_step2.
w_ctr = w_ctr + 1 .
if w_ctr > 10 .
perform create_item.
w_ctr = 2 .
endif .
** move i_tab-zterm to w_zterm .
at end of kunnr.
* move w_ctr to w_matnr+11(2).
* move w_ctr to w_zmeng+11(2).
* perform generate_bdc_data_matl_end .
perform generate_bdc_data_step3.
call function 'BDC_INSERT'
exporting
tcode = 'VA01'
tables
dynprotab = bdc_tab.
w_ctr = 1.
endat.
endloop .
call function 'BDC_CLOSE_GROUP'.
* perform generate_sm35_data .
call transaction 'SM35' .
* call transaction 'VA51' using bdc_tab mode 'A'.
*write:/ i_tab-ktext, i_tab-guebg,i_tab-gueen,i_tab-matnr,i_tab-zmeng.
* endloop .
*---------------------------------------------------------------------*
* FORM GENERATE_BDC_DATA *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form generate_bdc_data_head .
refresh bdc_tab.
perform dynpro using:
'X' 'SAPMV45A' '0101',
' ' 'VBAK-AUART' p_auart,
' ' 'VBAK-VKORG' p_vkorg,
' ' 'VBAK-VTWEG' p_vtweg,
' ' 'VBAK-SPART' p_spart,
' ' 'BDC_OKCODE' 'ENT2'.
endform .
*---------------------------------------------------------------------*
* FORM GENERATE_BDC_DATA *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*-
form generate_bdc_data_step1 .
perform dynpro using:
'X' 'SAPMV45A' '0402',
' ' 'KUAGV-KUNNR' i_tab-kunnr,
' ' 'VBAK-BSTNK' i_tab-bstnk,
' ' 'VBAK-BSTDK' i_tab-bstdk,
' ' 'BDC_OKCODE' 'ENT1' .
endform .
*---------------------------------------------------------------------*
* FORM GENERATE_BDC_DATA_STEP3 *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form generate_bdc_data_step3 .
perform dynpro using:
'X' 'SAPMV45A' '0402',
' ' 'BDC_OKCODE' 'SICH'.
endform .
*---------------------------------------------------------------------*
* FORM GENERATE_BDC_DATA_MATL *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form generate_bdc_data_step2.
perform dynpro using:
'X' 'SAPMV45A' '0402',
' ' w_matnr i_tab-matnr,
' ' w_zmeng i_tab-zmeng.
endform .
*---------------------------------------------------------------------*
* --> DYNBEGIN *
* --> NAME *
* --> VALUE *
*---------------------------------------------------------------------*
form dynpro using dynbegin name value.
if dynbegin = 'X'.
clear bdc_tab.
move: name to bdc_tab-program,
value to bdc_tab-dynpro,
'X' to bdc_tab-dynbegin.
append bdc_tab.
else.
clear bdc_tab.
move: name to bdc_tab-fnam,
value to bdc_tab-fval.
append bdc_tab.
endif.
endform.
" GENERATE_BDC_DATA_MATL_NEW
*---------------------------------------------------------------------*
* FORM CREATE_ITEM *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form create_item.
perform dynpro using :
'X' 'SAPMV45A' '0402' ,
' ' 'BDC_OKCODE' 'POAN'.
endform. " Create Item
**&---------------------------------
**------------------------------------*
**& Form PROCESS_DATA_STEP_SAVE
**&---------------------------------
**------------------------------------*
** text
**----------------------------------
**------------------------------------*
** --> p1 text
** <-- p2 text
**----------------------------------
**------------------------------------*
*FORM PROCESS_DATA_STEP_3.
* PERFORM DYNPRO USING:
* 'X' 'SAPMV45A' '0402',
* ' ' 'BDC_OKCODE' 'KKAU',
*
** 'X' 'SAPMV45A' '0300',
** ' ' 'VBKD-ZTERM' i_tab-zterm,
** ' ' 'BDC_OKCODE' 'ENT1',
*
* 'X' 'SAPMV45A' '0300',
* ' ' 'BDC_OKCODE' 'BACK',
*
* 'X' 'SAPMV45A' '0402',
* ' ' 'BDC_OKCODE' 'SICH'.
*
*ENDFORM. " PROCESS_DATA_STEP_SAVE
*FORM GENERATE_SM35_DATA .
* PERFORM DYNPRO2 USING :
* 'X' 'SAPMSBDC' '0100' ,
* ' ' 'D0100-VON' W_DATUM ,
* ' ' 'BDC_OKCODE' 'UEB'.
*ENDFORM .
*
*FORM DYNPRO2 USING DYNBEGIN NAME VALUE.
* IF DYNBEGIN = 'X'.
* CLEAR BDC_TAB2.
* MOVE: NAME TO BDC_TAB2-PROGRAM,
* VALUE TO BDC_TAB2-DYNPRO,
* 'X' TO BDC_TAB2-DYNBEGIN.
* APPEND BDC_TAB2.
* ELSE.
* CLEAR BDC_TAB2.
* MOVE: NAME TO BDC_TAB2-FNAM,
* VALUE TO BDC_TAB2-FVAL.
* APPEND BDC_TAB2.
* ENDIF.
*ENDFORM .
Regards,
Morris Bond.
Reward Points if Helpful.
2009 Jan 14 10:07 PM