2012 Aug 22 10:20 AM
Hi experts,
I have 5 line items for the same billing document ( Table: VBRP, Vbeln is primary key) , I want store each row in different variables, because i want to send that line items to external id. I Know the concepts of mail sending from sap. When i try my concepts the last line item only stored into that variables. I want all line items in different variables. Please Help me.
My code:
parameters : docno type vbrk-vbeln.
select fkimg arktx kzwi1 from vbrp into (fkimg1,arktx1,kzwi11) where vbeln = docno.
t1 = arktx1.
t2 = fkimg1.
t3 = kzwi11.
endselect.
Hints: How can i get the table value in different variables?
Thanks and Regards,
Linganathan.K
2012 Aug 22 3:48 PM
Hi Linganathan,
I would put the result of the select into an internal table. Then you have one line in the table for each of the line items. Best regards
Thorsten
2012 Aug 23 9:26 AM
Hi Thorsten,
Can You explain me somewhat briefly.
Thanks and Regards,
Linganathan.K
2012 Aug 23 9:39 AM
HI Linganathan,
Take all the selection data in an internal table.
Then loop to this internal table and keep on concatenating the details which you need and at end of the VBELN, move whereever you need..
Hope this helps
2012 Aug 23 9:43 AM
Dear Harshad Bhingarkar, Thanks for your reply.
If possible can you send some sample coding for the same example. I will be very thankful to u.
Thanks,
Linganathan.K
2012 Aug 23 5:55 PM
Hi Linganathan,
pseudo code looks like this:
select field1, field2, field 3 from... into table itab where...
loop at itab into wa.
send_eMail(wa-field1, wa-field2, wa-field3).
endloop.
But please also spend some time and take a look at the standard documentation for Open SQL and internal tables.
Best regards
Thorsten
2012 Aug 24 5:47 AM
Dear Thorsten,
Thanks for your reply,
I know fetching the data from table and also loop,
See: the first row of data from table is fetching using select statement, after 2nd row will fetch, after 3rd. etc..
My query is: for each time i want to move the data into some different variables(like t1,t2,t3, etc ), Can you getting my points?
Thanks and Regards,
Linganathan.K
2012 Aug 24 9:17 PM
Hi Linganathan,
not sure, if I completely understand what you want to do. Here how you could do it.
But how do you know how many variables do you need? You can see in my example code that I exit the loop after 3 times, because I only have three variables. But can you rely on that?
REPORT zts_fieldsymbols.
DATA: gt_t005 TYPE STANDARD TABLE OF t005,
gs_t005 TYPE t005.
DATA: gv_land1_01 TYPE land1,
gv_land1_02 TYPE land1,
gv_land1_03 TYPE land1.
DATA: gv_counter(2) TYPE n,
gv_varname(11) TYPE c.
FIELD-SYMBOLS: <gv_land1> TYPE land1.
SELECT * FROM t005 INTO CORRESPONDING FIELDS OF TABLE gt_t005.
LOOP AT gt_t005 INTO gs_t005.
gv_counter = sy-tabix.
IF gv_counter <= 3.
CONCATENATE 'GV_LAND1_' gv_counter INTO gv_varname.
ASSIGN (gv_varname) TO <gv_land1>.
<gv_land1> = gs_t005-land1.
UNASSIGN <gv_land1>.
ELSE.
EXIT.
ENDIF.
ENDLOOP.
WRITE: gv_land1_01, space, gv_land1_02, space, gv_land1_03.
Best regards
Thorsten