Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAPScript - no data return

Former Member
0 Likes
886

my report no return any data, using SAPSCRIPT

I have one reporte SAPSCRIPT, this report is calling a subroutine, also have 3 IN and 3 OUT parameters.

I using one copy of report F110_PRENUM_CHCK (ZF110_PRENUM_CHK) also, I call subroutine "m_return_dat " in view "MAIN" using element 525

I include the report code.

-


SAPScript.

PERFORM m_return_dat IN PROGRAM ZFI_RUTINA_FORM

USING &REGUP-LIFNR&

USING &REGUP-VBLNR&

USING &REGUP-BELNR&

CHANGING &CONC&

CHANGING &PGPAR&

CHANGING &RETEN&

ENDPERFORM.

.

.

.

.

PROGRAM ZFI_RUTINA_FORM.

types: begin of st_regup,

ZBUKR type DZBUKR,

LIFNR type LIFNR,

VBLNR type VBLNR,

BUKRS type BUKRS,

BELNR type BELNR_D,

BLART type BLART,

BSCHL type BSCHL,

DMBTR type DMBTR,

REBZG type REBZG,

end of st_regup.

data: it_regup type standard table of st_regup,

wa_regup like line of it_regup.

data: v_String(15) type c.

data: v_MasFact(1) type c.

  • ----------------------------------------------------

  • Retorna los siguientes datos

  • - Concepto de la factura

  • - Rentencion

  • - Pagos parciales

  • ----------------------------------------------------

FORM m_return_dat TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

data: l_wa_in_tab type itcsy.

data: l_wa_out_tab type itcsy.

  • ---------------------------------

  • variables a utilizar

  • ---------------------------------

data: v_BUKRS type BUKRS,

v_LIFNR type LIFNR, "Acreedor

v_AUGBL TYPE AUGBL, "Doc. Pago

v_BELNR type BELNR_D, "Doc. Ctble (Fact)

v_SGTXT type SGTXT, "Concepto

v_PAGOS type DMBTR, "Pago Parcial

v_wtqbshh type WT_WT. "Retencion

  • ---------------------------

  • Recuperar valores SAPSCRIPT

  • ---------------------------

read table in_tab with key name = 'REGUP-LIFNR'

into l_wa_in_tab.

if sy-subrc eq 0.

v_LIFNR = l_wa_in_tab-value.

endif.

read table in_tab with key name = 'REGUP-VBLNR'

into l_wa_in_tab.

if sy-subrc eq 0.

v_AUGBL = l_wa_in_tab-value.

endif.

read table in_tab with key name = 'REGUP-BELNR'

into l_wa_in_tab.

if sy-subrc eq 0.

v_BELNR = l_wa_in_tab-value.

endif.

  • -----------------------------------------------

  • Obtener el concepto de la factura

  • -----------------------------------------------

MOVE SPACE TO v_SGTXT.

SELECT SINGLE SGTXT INTO v_SGTXT

FROM BSAK

WHERE

  • BUKRS EQ v_BUKRS

LIFNR EQ v_LIFNR

AND AUGBL EQ v_AUGBL

AND BELNR EQ v_BELNR.

if sy-subrc = 0.

if v_SGTXT eq space.

v_SGTXT = 'Esta en blanco'.

endif.

else.

v_SGTXT = 'No hay datosSSSS'.

endif.

  • Asigno el valor de la retencion al campo de salida

CLEAR: l_wa_out_tab.

l_wa_out_tab-value = v_SGTXT.

l_wa_out_tab-name = 'CONC'.

  • Modifico la tabla de salida para el formulario

MODIFY out_tab FROM l_wa_out_tab

TRANSPORTING value

WHERE NAME EQ 'CONC'.

  • -----------------------------------------------

  • Obtener la sumatoria de los pagos parciales.

  • -----------------------------------------------

clear it_regup.

SELECT ZBUKR LIFNR VBLNR

BUKRS BELNR BLART

BSCHL DMBTR REBZG

INTO CORRESPONDING FIELDS OF TABLE it_regup

FROM REGUP

WHERE LIFNR EQ v_LIFNR

AND VBLNR EQ v_AUGBL

