on 09-09-2011 3:57 AM
Hi all,
I have an internal table (written in an external subroutine) that I want to be outputted onto the SAPscript form. I am trying to use loop....call write_form but I can't get it to work.
This is the code I have tried:
form get_components tables intab structure itcsy
outtab structure itcsy.
*---Get delivery doc number
read table intab with key 'VBPLP-VBELN'.
check sy-subrc = 0.
gv_deldoc = intab-value.
*---Get item number
read table intab with key 'VBPLP-POSNR'.
check sy-subrc = 0.
gv_posnr = intab-value.
*--do some data manipulation here to get data into it_comp...--*
loop at it_comp into st_comp.
call function 'WRITE_FORM'
exporting
element = 'DELPOS'
function = 'APPEND'
type = 'BODY'
window = 'MAIN'
* IMPORTING
* PENDING_LINES =
* EXCEPTIONS
* ELEMENT = 1
* FUNCTION = 2
* TYPE = 3
* UNOPENED = 4
* UNSTARTED = 5
* WINDOW = 6
* BAD_PAGEFORMAT_FOR_PRINT = 7
* SPOOL_ERROR = 8
* CODEPAGE = 9
* OTHERS = 10
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endloop.
endform. "text
And in the SAPscript I have:
/E DELPOS
/: PERFORM GET_COMPONENTS IN PROGRAM ZPROGRAM
/: USING &VBPLP-VBELN&
/: USING &VBPLP-POSNR&
/: ENDPERFORM
DP ,,,,<H>&ST_COMP-MATNR&</>
This is what I thought will work based on looking around the forums - but it seems I am missing something. What is it?
Thanks
Hi,
Debug Your subroutine pool program. check below statements, whether sy-subrc EQ 0 or not.
*---Get delivery doc number
read table intab with key 'VBPLP-VBELN'.
check sy-subrc = 0.
*---Get item number
read table intab with key 'VBPLP-POSNR'.
check sy-subrc = 0.
If Sy-subrc NE 0. then remaining block of code will not executed.
and also check internal table it_comp having data or not...
Regards,
Surya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have verified that table it_comp has data and it is not the 'checks' that are causing the issue.
Shiva, can you explain in more detail what you mean? I looked at the wiki but the solution it proposes I dont think will work for my case. Every time the subroutine is called, 1 sales order is passed into it, which can be tied to say 5 materials. Using the method from the wiki:
i.e.
wa_outtab-value = it_adrc-city.
MODIFY fp_it_outtab FROM wa_outtab INDEX sy-tabix.
This will only show one material in the sapscript when the internal table has 5 materials. I thought write_form could handle this but am still not successful
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You need to pass the modified value back to perform as changing parameters.
You need to declare work areas for these ITAB.
If possible debug the code
And also I think WRITE_FORM is not required here.
Pass the changed parameters in ITAB fp_it_outtab to script.
Please look into below WIKI for more info:
http://wiki.sdn.sap.com/wiki/display/profile/ExternalSubroutinesinSAPScript
Shiva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.