09-26-2008 9:56 AM
Hi All,
I'm creating a BDC session calling the VA01.
my problem is where do I put my code? I test it and I still got a blank in header text pick list.
Codes is more helpful so I can compare my work.
Thanks.
09-26-2008 10:04 AM
09-26-2008 10:00 AM
I'm not going to post code for this one. Instead, i suggest you record your transaction VA01 using transaction SHDB. During recording, fill each field as you normally would.
Then create a program from your recording.
Compare that program with your own program.
09-26-2008 10:00 AM
hI,
Header text is declared the structure not. Its simple to debug find out the step by step for that field first check the structure and while looping your work area of BDC find out whether your field is been declared.
Or else paste your code i will try to resolve.
Cheers!!
09-26-2008 10:04 AM
09-26-2008 10:06 AM
Yes, I already record the step I needed. But when I'm in the Header text<picked list intruction I got the OK code: =%_GC 148 22
So im using FM SAVE_TEXT to get the file I needed.
RSTXT TDID Z930
RSTXT TDOBJECT VBBK
But my problem is where do I put my SAVE_TEXT.
I try to put it before and after of this code.
CALL TRANSACTION 'VA01' USING t_bdctab
MODE p_mode
UPDATE c_s
MESSAGES INTO t_message .
09-26-2008 10:13 AM
09-26-2008 10:09 AM
here is my code for BDC.
data: begin of record,
TXLINE_02_028(072),
end of record.
****MESLAN
clear: v_itm, v_kwmeng, v_mabnr.
LOOP AT t_hdr .
*-- HEADER
PERFORM fill_dynpro USING 'SAPMV45A' '0101' 'X'.
PERFORM fill_field USING: 'VBAK-AUART' p_auart,
'VBAK-VKORG' t_hdr-vkorg,
'VBAK-VTWEG' t_hdr-vtweg,
'VBAK-SPART' t_hdr-spart,
'BDC_OKCODE' '/00'.
PERFORM fill_dynpro USING 'SAPMV45A' '4001' 'X'.
PERFORM fill_field USING: 'VBKD-BSTKD' t_hdr-bstnk,
'KUAGV-KUNNR' t_hdr-ablad,
'RV45A-KPRGBZ' 'D',
'VBAK-LIFSK' p_lifsk,
'VBAK-AUGRU' p_augru,
'BDC_OKCODE' '/00'.
PERFORM fill_dynpro USING 'SAPMV45A' '4001' 'X'.
PERFORM fill_field USING: 'VBKD-BSTKD' t_hdr-bstnk,
'KUAGV-KUNNR' t_hdr-ablad,
'KUWEV-KUNNR' t_hdr-ablad,
'RV45A-KPRGBZ' 'D',
'VBAK-LIFSK' p_lifsk,
'VBAK-AUGRU' p_augru,
'BDC_OKCODE' '=KBES'.
PERFORM fill_dynpro USING 'SAPMV45A' '4002' 'X'.
PERFORM fill_field USING: 'VBKD-BSTKD' t_hdr-bstnk,
'VBKD-BSARK' P_BSARK,
'BDC_OKCODE' '/00'.
PERFORM fill_dynpro USING 'SAPMV45A' '4002' 'X'.
PERFORM fill_field USING: 'VBKD-BSTKD' t_hdr-bstnk,
'VBKD-BSARK' P_BSARK,
'BDC_OKCODE' '/EBACK'.
PERFORM fill_dynpro USING 'SAPMV45A' '4001' 'X'.
PERFORM fill_field USING: 'VBKD-BSTKD' t_hdr-bstnk,
'KUAGV-KUNNR' t_hdr-ablad,
'KUWEV-KUNNR' t_hdr-ablad,
'RV45A-KPRGBZ' 'D',
'VBAK-LIFSK' p_lifsk,
'VBAK-AUGRU' p_augru,
'BDC_OKCODE' '=POAN'.
LOOP AT t_line WHERE bstnk EQ t_hdr-bstnk . " Select all line items
*-- LINE ITEMS
CONCATENATE 'RV45A-MABNR(' '0' VAL ')' INTO v_MABNR.
CONCATENATE 'RV45A-KWMENG(' '0' VAL ')' INTO v_kwmeng.
PERFORM fill_dynpro USING 'SAPMV45A' '4001' 'X'.
PERFORM fill_field USING: 'VBKD-BSTKD' t_hdr-bstnk,
'KUAGV-KUNNR' t_hdr-ablad,
'KUWEV-KUNNR' t_hdr-ablad,
'RV45A-KPRGBZ' 'D',
'VBAK-LIFSK' p_lifsk,
'VBAK-AUGRU' p_augru,
v_MABNR t_line-matnr,
v_kwmeng t_line-kwmeng,
'BDC_OKCODE' '/00'.
*---- for t_curlin
v_itm = val * 10 .
t_curlin = t_line.
t_curlin-lineno = v_itm .
APPEND t_curlin .
*---- for line item
VAL = VAL + 1.
endloop.
VAL = 01.
PERFORM fill_dynpro USING 'SAPMV45A' '4001' 'X'.
PERFORM fill_field USING: 'VBKD-BSTKD' t_hdr-bstnk,
'KUAGV-KUNNR' t_hdr-ablad,
'KUWEV-KUNNR' t_hdr-ablad,
'RV45A-KPRGBZ' 'D',
'VBAK-LIFSK' p_lifsk,
'VBAK-AUGRU' p_augru,
'BDC_OKCODE' '=SICH'.
CALL TRANSACTION 'VA01' USING t_bdctab
MODE p_mode
UPDATE c_s
MESSAGES INTO t_message .
IF sy-subrc NE 0 . " Post errored sessions- for correction
v_errflg = c_x . " Online posting error - open session
v_errno = v_errno + 1 .
PERFORM append_mail_table .
PERFORM open_session .
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'VA01' "c_va01
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
TABLES
dynprotab = t_bdctab
EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7.
ELSE .
t_text-tdline = t_hdr-text .
APPEND t_text .
CLEAR t_text .
WRITE sy-msgv2 TO v_vbeln RIGHT-JUSTIFIED .
TRANSLATE v_vbeln USING c_0 .
v_tdname = v_vbeln . "' order no.
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = c_z961
flanguage = p_spras
fname = v_tdname
fobject = c_vbbk
save_direct = c_x
FFORMAT = '*'
TABLES
flines = t_text
EXCEPTIONS
no_init = 1
no_save = 2
OTHERS = 3.
CLEAR t_text . REFRESH t_text .
IF sy-subrc NE 0 .
WRITE : / c_er_load , v_tdname .
ENDIF .
v_succno = v_succno + 1 .
ENDIF .
CLEAR t_bdctab . REFRESH t_bdctab .
endloop.
IF v_errflg EQ c_x .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
IF sy-subrc EQ 0 .
MESSAGE i260(zo) WITH text-i01.
ENDIF .
ENDIF .
ENDFORM.
09-26-2008 10:17 AM
Hi MD,
I try to do that. I put save_text before and after call transaction.
CALL TRANSACTION 'VA01' USING t_bdctab
MODE p_mode
UPDATE c_s
MESSAGES INTO t_message .
09-26-2008 10:19 AM
you need to call the save_text after the call Transaction, with the Sales order number created.
Sales order number you can find from Messages(BDCMSGCOLL table). you can find the order number in MSGV1 variable/
09-26-2008 10:33 AM
Hi
I am sorry, i did not see your code properly
Basically you are calling after Call transaction only
One more thing, it is just a guess.
When you are calling CREAT_TEXT
pass t_text like below
********
TABLES
flines = t_text[]
EXCEPTIONS
no_init = 1
no_save = 2
OTHERS = 3.
*******
Keep a break-point at CREATE_TEXT and see, whether all the values are availble for CREATE_TEXT
Regards
MD
09-26-2008 10:37 AM
Hi I dont need create_text because the file is from the directory. so when the program run it will authomatically put in internal table.
09-26-2008 10:38 AM
Hi
Pass the value like this
flines = t_text[]
Keep a break-point at create_text and see, whether t_text is having values
Regards
MD