Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

tricky logic

Former Member
0 Kudos

Hi Friends

am facing one issue during one code change,

below is format of inbound file

----------------------------------------------------------------------------------------------------------------------

1   02   MOB     3343
0211 343    P    343

03100kljkl

02110

033999

02533

03987897    8978789    89789798

042001****

like this above format inbound file coming  first one is header line

from 02 and 03 combination  , PO get created using one bapi  but  bapi has written inside  third ( if and endif ) block of rectype 03

at the last of program  one acknowledge file is getting creating as output exactly in above inbound  format.


expected output  should have   10 digit newly created sales order number (from bapi)  infront of all 02 starting records at distance of 110

-------------------------------------------------------------------------------------------------------------------------------------------------

1   02   MOB     3343
0211 343    P    343

03100kljkl

02110       

033999

02533      **

03987897    8978789    89789798

042001****

issue is :  only for record type starting with 02   at the place of 110   newly created sales order 10 digit number should display

but this sales order getting created from bapi  and that is inside 03 rectype if-endif  block.

that bapi generated sap sales doc number need to display  that is challange becz   code logic now is

      inbound file

            1)perform  create sales order

                         loop on mail table which have inbound file data.
                            if  rectype = 1

                                      some validation
                          endif.
                            if  rectype = 02

                                    some validation
                           endif.
                           if  rectype  = 03

                                    some validation
                                                       sales order creation  bapi

                    
                             if  rectype = 4
                                then reading footer record last one
                             endif.
                            endif .
                            endloop.

2)                perform  create acknowledge file .

and if I change perform  table type then that structure need to change in all over program as its long and old code so that is

not advisable ... what should be the best logic in this case

main structure is define in this  below way  so many other internal tables defined from below structure only.

TYPES:   BEGIN OF ty_file_data,

      data(900) TYPE c,   "Data line
     END OF   ty_file_data,
1 ACCEPTED SOLUTION

paul_bakker2
Active Contributor
0 Kudos

Hi,

I'm not sure if I understand what your problem is, but it sounds like you just need to store the created sales order numbers in an internal table, along with the record number of the relevant '02' line..

Then, when you generate your 'acknowledge' file, you read this internal table and insert the sales order number at the end of the matching record.

record nr     salesordernr

2                    33102

4                    33103

6                    33104

But like I said, I'm not sure I understand. Because it doesn't sound that 'tricky' ..?

cheers

Paul

6 REPLIES 6

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

Why not use XML  format ?

Regards.

Former Member
0 Kudos

Hello

Excel can not be use here as  this is very old interface design and lots of validation are in place.

can't break any working functionality  can not be break ..

0 Kudos

Hi,

I wrote XML......

Regards.

0 Kudos

Eitan, for XML the explanation is probably the same. It seems to be no up to the OP to decide on the file format and layout. Sadly, to these days some interfaces require the mainframe-like file structure.

@OP - to be honest, I lost it somewhere around 3rd paragraph and can't understand what you are trying to do at all. (Lack of punctuation doesn't help here either.) But I suspect that if you just tried to think about it and explained it clearly, you might have easily found a solution yourself (see Cardboard Programmer).

0 Kudos

Hi,

I was under the impression that this is a new development.

If this is an old interface I am assuming that there must be a code somewere to parse the data .

If this is the case the only thing to do is to learn the code and convert to ABAP.

Regards.

paul_bakker2
Active Contributor
0 Kudos

Hi,

I'm not sure if I understand what your problem is, but it sounds like you just need to store the created sales order numbers in an internal table, along with the record number of the relevant '02' line..

Then, when you generate your 'acknowledge' file, you read this internal table and insert the sales order number at the end of the matching record.

record nr     salesordernr

2                    33102

4                    33103

6                    33104

But like I said, I'm not sure I understand. Because it doesn't sound that 'tricky' ..?

cheers

Paul