2006 May 31 7:17 AM
hi, i am unable to fetch data in my sap script
for the feild :bseg-sgtxt.
So, i have to write a form-perform code to get data.
the feilds which i have are bseg-belnr and bseg-buzei.
can anyone help me with the code to include in sap script
perform as well as form ?
rgds,
Ravindra
2006 May 31 7:26 AM
Hi
Refer this link
Smartforms & SapScript Black Book
http://www.ossincorp.com/Black_Box/Black_Box_2.htm
SapScript
http://www.sap-img.com/sapscripts.htm
http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm
http://www.henrikfrank.dk/abapexamples/SapScript/symbols.htm
http://sapbrain.com/TUTORIALS/TECHNICAL/SAPSCRIPTS_tutorial.html
Mark Helpfull answers
Regards
2006 May 31 7:26 AM
Hi
Refer this link
Smartforms & SapScript Black Book
http://www.ossincorp.com/Black_Box/Black_Box_2.htm
SapScript
http://www.sap-img.com/sapscripts.htm
http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm
http://www.henrikfrank.dk/abapexamples/SapScript/symbols.htm
http://sapbrain.com/TUTORIALS/TECHNICAL/SAPSCRIPTS_tutorial.html
Mark Helpfull answers
Regards
2006 May 31 7:29 AM
*In SAP SCRIPT you can write
/: PERFORM ADD_INCOME IN PROGRAM Z_MYINCLUDE_NAME
/: USING &var1&
/: USING &var1&
/: CHANGING &var2&
/: CHANGING &var2&
/: ENDPERFORM.
Include you can write your code inside.
FORM MYFORM TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
* update out_tab for the returing parameters to SAP SCRIPT
ENDFORM.
Cheers,
Thomas.
2006 May 31 7:30 AM
Syntax in a form window:
/: PERFORM <form> IN PROGRAM <prog>
/: USING &INVAR1&
/: USING &INVAR2&
......
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
......
/: ENDPERFORM
INVAR1 and INVAR2 are variable symbols and may be of any of the four SAP script symbol types.
OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings.
The ABAP subroutine called via the command line stated above must be defined in the ABAP report program as follows:
FORM <form> TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
...
ENDFORM.
The values of the SAP script symbols passed with /: USING... are now stored in the internal table IN_TAB. Hence values passed can be accessed form this internal table and used for further processing. The internal table OUT_TAB contains names and values of the CHANGING parameters in the PERFORM statement. By this way the changes or calculation made using the local symbols in the subroutine can be passed back to the form for printing. OUT_TAB is also of type ITSCY.
Example
Perform called in text editor of form.
/E PERFORM_ABAP
/: PERFORM CALLED_FROM_SAPSCRIPT IN PROGRAM zsapscriptexits
/: USING &invar1&
/: USING &invar2&
/: CHANGING &outvar1&
/: CHANGING &outvar2&
/: ENDPERFORM
<b>Abap subroutine</b>
FORM CALLED_FROM_SAPSCRIPT
TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
DATA: TABIX LIKE SY-TABIX.
TABLES: KNA1.
READ TABLE IN_TAB WITH KEY NAME = 'KUNNR'.
KNA1-KUNNR = IN_TAB-VALUE.
READ TABLE OUT_TAB WITH KEY NAME = 'NAME'.
TABIX = SY-TABIX.
OUT_TAB-NAME = 'NAME'.
SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ KNA1-KUNNR.
IF SY-SUBRC EQ 0.
CONCATENATE KNA1-NAME1 KNA1-ORT01 INTO OUT_TAB-VALUE
SEPARATED BY SPACE.
ELSE.
CONCATENATE KNA1-KUNNR 'not found' INTO OUT_TAB-VALUE
SEPARATED BY SPACE.
ENDIF.
MODIFY OUT_TAB INDEX TABIX.
ENDFORM.
2006 May 31 7:31 AM
Hi Ravindra,
Use this format
IN SCRIPT:
/: PERFORM GET_BARCODE6 IN PROGRAM ZVXR0076
/* USING &BARCV&
/: USING &BARC6&
/: CHANGING &BARCODE&
/: ENDPERFORM
IN PROGRAM ZVXR0076
FORM get_barcode TABLES sap_data STRUCTURE itcsy
abap_data STRUCTURE itcsy.
DATA : barcv LIKE karte-barcv,
barcode(11).
READ TABLE sap_data WITH KEY name = 'BARCV'.
IF sy-subrc EQ 0.
MOVE sap_data-value TO barcv.
ENDIF.
WRITE barcv TO barcode NO-ZERO.
CONDENSE barcode NO-GAPS.
READ TABLE abap_data WITH KEY name = 'BARCODE'.
IF sy-subrc EQ 0.
abap_data-value = barcode.
MODIFY abap_data INDEX sy-tabix.
ENDIF.
ENDFORM. "GET_BARCODE
2006 May 31 7:33 AM
This seems to be a very common problem. actually the bseg-sgtext field is normally blank( as in our case here)..so first chk out in the table BSEG if this field has any value for ur data. & if no data is popluated obviously it wont come in your printout...
hope it helps..
2024 Nov 07 10:01 AM
Hello,
I have write a perform to fetch data and call that perform on script form also but while debugging internal input table gets empty and i am not able to understand why this happening.
2024 Nov 07 10:03 AM
Hello but in my case bseg-sgtxt field is not blank it has values for all documents still its display as empty on script form