AND BELNR NE v_BELNR

AND REBZG EQ v_BELNR

AND BSCHL NE '31'.

if sy-subrc = 0.

v_String = 'No Pagos'.

else.

v_String = 'no exi pg'.

endif.

MOVE 0 TO v_PAGOS.

clear wa_regup.

LOOP AT it_regup INTO wa_regup

WHERE REBZG EQ v_BELNR.

v_PAGOS = v_PAGOS + wa_regup-DMBTR.

ENDLOOP.

  • Asigno el valor de la retencion al campo de salida

  • MOVE v_PAGOS TO v_String.

CLEAR: l_wa_out_tab.

l_wa_out_tab-value = v_String.

l_wa_out_tab-name = 'PGPAR'.

  • Modifico la tabla de salida para el formulario

MODIFY out_tab FROM l_wa_out_tab

TRANSPORTING value

WHERE NAME EQ 'PGPAR'.

  • -----------------------------------------------

  • Obtener la sumatoria de la retencion.

  • -----------------------------------------------

MOVE 0 TO v_wtqbshh.

SELECT SUM( WT_QBSHH )

INTO v_wtqbshh

FROM WITH_ITEM

WHERE

BELNR EQ v_BELNR

AND WT_ACCO EQ v_LIFNR.

  • Asigno el valor de la retencion al campo de salida

MOVE v_wtqbshh TO v_String.

CLEAR: l_wa_out_tab.

l_wa_out_tab-value = v_String.

l_wa_out_tab-name = 'RETEN'.

  • Modifico la tabla de salida para el formulario

MODIFY out_tab FROM l_wa_out_tab

TRANSPORTING value

WHERE NAME EQ 'RETEN'.

ENDFORM.

-


Thank's

Calos Orden

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
723

Hi Carlos,

instead of :

  • Asigno el valor de la retencion al campo de salida

CLEAR: l_wa_out_tab.

l_wa_out_tab-value = v_SGTXT.

l_wa_out_tab-name = 'CONC'.

  • Modifico la tabla de salida para el formulario

MODIFY out_tab FROM l_wa_out_tab

TRANSPORTING value

WHERE NAME EQ 'CONC'.

Try the following:

READ TABLE out_tab WITH KEY 'CONC'.

IF sy-subrc EQ 0.

out_tab-value = V_SGTXT.

MODIFY out_tab INDEX sy-tabix.

ENDIF.

Regards,

Carlos.

4 REPLIES 4
Read only

Former Member
0 Likes
724

Hi Carlos,

instead of :

  • Asigno el valor de la retencion al campo de salida

CLEAR: l_wa_out_tab.

l_wa_out_tab-value = v_SGTXT.

l_wa_out_tab-name = 'CONC'.

  • Modifico la tabla de salida para el formulario

MODIFY out_tab FROM l_wa_out_tab

TRANSPORTING value

WHERE NAME EQ 'CONC'.

Try the following:

READ TABLE out_tab WITH KEY 'CONC'.

IF sy-subrc EQ 0.

out_tab-value = V_SGTXT.

MODIFY out_tab INDEX sy-tabix.

ENDIF.

Regards,

Carlos.

Read only

0 Likes
723

Carlos.

I have to comment you the following.

1. The parameters input if they come to the subroutine.

2. To the moment to realize a SELECT, the same one it does not come back information always the SY-SUBRC has value of 4, to sorrow that if there is information with the conditions that sending in table.

3. It is to say the problem is to the moment to obtain the information in the SELECT

Thank

Carlos Orden

Edited by: Carlos Orden on Jul 6, 2010 5:26 PM

Read only

0 Likes
723

Ok Carlos, now I have more info...

If the problem is in the select, then it is due to v_LIFNR, v_AUGBL and v_BELNR are in external format.

Try to apply 'CONVERSION_EXIT_ALPHA_INPUT' to the variables.

Regards.

Carlos.

Read only

Clemenss
Active Contributor
0 Likes
723

Hi Carlos,

I agree it is the external format that does not match in SELECT. Put a (soft) breakpoint in the form routine to verify.

Regards,

Clemens