2009 Feb 03 11:38 AM
hi gurus
i am doing BDC CJ40. PS T-code ,while recording i given project def, wbs element,version,period,cost plan, cost element,totla coat.dist,total cost consu,dist,unit oe measure,
when ever i run the bdc session it will take only one cost element but it's not takeing multipe cost elements regarding relating data, can any suggest where i done mistake.
here i am mention code and falt file.
&----
*& Form FILLING_FINAL_TABLE
&----
text
----
--> p1 text
<-- p2 text
----
form filling_final_table .
data: l_var(3),
l_char1.
loop at it_header into wa_header.
l_char1 = wa_header-char.
if l_char1 eq 'H'.
shift i_header.
move-corresponding wa_header to i_header.
append i_header.
else.
shift i_item.
move-corresponding wa_header to i_item.
append i_item.
endif.
endloop.
endform. " FILLING_FINAL_TABLE
&----
*& Form FILE1
&----
text
----
--> p1 text
<-- p2 text
----
form file1 .
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
importing
file_name = p_file.
endform. " FILE1
----
START OF SELECTION *
----
&----
*& Form GET_DATA
&----
text
----
--> p1 text
<-- p2 text
----
form get_data .
data:c_file type string.
move p_file to c_file.
call function 'GUI_UPLOAD'
exporting
filename = c_file
filetype = 'ASC'
has_field_separator = 'X'
tables
data_tab = it_header
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " GET_DATA
&----
*& Form BDC_CJ40
&----
text
----
--> p1 text
<-- p2 text
----
form bdc_cj40 .
loop at i_header.
perform bdc_dynpro using 'SAPMKBUD' '0200'.
perform bdc_field using 'BDC_OKCODE'
'/EEOKS'.
perform bdc_field using 'BDC_CURSOR'
'BPDY-VERSN'.
perform bdc_dynpro using 'SAPLSPO4' '0300'.
perform bdc_field using 'BDC_CURSOR'
'SVALD-VALUE(01)'.
perform bdc_field using 'BDC_OKCODE'
'=FURT'.
perform bdc_field using 'SVALD-VALUE(01)'
'0001'.
perform bdc_dynpro using 'SAPMKBUD' '0200'.
perform bdc_field using 'BDC_CURSOR'
'PROJ-PSPID'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'PROJ-PSPID'
i_header-pspid. " 'E-9100'.
perform bdc_field using 'PRPS-POSID'
i_header-posid. " 'E-91001'.
perform bdc_field using 'BPDY-VERSN'
i_header-versn. " '0'.
perform bdc_dynpro using 'SAPLKBPP' '0320'.
perform bdc_field using 'BDC_CURSOR'
'BPDY-WERT1(01)'.
perform bdc_field using 'BDC_OKCODE'
'=KAPR'.
perform bdc_field using 'DROPT-PTIME'
i_header-ptime. " '3'.
perform bdc_field using 'BPDY-WERT1(01)'
i_header-wert1. " '5000000'.
perform bdc_dynpro using 'SAPLKPP2' '0112'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(01)'.
perform bdc_field using 'BDC_OKCODE'
'=CPOZ'.
perform bdc_field using 'Z-BDC03(01)'
''.
perform bdc_dynpro using 'SAPLKPP4' '0100'.
perform bdc_field using 'BDC_CURSOR'
'KPP0B-VALUE(01)'.
perform bdc_field using 'BDC_OKCODE'
'=CSPA'.
loop at i_item .
perform bdc_field using 'KPP0B-VALUE(01)'
i_item-kstar. " '400002'.
perform bdc_dynpro using 'SAPLKPP2' '0112'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDX01(01)'.
perform bdc_field using 'BDC_OKCODE'
'CBUC'.
perform bdc_field using 'Z-BDC03(01)'
i_item-wkg. " '10000'.
perform bdc_field using 'Z-BDC04(01)'
i_item-spred. " '2'.
perform bdc_field using 'Z-BDC05(01)'
i_item-meg. " '50000'.
perform bdc_field using 'Z-BDC06(01)'
i_item-spred. " '2'.
perform bdc_field using 'Z-BDC07(01)'
i_item-meinh. " 'L'.
perform bdc_field using 'Z-BDX01(01)'
i_item-mgefl. " 'X'.
perform bdc_dynpro using 'SAPLKBPP' '0320'.
perform bdc_field using 'BDC_CURSOR'
'BPDY-WERT1(01)'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_field using 'DROPT-PTIME'
'3'.
endloop.
endloop.
perform bdc_insert.
refresh: i_bdcdata.
endform.
**********************************************************************************************************************
flat file like this
H E-9100 E-91001 0 2009 6500000
I 400000 500000 2 62000 l X
I 400001 60000 2 40001 l X
I 415000 10000 2 20000 l X
hi gurus
i am doing BDC CJ40. PS T-code ,while recording i given project def, wbs element,version,period,cost plan, cost element,totla coat.dist,total cost consu,dist,unit oe measure,
when ever i run the bdc session it will take only one cost element but it's not takeing multipe cost elements regarding relating data, can any suggest where i done mistake.
here i am mention code and falt file.
&----
*& Form FILLING_FINAL_TABLE
&----
text
----
--> p1 text
<-- p2 text
----
form filling_final_table .
data: l_var(3),
l_char1.
loop at it_header into wa_header.
l_char1 = wa_header-char.
if l_char1 eq 'H'.
shift i_header.
move-corresponding wa_header to i_header.
append i_header.
else.
shift i_item.
move-corresponding wa_header to i_item.
append i_item.
endif.
endloop.
endform. " FILLING_FINAL_TABLE
&----
*& Form FILE1
&----
text
----
--> p1 text
<-- p2 text
----
form file1 .
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
importing
file_name = p_file.
endform. " FILE1
----
START OF SELECTION *
----
&----
*& Form GET_DATA
&----
text
----
--> p1 text
<-- p2 text
----
form get_data .
data:c_file type string.
move p_file to c_file.
call function 'GUI_UPLOAD'
exporting
filename = c_file
filetype = 'ASC'
has_field_separator = 'X'
tables
data_tab = it_header
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " GET_DATA
&----
*& Form BDC_CJ40
&----
text
----
--> p1 text
<-- p2 text
----
form bdc_cj40 .
loop at i_header.
perform bdc_dynpro using 'SAPMKBUD' '0200'.
perform bdc_field using 'BDC_OKCODE'
'/EEOKS'.
perform bdc_field using 'BDC_CURSOR'
'BPDY-VERSN'.
perform bdc_dynpro using 'SAPLSPO4' '0300'.
perform bdc_field using 'BDC_CURSOR'
'SVALD-VALUE(01)'.
perform bdc_field using 'BDC_OKCODE'
'=FURT'.
perform bdc_field using 'SVALD-VALUE(01)'
'0001'.
perform bdc_dynpro using 'SAPMKBUD' '0200'.
perform bdc_field using 'BDC_CURSOR'
'PROJ-PSPID'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'PROJ-PSPID'
i_header-pspid. " 'E-9100'.
perform bdc_field using 'PRPS-POSID'
i_header-posid. " 'E-91001'.
perform bdc_field using 'BPDY-VERSN'
i_header-versn. " '0'.
perform bdc_dynpro using 'SAPLKBPP' '0320'.
perform bdc_field using 'BDC_CURSOR'
'BPDY-WERT1(01)'.
perform bdc_field using 'BDC_OKCODE'
'=KAPR'.
perform bdc_field using 'DROPT-PTIME'
i_header-ptime. " '3'.
perform bdc_field using 'BPDY-WERT1(01)'
i_header-wert1. " '5000000'.
perform bdc_dynpro using 'SAPLKPP2' '0112'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDC03(01)'.
perform bdc_field using 'BDC_OKCODE'
'=CPOZ'.
perform bdc_field using 'Z-BDC03(01)'
''.
perform bdc_dynpro using 'SAPLKPP4' '0100'.
perform bdc_field using 'BDC_CURSOR'
'KPP0B-VALUE(01)'.
perform bdc_field using 'BDC_OKCODE'
'=CSPA'.
loop at i_item .
perform bdc_field using 'KPP0B-VALUE(01)'
i_item-kstar. " '400002'.
perform bdc_dynpro using 'SAPLKPP2' '0112'.
perform bdc_field using 'BDC_CURSOR'
'Z-BDX01(01)'.
perform bdc_field using 'BDC_OKCODE'
'CBUC'.
perform bdc_field using 'Z-BDC03(01)'
i_item-wkg. " '10000'.
perform bdc_field using 'Z-BDC04(01)'
i_item-spred. " '2'.
perform bdc_field using 'Z-BDC05(01)'
i_item-meg. " '50000'.
perform bdc_field using 'Z-BDC06(01)'
i_item-spred. " '2'.
perform bdc_field using 'Z-BDC07(01)'
i_item-meinh. " 'L'.
perform bdc_field using 'Z-BDX01(01)'
i_item-mgefl. " 'X'.
perform bdc_dynpro using 'SAPLKBPP' '0320'.
perform bdc_field using 'BDC_CURSOR'
'BPDY-WERT1(01)'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_field using 'DROPT-PTIME'
'3'.
endloop.
endloop.
perform bdc_insert.
refresh: i_bdcdata.
endform.
**********************************************************************************************************************
flat file like this
H E-9100 E-91001 0 2009 6500000
I 400000 500000 2 62000 l X
I 400001 60000 2 40001 l X
I 415000 10000 2 20000 l X
2009 Feb 04 7:09 AM
Hi
You need to increase the counter for multiple line items.
There's Table Control unsed in CJ40.
Ex.
For : perform bdc_field using 'Z-BDC05(01)'
You have to perform concatenation :
Count = '01'.
loop at....
..
...
..
CONCATENATE 'Z-BDC05(' count ')' INTO V_BDC05 (THIS IS FIELD STRING).
(NOW SEE THE FOLLOWING)...
perform bdc_field using V_BDC05.
i_item-wkg.
count = count + 1.
endloop...
LIKE WISE YOU NEED TO DO IT FOR ALL THE FIELDS WHERE COUNTER IN GOING TO APPEAR
Edited by: Yogesh Karanjikar on Feb 4, 2009 9:08 AM
2009 Feb 05 6:02 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |