‎2006 Jul 31 5:46 AM
hi
i want to send the selected data to application server, my problem is up to internal table there is data but this data is not tranfer to the workarea.plse help me how to solve this problem.
DATA: BEGIN OF it_customer_master OCCURS 100,
kunnr LIKE kna1-kunnr,
name1 LIKE kna1-name1,
name2 LIKE kna1-name2,
kunn2 LIKE knvp-kunn2,
spart LIKE knvv-spart,
vtext LIKE tspat-vtext,
vkgrp LIKE knvv-vkgrp,
regio LIKE kna1-regio,
bezei LIKE t005s-bezei,( DURING RUN TIME THIS VALUE WILL BE PICKED)
END OF it_customer_master.
DATA: BEGIN OF wa_customer_mas OCCURS 100,
kunnr LIKE kna1-kunnr,
name1 LIKE kna1-name1,
name2 LIKE kna1-name2,
kunn2 LIKE knvp-kunn2,
spart LIKE knvv-spart,
vtext LIKE tspat-vtext,
vkgrp LIKE knvv-vkgrp,
regio LIKE kna1-regio,
END OF wa_customer_mas.
DATA:lv_file LIKE wa_customer_mas.
OPEN DATASET g_filename FOR OUTPUT IN TEXT MODE." ENCODING DEFAULT.
IF sy-subrc NE 0.
WRITE: 'Unable to open the file'.
ELSE.
LOOP AT it_customer_master INTO wa_customer_mas.
lv_file = wa_customer_mas.
TRANSFER lv_file TO g_filename.
ENDLOOP.
ENDIF.
CLOSE DATASET g_filename.
this is the logic i am using to send the data to the application server.plse help me how to populate the workarea.
with regards
serma
‎2006 Jul 31 5:51 AM
HI,
look into bold line change your code like this.
DATA: BEGIN OF it_customer_master OCCURS 100,
kunnr LIKE kna1-kunnr,
name1 LIKE kna1-name1,
name2 LIKE kna1-name2,
kunn2 LIKE knvp-kunn2,
spart LIKE knvv-spart,
vtext LIKE tspat-vtext,
vkgrp LIKE knvv-vkgrp,
regio LIKE kna1-regio,
* bezei LIKE t005s-bezei,( DURING RUN TIME THIS VALUE WILL BE PICKED)
END OF it_customer_master.
<b>DATA: wa_customer_mas like line of it_customer_master.</b>
DATA:lv_file LIKE wa_customer_mas.
OPEN DATASET g_filename FOR OUTPUT IN TEXT MODE.
IF sy-subrc NE 0.
WRITE: 'Unable to open the file'.
ELSE.
LOOP AT it_customer_master INTO wa_customer_mas.
lv_file = wa_customer_mas.
TRANSFER lv_file TO g_filename.
ENDLOOP.
ENDIF.
CLOSE DATASET g_filename.REgards,
Wasim Ahmed
‎2006 Jul 31 6:09 AM
hi Wasim Ahmed
i done the changes sujjested by you even then data is not going to the work area.plse
with regards
serma
‎2006 Jul 31 5:57 AM
Hello Seema
You have defined another internal table instead of work area..
so just define the work area as like <your internal table name>
Thanks
‎2006 Jul 31 6:12 AM
HI,
Declare ur workarea like this...
DATA : wa_customer_master LIKE LINE OF it_customer_master.
It will solve ur problem.
Rgds,
Prakash
‎2006 Jul 31 6:15 AM
HI serma,
check wheater the data exists in the internal table or not.
I think your internal table is empty and that why it is not transferring any data to work area.
place a break point at LOOP and then look what is happening there is no other reason why the data is not going to work area instead that internal table consists no data.
<b>IF NOT it_customer_master[] IS INITIAL.
LOOP AT it_customer_master INTO wa_customer_mas.
lv_file = wa_customer_mas.
TRANSFER lv_file TO g_filename.
ENDLOOP.
ELSE.
MESSAGE S000(SU) WITH 'No data in internal table'.
ENDIF.</b>Regards,
Wasim Ahmed
‎2006 Jul 31 7:10 AM
‎2006 Jul 31 7:52 AM
DATA: BEGIN OF it_customer_master OCCURS 100,
kunnr LIKE kna1-kunnr,
name1 LIKE kna1-name1,
name2 LIKE kna1-name2,
kunn2 LIKE knvp-kunn2,
spart LIKE knvv-spart,
vtext LIKE tspat-vtext,
vkgrp LIKE knvv-vkgrp,
regio LIKE kna1-regio,
bezei LIKE t005s-bezei,( DURING RUN TIME THIS VALUE WILL BE PICKED)
END OF it_customer_master.
DATA:wa_customer_mas LIKE LINE OF it_customer_master.
SELECT vkorg parvw
FROM knvp
INTO CORRESPONDING FIELDS OF TABLE it_knvp
WHERE spart = knvp-spart.
IF sy-subrc = 0.
LOOP AT it_knvp.
WRITE: it_knvp-vkorg,
it_knvp-parvw.
ENDLOOP.
ENDIF.
*selection of ship-to-party
SELECT kunn2
FROM knvp
INTO CORRESPONDING FIELDS OF TABLE it_shipto
FOR ALL ENTRIES IN it_knvp
WHERE parvw = 'WE'
AND vkorg = it_knvp-vkorg.
IF sy-subrc = 0.
LOOP AT it_shipto.
it_customer_master-kunn2 = it_shipto-kunn2.
WRITE:it_customer_master-kunn2.
ENDLOOP.
ENDIF.
*selection for cusotmer name and region
SELECT kunnr name1 name2 regio
FROM kna1
INTO CORRESPONDING FIELDS OF TABLE it_kunnr
WHERE land1 = 'IN'
AND spras = 'EN'.
*AND spras = 'EN'.
IF sy-subrc = 0.
LOOP AT it_kunnr.
it_customer_master-kunnr = it_kunnr-kunnr.
it_customer_master-name1 = it_kunnr-name1.
it_customer_master-name2 = it_kunnr-name2.
it_customer_master-regio = it_kunnr-regio.
ENDLOOP.
ENDIF.
IF NOT it_division IS INITIAL.
SELECT vtext
INTO CORRESPONDING FIELDS OF TABLE it_vtext
FROM tspat
FOR ALL ENTRIES IN it_division
WHERE spart = it_division-spart.
ENDIF.
DESCRIPTION OF SALES EMPLOYEE
LOOP AT it_vtext.
it_customer_master-vtext = it_vtext-vtext.
ENDLOOP.
g_filename = '\date\today\dev\customer_master.txt'.
OPEN DATASET g_filename FOR OUTPUT IN TEXT MODE." ENCODING DEFAULT.
IF sy-subrc NE 0.
WRITE: 'Unable to open the file'.
ELSE.
IF NOT it_customer_master[] IS INITIAL.
LOOP AT it_customer_master INTO wa_customer_mas.
lv_file = wa_customer_mas.
TRANSFER lv_file TO g_filename.
ENDLOOP.
ENDIF.
ENDIF.
CLOSE DATASET g_filename.
EXIT.
SELECT spart vkgrp
FROM knvv
INTO CORRESPONDING FIELDS OF TABLE it_division
FOR ALL ENTRIES IN it_kunnr
WHERE kunnr = it_kunnr-kunnr.
LOOP AT it_division.
it_customer_master-spart = it_division-spart.
it_customer_master-vkgrp = it_division-vkgrp.
ENDLOOP.
this is the datailed logic, upto internal table there is data but it is not tranfers to the work area.
i hope i given clear explanation.
plse guide me to solve this ...
thans with regards
serma