Ver Mensaje Individual
  #6  
Viejo 08/08/11, 14:51:43
sanchezgc sanchezgc is offline
Junior Member
 
Fecha de Ingreso: mar 2008
Mensajes: 9
bapi entrysheet create

otro ejemplo: Copia del pedido a la ml81 las imputaciones etc. Mi problema es que no consigo asignarlo a otro ceco.
**************************************
* CABECERA
**************************************
entrysheetheader-sheet_no = '1'. "gt_ekpo-packno.
entrysheetheader-ext_number = 'HE TEXTO'.
entrysheetheader-person_int = sy-uname.
entrysheetheader-person_ext = sy-uname.
* entrysheetheader-location = t_ekpo-lgort.
entrysheetheader-ref_date = SY_DATUM "UNA FECHA.
* entrysheetheader-begdate = vl_date.
* entrysheetheader-enddate = vl_date.
entrysheetheader-pckg_no = '1'."gt_ekpo-packno.
entrysheetheader-short_text = vl_texto.
entrysheetheader-po_number = gt_ekpo-ebeln.
entrysheetheader-po_item = '0010'.
entrysheetheader-block_ind = vl_block. "X
entrysheetheader-doc_date = fec.
entrysheetheader-post_date = fec.
entrysheetheader-ref_doc_no = vl_nota. "Un texto not ade entrega
entrysheetheader-accasscat = 'K'. "imputación a ceco
* entrysheetheader-acceptance = 'X'. "Se pide que no sean aceptados
**************************************
* registros account assigment
**************************************
CLEAR vl_num.

LOOP AT lt_ekkn.
ADD 1 TO vl_num.
"Nº paquete
entrysheetaccountassignment-pckg_no = '1'."gt_ekpo-packno.
"Nºactual imput.
entrysheetaccountassignment-serial_no = vl_num.

"Centro de coste
entrysheetaccountassignment-costcenter = vl_kostl.
"Sociedad CO
entrysheetaccountassignment-co_area = wa_ekko-bukrs. '.

IF vl_lemin IS INITIAL.
"Número de la cuenta de mayor
entrysheetaccountassignment-gl_account = lt_ekkn-sakto.
"Centro de beneficio
entrysheetaccountassignment-profit_ctr = lt_ekkn-prctr.
"Elemento del plan de estructura de proyecto (elemento PEP)
PERFORM pep_output_sin
USING lt_ekkn-ps_psp_pnr
CHANGING entrysheetaccountassignment-wbs_elem.
"Posición presupuestaria
entrysheetaccountassignment-cmmt_item = lt_ekkn-fipos.
ENDIF.
CASE vl_lemin.
WHEN lc_equis.
CHECK vl_num = 1.
APPEND entrysheetaccountassignment.
WHEN OTHERS.
APPEND entrysheetaccountassignment.
ENDCASE.

