Ver Mensaje Individual
  #1  
Viejo 09/03/11, 22:28:51
Avatar de gaos
gaos gaos is offline
Member
 
Fecha de Ingreso: oct 2006
Mensajes: 98
sy-uccom en punto de ampliacion

Buen día a todos.

Tengo un problema con un requerimiento, me pidieron crear un punto de ampliación en la transacción IPM2 y mandar un popup para ver que ordenes se va a autorizar despues de seleccionarlas, eso no hay problema ya lo manda el popup, el problema es no puedo hacer que me reconozca el user-command ya le intente de varias formas y no funciona, me manda el siguiente error "Incorrect nesting: Before the statement "FORM", th Zeile: 159". les envio el codigo para que lo vean, la verdad no se porque ese error

*Tabla auxiliar a revisar
*Data: Begin Of t_sel_tab Occurs 0.
* Include structure sel_tab.
*Data: End Of t_sel_tab.
*Tabla de Operaciones
Data: t_operations like table of bapi_alm_order_operation_e with header line,
*Tabla de componentes
t_components like table of bapi_alm_order_component_e with header line,
*Tabla de usuarios
ti_zpmiw32 like table of zpm_iw32 with header line
*Tabla auxiliar a revisar
* t_sel_tab like table of sel_tab with header line
.

TYPE-POOLS: SLIS.
* Declaration of Fieldcatalog
DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.

Data: Begin Of t_sel_tab Occurs 0,
check(1) Type c.
Include Structure sel_tab.
Data: End Of t_sel_tab.
*Tabla de avisos de la bapi
Data: Begin Of t_return Occurs 0.
Include Structure bapiret2.
Data: End Of t_return.
*Areas de trabajo
Data: wa_header Like bapi_alm_order_header_e
.

*Variables y constantes
Constants: c_ipm(4) Type c Value 'IPM2',
c_pm0(4) Type c Value 'PM03',
c_x(1) Type c Value 'X'
.
Data: cancel(1) TYPE c
.

*Se revisa que el usuario este en la tabla ZPM_IW32 Tx zpmre018
Select *
From zpm_iw32
Into Table ti_zpmiw32
For All entries In sel_tab
Where bname eq sy-uname
And .
.
.
.
.
.

*Se revisa que la tabla contenga datos y que sea la tx IPM2
If sy-subrc eq space And sy-tcode eq c_ipm.

*Se toman los datos a modificar en una tabla auxiliar
* t_sel_tab[] = sel_tab[].
Loop At sel_tab.
Move-corresponding sel_tab To t_sel_tab.
Append t_sel_tab.
Clear t_sel_tab.
EndLoop.

*Se barre la tabla auxiliar y se toman los datos
Loop At sel_tab.

*Se ejecuta la bapi y se dejan las operaciones con clave PM03 y los
*componente no marcados para borrar
Clear: wa_header, t_operations, t_components, t_sel_tab.
Refresh: t_operations, t_components.

CALL FUNCTION 'BAPI_ALM_ORDER_GET_DETAIL'
EXPORTING
NUMBER = sel_tab-aufnr
IMPORTING
ES_HEADER = wa_header
TABLES
ET_OPERATIONS = t_operations
ET_COMPONENTS = t_components
RETURN = t_return
.

Delete t_operations Where control_key ne c_pm0.
Delete t_components Where delete_ind eq c_x.

*se revisa que las tablas contengan datos
If t_operations[] Is initial And t_components[] Is Initial.
Delete t_sel_tab Where objnr eq sel_tab-objnr.
EndIf.

EndLoop.

If Not t_sel_tab[] Is Initial.

FLDCAT-FIELDNAME = 'AUFNR'.
FLDCAT-COL_POS = 0.
FLDCAT-outputlen = 12.
FLDCAT-SELTEXT_M = 'ORDEN'.
APPEND FLDCAT.
CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'AUFSTAT'.
FLDCAT-COL_POS = 1.
FLDCAT-outputlen = 8.
FLDCAT-SELTEXT_M = 'STATUS'.
APPEND FLDCAT.
CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'KTEXT'.
FLDCAT-COL_POS = 2.
FLDCAT-outputlen = 40.
FLDCAT-SELTEXT_M = 'TEXTO'.
APPEND FLDCAT.
CLEAR FLDCAT.

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE = 'AUTORIZAR ORDENES'
I_SELECTION = c_x
I_ZEBRA = c_x
I_SCREEN_START_COLUMN = 10
I_SCREEN_START_LINE = 10
I_SCREEN_END_COLUMN = 80
I_SCREEN_END_LINE = 20
I_CHECKBOX_FIELDNAME = 'CHECK'
I_TABNAME = 'T_SEL_TAB'
IT_FIELDCAT = FLDCAT[]
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IMPORTING
e_exit = cancel
TABLES
T_OUTTAB = T_SEL_TAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.

IF SY-XCODE eq '&AC1'.
Leave to Screen 500.
ENDIF.

FORM user_command USING ucomm LIKE sy-ucomm
sfields TYPE slis_selfield.

EndForm.


EndIf.

EndIf.
Responder Con Cita