‎2010 Aug 16 12:24 PM
Hi all
i have internal table with the follwing data
and i want to move the entries (FNAM ,FVAL ) that relate to one screen 0101
into new table and the entries for the new screen 7101 to diffrent table
program dynpro dynbegin fnam fval
SAPMF02D 0101 X
0000 BDC_CURSOR RF02D-D0110
0000 BDC_OKCODE /00
0000 RF02D-KUNNR 1000
0000 RF02D-D0110 X
SAPMF02D 7101 X
0000 BDC_OKCODE /EF12
0000 BDC_CURSOR RF02D-KUNNRI want in table 1 for screen 0101
fnam fval
BDC_CURSOR RF02D-D0110
BDC_OKCODE /00
RF02D-KUNNR 1000
RF02D-D0110 Xand in table 2 screen 7101
BDC_OKCODE /EF12
BDC_CURSOR RF02D-KUNNRwhat is the best way to do that assume the tables content can
be change i.e. have more screens.
Best regards
Alex
‎2010 Aug 16 2:56 PM
A suggestion/sample on how to build an internal table of internal tables associated to the dynpros of the batch input :
TYPES: BEGIN OF dynpros,
program LIKE bdcdata-program,
dynpro LIKE bdcdata-dynpro,
bdcdata LIKE bdcdata OCCURS 0,
END OF dynpros.
DATA: i_data TYPE TABLE OF bdcdata,
e_data TYPE TABLE OF dynpros.
FIELD-SYMBOLS: <f1> TYPE bdcdata,
<f2> TYPE dynpros.
LOOP AT i_data ASSIGNING <f1>.
IF <f1>-program IS NOT INITIAL
OR <f1>-dynpro IS NOT INITIAL.
READ TABLE e_data ASSIGNING <f2>
WITH KEY program = <f1>-program
dynpro = <f1>-dynpro.
IF sy-subrc NE 0.
APPEND INITIAL LINE TO e_data ASSIGNING <f2>.
<f2>-program = <f1>-program.
<f2>-dynpro = <f1>-dynpro.
ENDIF.
APPEND <f1> TO <f2>-bdcdata.
ENDIF.
ENDLOOP.Regards,
Raymond
‎2010 Aug 16 12:41 PM
I have created some simple pseudo code... may help you:
LOOP AT itab ASSIGNING <fs_line>.
CASE <fs_line>-dynpro.
WHEN '0101'.
flag_0101 = abap_true.
flag_7101 = abap_false.
WHEN '0101'.
flag_0101 = abap_false.
flag_7101 = abap_true.
WHEN space.
IF flag_0101 = abap_true.
... code to move entries to 0101 itab...
ENDIF.
IF flag_7101 = abap_true.
... code to move entries to 7101 itab...
ENDIF.
WHEN OTHERS.
CLEAR: flag_0101, flag_7101.
ENDCASE.
ENDLOOP.
<removed by moderator>
Edited by: Thomas Zloch on Aug 16, 2010 2:12 PM - please do not ask for ...
‎2010 Aug 16 1:07 PM
HI Gemini Twin
Thanks but the problem here is that you refer
to the screen like hardcoded screen 0101 7101 and this is the simple
case i wont a generic solution since the screen num can be change
to 200 300 etc
best regards
Alex
‎2010 Aug 16 1:18 PM
At some point you will have to know the screen number you are dealing with, otherwise how would you knwo where to move the values to? Not sure how else you could do this then.
‎2010 Aug 16 2:01 PM
‎2010 Aug 16 2:56 PM
A suggestion/sample on how to build an internal table of internal tables associated to the dynpros of the batch input :
TYPES: BEGIN OF dynpros,
program LIKE bdcdata-program,
dynpro LIKE bdcdata-dynpro,
bdcdata LIKE bdcdata OCCURS 0,
END OF dynpros.
DATA: i_data TYPE TABLE OF bdcdata,
e_data TYPE TABLE OF dynpros.
FIELD-SYMBOLS: <f1> TYPE bdcdata,
<f2> TYPE dynpros.
LOOP AT i_data ASSIGNING <f1>.
IF <f1>-program IS NOT INITIAL
OR <f1>-dynpro IS NOT INITIAL.
READ TABLE e_data ASSIGNING <f2>
WITH KEY program = <f1>-program
dynpro = <f1>-dynpro.
IF sy-subrc NE 0.
APPEND INITIAL LINE TO e_data ASSIGNING <f2>.
<f2>-program = <f1>-program.
<f2>-dynpro = <f1>-dynpro.
ENDIF.
APPEND <f1> TO <f2>-bdcdata.
ENDIF.
ENDLOOP.Regards,
Raymond
‎2010 Aug 16 3:45 PM
HI Raymond
Thanks for replay
I try your code with little adjustment
TYPES: BEGIN OF dynpros,
program TYPE bdcdata-program,
dynpro TYPE bdcdata-dynpro,
bdcdata TYPE hrtb_bdcdata , <-- change it to table for the append statment APPEND <f1> TO <f2>-bdcdata.
END OF dynpros.
and what i get in e_data is :
E_DATA
SAPMF02D 0101 Standard Table[1x5(618)]
SAPMF02D 7101 Standard Table[1x5(618)]
this is not really what i need
i want to get all the FNAM and FVAL from the table like this
I want in table 1 for screen 0101
fnam fval
BDC_CURSOR RF02D-D0110
BDC_OKCODE /00
RF02D-KUNNR 1000
RF02D-D0110 Xand in table 2 screen 7101
BDC_OKCODE /EF12
BDC_CURSOR RF02D-KUNNRBest Regards
Alex
‎2010 Aug 16 3:54 PM
‎2010 Aug 16 4:18 PM
HI Raymond
Thaks again
it try to do your suggestion and its not work
any differnt suggestion?
Thanks in Advance
Alex
‎2010 Aug 16 6:23 PM
Hi, alex,
Did you take a look into the BAPI's : BAPI_CUSTOMER_CREATE,
BAPI_CUSTOMER_EDIT ?
Regards, Sebastiá
‎2010 Aug 17 11:16 AM
HI ,
I know this Bapi's but how they should help me?
Regards
Alex