ENDLOOP.
**************************************
* SERVICIOS
**************************************
"Nº paquete - Linea de cabecera servicios
entrysheetservices-pckg_no = '1'."gt_ekpo-packno.
"Número de líneas interno
entrysheetservices-line_no = '0000000001'.
"Número de línea
entrysheetservices-ext_line = '0000000010'.
"Nivel jerárquico del grupo
entrysheetservices-outl_level = '0'.
* entrysheetservices-OUTL_NO "Nivel de estructura
entrysheetservices-outl_ind = 'X'. "Indicador línea estructurac.
"Número de subpaquete
entrysheetservices-subpckg_no = '2'."gt_ekpo-packno + 1.
"Entrada: no planif., línea límite
entrysheetservices-limit_line = pt_tab-impor.
IF vl_lemin = 'X'.
* Si es devolucion importe negativo a positivo
entrysheetservices-limit_line = entrysheetservices-limit_line * -1.
ENDIF.
APPEND entrysheetservices.
* SEGUNDA linea detalle servicios
CLEAR entrysheetservices.
"Nº paquete
entrysheetservices-pckg_no = '2'."gt_ekpo-packno + 1.
"Número de líneas interno
entrysheetservices-line_no = '0000000002'.
entrysheetservices-ext_line = '0000000010'.
"Cantidad con signo +/-
entrysheetservices-quantity = gt_ekpo-menge.
"Unidad de medida base
entrysheetservices-base_uom = gt_ekpo-meins.
* entrysheetservices-UOM_ISO "Código ISO p.unidad de medida?
"Cantidad base
entrysheetservices-price_unit = gt_ekpo-peinh.
"Precio bruto
entrysheetservices-gr_price = pt_tab-impor .
IF vl_lemin = 'X'.
"El importe se deberá pasar como positivo
entrysheetservices-gr_price = entrysheetservices-gr_price * -1.
ENDIF.
entrysheetservices-short_text = vl_texto. "Texto breve
*------------------------------------------------------
* Indicador de distribución en la imputación múltiple
*' 'Imputación simple
*1 Distribución por cantidades
*2 Distribución porcentual
*-----------------------------------------------------
IF vl_lemin IS INITIAL.
entrysheetservices-distrib = '2'.
ELSE.
entrysheetservices-distrib = space.
ENDIF.
"Entrada: no planif., línea límite
* entrysheetservices-LIMIT_LINE = pt_tab-impor.
"Grupo de artículos = 03
entrysheetservices-matl_group = gt_ekpo-matkl.
APPEND entrysheetservices.

**************************************
* SRV ACCESS VALUE - IMPUTACIONES
**************************************
* NOTA: Si en el paso anterior se marca imputación simple no hará caso
* a la distribución distribuida de acontinuación
CLEAR vl_num.
LOOP AT lt_ekkn.
CLEAR entrysheetsrvaccassvalues.
ADD 1 TO vl_num.
IF vl_num = 1.
"Nº paquete - Linea cabecera
entrysheetsrvaccassvalues-pckg_no = '1'. "gt_ekpo-packno.
"Número de línea
entrysheetsrvaccassvalues-line_no = vl_num.
"Número correlativo asign. imputación línea de servicio
entrysheetsrvaccassvalues-serno_line = vl_num.
"Número actual imputación
entrysheetsrvaccassvalues-serial_no = vl_num.
CASE vl_lemin. "Indicador de devolucion
WHEN lc_equis.
"Porcentaje
entrysheetsrvaccassvalues-percentage = 100.
"Cantidad con signo +/-
entrysheetsrvaccassvalues-quantity = 1 .
"Valor neto de la posición
entrysheetsrvaccassvalues-net_value = pt_tab-impor.
WHEN OTHERS.
"Porcentaje
entrysheetsrvaccassvalues-percentage = lt_ekkn-vproz.
"Cantidad con signo +/-
entrysheetsrvaccassvalues-quantity =
1 * ( lt_ekkn-vproz / 100 ).
"Valor neto de la posición
entrysheetsrvaccassvalues-net_value = pt_tab-impor.
ENDCASE.
APPEND entrysheetsrvaccassvalues.
ELSE.
CHECK vl_lemin IS INITIAL.
"Nº paquete - RESTO DE LINEAS
entrysheetsrvaccassvalues-pckg_no = '1'. "gt_ekpo-packno.
"Número de línea
entrysheetsrvaccassvalues-line_no = vl_num.
"Número correlativo asign. imputación línea de servicio
entrysheetsrvaccassvalues-serno_line = vl_num.
"Porcentaje
entrysheetsrvaccassvalues-percentage = lt_ekkn-vproz.
"Número actual imputación
entrysheetsrvaccassvalues-serial_no = vl_num.
"Cantidad con signo +/-
entrysheetsrvaccassvalues-quantity =
1 * ( lt_ekkn-vproz / 100 ).
"Valor neto de la posición
entrysheetsrvaccassvalues-net_value = pt_tab-impor.

APPEND entrysheetsrvaccassvalues.
ENDIF.

ENDLOOP.


COMENTAR: esto vale para llamar a la bapi, pero yo para el indicador de dev. tuve que copiar dicha bapi a un MF, una rutina y la llamada a la función adecuando datos.

Úlima edición por sanchezgc fecha: 08/08/11 a las 14:54:15.
Responder Con Cita