Hola compañeros del Foro
les escribo para solicitarles ayuda con esta bapi, dado que cuando la ejecuto me genera el siguiente mensaje de error
"P.elemento imputación proyecto presup.no es válido el valor BLANK/SPACE" y no se a que campo hace referencia???
Les pongo el Código y con la esperanza que un alma caritativa que sepa me colaboré
DATA:
"Tablas internas
"__________________________________________
ti_dfkkko TYPE TABLE OF dfkkko, "Tabla DFKKKO
ti_dfkkop TYPE TABLE OF dfkkop,
ti_detalle TYPE ztt_bapidfkkop,
"Areas de trabajo
"__________________________________________
wa_cabecera TYPE bapidfkkko, "Cabecera de la partida nueva
wa_detalle TYPE bapidfkkop,
wa_dfkkko LIKE LINE OF ti_dfkkko,
wa_dfkkop LIKE LINE OF ti_dfkkop,
wa_return TYPE bapiret2,
wa_bapidfkkop TYPE bapi_te_dfkkop,
"Variables locales
"___________________________________________
vl_doc_crear TYPE opbel_kk.
* ______________________________________________________________
* &&&&&&&&&&&&&&&&&&&&&&& Logica del proceso &&&&&&&&&&&&&&
* ______________________________________________________________
SELECT opbel applk blart herkf waers bldat budat xblnr xeibh
ernam cpudt cputm awtyp awkey
INTO CORRESPONDING FIELDS OF TABLE ti_dfkkko
FROM dfkkko
FOR ALL ENTRIES IN c_ti_partidas_origi
WHERE opbel = c_ti_partidas_origi-opbel.
SELECT opbel opupw opupk opupz bukrs gsber gpart vkont applk
hvorg tvorg betrh betrw bldat budat optxt
faedn waers grkey persl xblnr budgetyear texto2
INTO CORRESPONDING FIELDS OF TABLE ti_dfkkop
FROM dfkkop
FOR ALL ENTRIES IN c_ti_partidas_origi
WHERE opbel = c_ti_partidas_origi-opbel
AND opupk = c_ti_partidas_origi-opupk.
LOOP AT ti_dfkkko INTO wa_dfkkko .
wa_cabecera-fikey = i_fikey.
wa_cabecera-appl_area = wa_dfkkko-applk.
wa_cabecera-doc_type = 'CC'.
wa_cabecera-doc_source_key = wa_dfkkko-herkf.
wa_cabecera-currency = wa_dfkkko-waers.
wa_cabecera-doc_date = wa_dfkkko-bldat.
wa_cabecera-post_date = wa_dfkkko-budat.
wa_cabecera-ref_doc_no = wa_dfkkko-xblnr.
wa_cabecera-single_doc = 'X'.
wa_cabecera-created_by = wa_dfkkko-ernam.
wa_cabecera-entry_date = wa_dfkkko-cpudt.
wa_cabecera-entry_time = wa_dfkkko-cputm.
wa_cabecera-obj_type = wa_dfkkko-awtyp.
wa_cabecera-obj_key = wa_dfkkko-awkey.
LOOP AT ti_dfkkop INTO wa_dfkkop WHERE opbel = wa_dfkkko-opbel.
wa_detalle-amount_loc_curr = wa_dfkkop-betrh * 100.
wa_detalle-amount = wa_dfkkop-betrw * 100.
wa_detalle-rep_item = wa_dfkkop-opupw.
wa_detalle-item = wa_dfkkop-opupk.
wa_detalle-sub_item = wa_dfkkop-opupz.
wa_detalle-comp_code = wa_dfkkop-bukrs.
wa_detalle-bus_area = wa_dfkkop-gsber.
wa_detalle-buspartner = wa_dfkkop-gpart.
wa_detalle-cont_acct = wa_dfkkop-vkont.
wa_detalle-appl_area = wa_dfkkop-applk.
wa_detalle-main_trans = wa_dfkkop-hvorg.
wa_detalle-sub_trans = wa_dfkkop-tvorg.
wa_detalle-doc_date = wa_dfkkop-bldat.
wa_detalle-post_date = wa_dfkkop-budat.
wa_detalle-text = wa_dfkkop-optxt.
wa_detalle-net_date = wa_dfkkop-faedn.
wa_detalle-currency = wa_dfkkop-waers.
wa_detalle-grouping = wa_dfkkop-grkey.
wa_detalle-period_key = wa_dfkkop-persl.
wa_detalle-ref_doc_no = wa_dfkkop-xblnr.
wa_detalle-fisc_year = wa_dfkkop-budgetyear.
APPEND wa_detalle TO ti_detalle.
ENDLOOP.
"Se crea el documento
"_________________________________________________________________
CALL FUNCTION 'BAPI_CTRACDOCUMENT_CREATE'
EXPORTING
testrun = ' '
documentheader = wa_cabecera
completedocument = 'X'
IMPORTING
documentnumber = vl_doc_crear
return = wa_return
TABLES
partnerpositions = ti_detalle.
IF wa_return-type = 'E'.
ROLLBACK WORK.
MESSAGE wa_return-MESSAGE TYPE 'E'.
ELSE.
COMMIT WORK.
ENDIF.
ENDLOOP.
De antemano gracias por cualquier ayuda que me puedan prestar.